diff hgext/mq.py @ 6139:989467e8e3a9

Fix bad behaviour when specifying an invalid date (issue700) commit (aborts _after_ typing in a commit message) backout (aborted after the initial revert) tag (edited .hgtags and couldn't commit) import (patch applied, then commit fails) qnew (aborts on bad dates, but writes any valid date into the # Date header) qrefresh (like qnew) sign (like tag) fetch (merge, merge, merge, merge, abort)
author Thomas Arendsen Hein <thomas@intevation.de>
date Sun, 17 Feb 2008 21:34:28 +0100
parents f89878df40fe
children 0c2b443fb3c3
line wrap: on
line diff
--- a/hgext/mq.py	Sun Feb 17 12:53:57 2008 +0100
+++ b/hgext/mq.py	Sun Feb 17 21:34:28 2008 +0100
@@ -612,6 +612,8 @@
         force = opts.get('force')
         user = opts.get('user')
         date = opts.get('date')
+        if date:
+            date = util.parsedate(date)
         self.check_reserved_name(patch)
         if os.path.exists(self.join(patch)):
             raise util.Abort(_('patch "%s" already exists') % patch)
@@ -640,7 +642,7 @@
                 p.write("# HG changeset patch\n")
                 if user:
                     p.write("# User " + user + "\n")
-                p.write("# Date " + date + "\n")
+                p.write("# Date %d %d\n" % date)
                 p.write("\n")
             elif user:
                 p.write("From: " + user + "\n")
@@ -935,6 +937,9 @@
         if len(self.applied) == 0:
             self.ui.write("No patches applied\n")
             return 1
+        newdate = opts.get('date')
+        if newdate:
+            newdate = '%d %d' % util.parsedate(newdate)
         wlock = repo.wlock()
         try:
             self.check_toppatch(repo)
@@ -995,7 +1000,6 @@
                         comments = ['From: ' + newuser, ''] + comments
                 user = newuser
 
-            newdate = opts.get('date')
             if newdate:
                 if setheaderfield(comments, ['# Date '], newdate):
                     date = newdate