diff 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
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Sep 04 14:45:03 2005 -0700
+++ b/mercurial/commands.py	Sun Sep 04 14:47:02 2005 -0700
@@ -660,7 +660,10 @@
         files = c + a + [fn for fn in d if repo.dirstate.state(fn) == 'r']
     else:
         files = []
-    repo.commit(files, message, opts['user'], opts['date'], match)
+    try:
+        repo.commit(files, message, opts['user'], opts['date'], match)
+    except ValueError, inst:
+        raise util.Abort(str(inst))
 
 def copy(ui, repo, source, dest):
     """mark a file as copied or renamed for the next commit"""
@@ -1264,7 +1267,10 @@
 
     rc['parent'] = map(repo.lookup, rc['parent'])
 
-    repo.rawcommit(files, message, rc['user'], rc['date'], *rc['parent'])
+    try:
+        repo.rawcommit(files, message, rc['user'], rc['date'], *rc['parent'])
+    except ValueError, inst:
+        raise util.Abort(str(inst))
 
 def recover(ui, repo):
     """roll back an interrupted transaction"""
@@ -1502,7 +1508,10 @@
 
     message = (opts['message'] or opts['text'] or
                "Added tag %s for changeset %s" % (name, r))
-    repo.commit([".hgtags"], message, opts['user'], opts['date'])
+    try:
+        repo.commit([".hgtags"], message, opts['user'], opts['date'])
+    except ValueError, inst:
+        raise util.Abort(str(inst))
 
 def tags(ui, repo):
     """list repository tags"""