D5513: amend: concise logic for rewrite.updatetimestamp

taapas1128 (Taapas Agrawal) phabricator at mercurial-scm.org
Mon Jan 7 13:22:39 UTC 2019


taapas1128 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5513

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2444,11 +2444,9 @@
         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()
+        if (ui.configbool('rewrite','update-timestamp') and
+           not opts.get('date')):
+            date = dateutil.makedate()
 
         # Parse the date to allow comparison between date and old.date()
         date = dateutil.parsedate(date)
@@ -2570,9 +2568,7 @@
             # 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'))):
+            if (date == old.date() or not opts.get('date')):
                 return old.node()
 
         commitphase = None



To: taapas1128, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list