Patchwork D691: cmdutil: fix amend when passing a date

login
register
mail settings
Submitter phabricator
Date Sept. 12, 2017, 6:23 p.m.
Message ID <3b2349e569978905e8e87983ee6d9e13@localhost.localdomain>
Download mbox | patch
Permalink /patch/23816/
State Not Applicable
Headers show

Comments

phabricator - Sept. 12, 2017, 6:23 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGae95853c250a: cmdutil: fix amend when passing a date (authored by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D691?vs=1763&id=1765

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-amend.t

CHANGE DETAILS




To: lothiraldan, #hg-reviewers, singhsrb
Cc: singhsrb, mercurial-devel

Patch

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
@@ -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