changeset 34121:ae95853c250a

cmdutil: fix amend when passing a date Following https://phab.mercurial-scm.org/D636, passing the same date that the changeset to amend would results in no new commits but the output changed from: $ hg amend -d '0 0' nothing changed [1] to: $ hg amend -d '0 0' Restore the old behavior by parsing the date passed as parameter so the condition "date == old.date()" correctly works in cases both dates are identical. Add a test for covering this regression. This bug was found thanks to Evolve test suite. Differential Revision: https://phab.mercurial-scm.org/D691
author Boris Feld <boris.feld@octobus.net>
date Mon, 11 Sep 2017 18:07:29 +0200
parents 07f09995e857
children c0ce60459d84
files mercurial/cmdutil.py tests/test-amend.t
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Sep 12 11:18:35 2017 -0400
+++ b/mercurial/cmdutil.py	Mon Sep 11 18:07:29 2017 +0200
@@ -3059,6 +3059,9 @@
         user = opts.get('user') or old.user()
         date = opts.get('date') or old.date()
 
+        # Parse the date to allow comparison between date and old.date()
+        date = util.parsedate(date)
+
         if len(old.parents()) > 1:
             # ctx.files() isn't reliable for merges, so fall back to the
             # slower repo.status() method
--- a/tests/test-amend.t	Tue Sep 12 11:18:35 2017 -0400
+++ b/tests/test-amend.t	Mon Sep 11 18:07:29 2017 +0200
@@ -85,6 +85,14 @@
   nothing changed
   [1]
 
+  $ hg amend -d "0 0"
+  nothing changed
+  [1]
+
+  $ hg amend -d "Thu Jan 01 00:00:00 1970 UTC"
+  nothing changed
+  [1]
+
 Matcher and metadata options
 
   $ echo 3 > C