D691: cmdutil: fix amend when passing a date
lothiraldan (Boris Feld)
phabricator at mercurial-scm.org
Tue Sep 12 17:24:42 UTC 2017
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D691
AFFECTED FILES
mercurial/cmdutil.py
tests/test-amend.t
CHANGE DETAILS
diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -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
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3060,6 +3060,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
To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list