metaedit: don't change commit date by default (issue5994) stable
authorAnton Shestakov <av6@dwimlabs.net>
Wed, 09 Oct 2019 21:22:03 +0700
branchstable
changeset 4898 9936aecc9ea3
parent 4897 20380ae44d0f
child 4899 c982e7fb5e7a
metaedit: don't change commit date by default (issue5994) We deliberately unset devel.default-date to allow hg commands to see the real system date, that demonstrates that metaedit doesn't fall back to system date for any of these commands.
CHANGELOG
hgext3rd/evolve/cmdrewrite.py
tests/test-metaedit.t
--- a/CHANGELOG	Wed Oct 09 20:16:38 2019 +0700
+++ b/CHANGELOG	Wed Oct 09 21:22:03 2019 +0700
@@ -5,6 +5,7 @@
 -------------------
 
   * pick: don't create any successors when there were no changes (issue6093),
+  * metaedit: don't change commit date by default (issue5994),
 
 9.2.1 -- 2019-10-05
 -------------------
--- a/hgext3rd/evolve/cmdrewrite.py	Wed Oct 09 20:16:38 2019 +0700
+++ b/hgext3rd/evolve/cmdrewrite.py	Wed Oct 09 21:22:03 2019 +0700
@@ -914,9 +914,8 @@
             updates = allctx[:]
             if p2 is not None and (root.p2() != p2 or not opts['fold']):
                 updates.append(p2)
-            # TODO: if the author and message are the same, don't create a new
-            # hash. Right now we create a new hash because the date can be
-            # different.
+            if not commitopts['fold'] and not commitopts['date']:
+                commitopts['date'] = root.date()
             commitopts = pycompat.byteskwargs(commitopts)
             newid, created = rewriteutil.rewrite(repo, root, updates, head,
                                                  [root.p1().node(),
--- a/tests/test-metaedit.t	Wed Oct 09 20:16:38 2019 +0700
+++ b/tests/test-metaedit.t	Wed Oct 09 21:22:03 2019 +0700
@@ -171,11 +171,20 @@
   |
   ~
 
-TODO: don't create a new commit in this case, we should take the date of the
-old commit (we add a default date with a value to show that metaedit is taking
-the current date to generate the hash, this way we still have a stable hash
-but highlight the bug)
-  $ hg metaedit --config devel.default-date="42 0"
+metaedit should preserve the original date of the edited commit (issue5994)
+
+  $ hg metaedit --config devel.default-date=
+  nothing changed
+
+metaedit doesn't create new commit if message and user aren't changed
+
+  $ hg metaedit --config devel.default-date= --user test --message 'E
+  > 
+  > 
+  > F'
+  nothing changed
+
+  $ hg metaedit --config devel.default-date= --date "42 0"
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg log -r '.^::.' --template '{rev}: {desc|firstline}\n'
   3: C