comparison mercurial/commands.py @ 1202:71111d796e40

Commit date validation: more stringent checks, more useful error messages.
author Bryan O'Sullivan <bos@serpentine.com>
date Sun, 04 Sep 2005 14:47:02 -0700
parents c165cbf56bb1
children 4003ea658693
comparison
equal deleted inserted replaced
1201:59bfbdbc38f6 1202:71111d796e40
658 if pats: 658 if pats:
659 c, a, d, u = repo.changes(files=fns, match=match) 659 c, a, d, u = repo.changes(files=fns, match=match)
660 files = c + a + [fn for fn in d if repo.dirstate.state(fn) == 'r'] 660 files = c + a + [fn for fn in d if repo.dirstate.state(fn) == 'r']
661 else: 661 else:
662 files = [] 662 files = []
663 repo.commit(files, message, opts['user'], opts['date'], match) 663 try:
664 repo.commit(files, message, opts['user'], opts['date'], match)
665 except ValueError, inst:
666 raise util.Abort(str(inst))
664 667
665 def copy(ui, repo, source, dest): 668 def copy(ui, repo, source, dest):
666 """mark a file as copied or renamed for the next commit""" 669 """mark a file as copied or renamed for the next commit"""
667 return repo.copy(*relpath(repo, (source, dest))) 670 return repo.copy(*relpath(repo, (source, dest)))
668 671
1262 if rc['files']: 1265 if rc['files']:
1263 files += open(rc['files']).read().splitlines() 1266 files += open(rc['files']).read().splitlines()
1264 1267
1265 rc['parent'] = map(repo.lookup, rc['parent']) 1268 rc['parent'] = map(repo.lookup, rc['parent'])
1266 1269
1267 repo.rawcommit(files, message, rc['user'], rc['date'], *rc['parent']) 1270 try:
1271 repo.rawcommit(files, message, rc['user'], rc['date'], *rc['parent'])
1272 except ValueError, inst:
1273 raise util.Abort(str(inst))
1268 1274
1269 def recover(ui, repo): 1275 def recover(ui, repo):
1270 """roll back an interrupted transaction""" 1276 """roll back an interrupted transaction"""
1271 repo.recover() 1277 repo.recover()
1272 1278
1500 if repo.dirstate.state(".hgtags") == '?': 1506 if repo.dirstate.state(".hgtags") == '?':
1501 repo.add([".hgtags"]) 1507 repo.add([".hgtags"])
1502 1508
1503 message = (opts['message'] or opts['text'] or 1509 message = (opts['message'] or opts['text'] or
1504 "Added tag %s for changeset %s" % (name, r)) 1510 "Added tag %s for changeset %s" % (name, r))
1505 repo.commit([".hgtags"], message, opts['user'], opts['date']) 1511 try:
1512 repo.commit([".hgtags"], message, opts['user'], opts['date'])
1513 except ValueError, inst:
1514 raise util.Abort(str(inst))
1506 1515
1507 def tags(ui, repo): 1516 def tags(ui, repo):
1508 """list repository tags""" 1517 """list repository tags"""
1509 1518
1510 l = repo.tagslist() 1519 l = repo.tagslist()