amend: add boolean to ignore date-only change
authorYuya Nishihara <yuya@tcha.org>
Mon, 07 Jan 2019 21:39:35 +0900
changeset 41124 cffa8e0ba77a
parent 41123 b153a4aa06f8
child 41125 126101284e04
amend: add boolean to ignore date-only change I want to add -D/--currentdate option, which should behave slightly different from the update-timestamp option.
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Mon Jan 07 21:29:58 2019 +0900
+++ b/mercurial/cmdutil.py	Mon Jan 07 21:39:35 2019 +0900
@@ -2442,10 +2442,12 @@
 
         user = opts.get('user') or old.user()
 
+        datemaydiffer = False  # date-only change should be ignored?
         if opts.get('date'):
             date = dateutil.parsedate(opts.get('date'))
         elif ui.configbool('rewrite', 'update-timestamp'):
             date = dateutil.makedate()
+            datemaydiffer = True
         else:
             date = old.date()
 
@@ -2561,15 +2563,13 @@
         if ((not changes)
             and newdesc == old.description()
             and user == old.user()
+            and (date == old.date() or datemaydiffer)
             and pureextra == old.extra()):
             # nothing changed. continuing here would create a new node
             # anyway because of the amend_source noise.
             #
             # This not what we expect from amend.
-            if (date == old.date() or
-                (ui.configbool('rewrite', 'update-timestamp') and
-                 not opts.get('date'))):
-                return old.node()
+            return old.node()
 
         commitphase = None
         if opts.get('secret'):