# HG changeset patch # User Anton Shestakov # Date 1570630923 -25200 # Node ID 9936aecc9ea392e45e8c7db12dd09678064b4381 # Parent 20380ae44d0f52e3f397b750a009c08b6ceb6509 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. diff -r 20380ae44d0f -r 9936aecc9ea3 CHANGELOG --- 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 ------------------- diff -r 20380ae44d0f -r 9936aecc9ea3 hgext3rd/evolve/cmdrewrite.py --- 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(), diff -r 20380ae44d0f -r 9936aecc9ea3 tests/test-metaedit.t --- 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