changeset 41126:b153a4aa06f8

amend: refactor commit date handling There's no need to parse a date tuple. Just do it for user option.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 07 Jan 2019 21:29:58 +0900
parents 14271b524d76
children cffa8e0ba77a
files mercurial/cmdutil.py
diffstat 1 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Mon Jan 07 21:57:23 2019 +0900
+++ b/mercurial/cmdutil.py	Mon Jan 07 21:29:58 2019 +0900
@@ -2441,16 +2441,13 @@
         extra.update(wctx.extra())
 
         user = opts.get('user') or old.user()
-        date = opts.get('date') or old.date()
-
-        if ui.configbool('rewrite', 'update-timestamp'):
-            if opts.get('date'):
-                pass
-            else:
-                date = dateutil.makedate()
-
-        # Parse the date to allow comparison between date and old.date()
-        date = dateutil.parsedate(date)
+
+        if opts.get('date'):
+            date = dateutil.parsedate(opts.get('date'))
+        elif ui.configbool('rewrite', 'update-timestamp'):
+            date = dateutil.makedate()
+        else:
+            date = old.date()
 
         if len(old.parents()) > 1:
             # ctx.files() isn't reliable for merges, so fall back to the