# HG changeset patch # User Yuya Nishihara # Date 1547123557 -32400 # Node ID 4145fd3569c32e7e511e8abb5fd1835154303d73 # Parent 3dcc96582627ac701b730cf09a3bc967768a5dbe amend: turn currentdate into tri-state bool so config option can be negated Otherwise, rewrite.update-timestap couldn't be overridden by --no-currentdate. FWIW, which do we like? --no-currentdate vs --no-current-date. If the latter is preferred, maybe we can add "graft --current-date" and deprecate "--currentdate". diff -r 3dcc96582627 -r 4145fd3569c3 hgext/amend.py --- a/hgext/amend.py Fri Jan 04 17:54:18 2019 +0100 +++ b/hgext/amend.py Thu Jan 10 21:32:37 2019 +0900 @@ -36,7 +36,7 @@ ('e', 'edit', None, _('invoke editor on commit messages')), ('i', 'interactive', None, _('use interactive mode')), ('n', 'note', '', _('store a note on the amend')), - ('D', 'currentdate', False, + ('D', 'currentdate', None, _('record the current date as commit date')), ] + cmdutil.walkopts + cmdutil.commitopts + cmdutil.commitopts2, _('[OPTION]... [FILE]...'), diff -r 3dcc96582627 -r 4145fd3569c3 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Fri Jan 04 17:54:18 2019 +0100 +++ b/mercurial/cmdutil.py Thu Jan 10 21:32:37 2019 +0900 @@ -2450,7 +2450,8 @@ date = dateutil.parsedate(opts.get('date')) elif opts.get('currentdate'): date = dateutil.makedate() - elif ui.configbool('rewrite', 'update-timestamp'): + elif (ui.configbool('rewrite', 'update-timestamp') + and opts.get('currentdate') is None): date = dateutil.makedate() datemaydiffer = True else: diff -r 3dcc96582627 -r 4145fd3569c3 tests/test-amend.t --- a/tests/test-amend.t Fri Jan 04 17:54:18 2019 +0100 +++ b/tests/test-amend.t Thu Jan 10 21:32:37 2019 +0900 @@ -453,6 +453,14 @@ date: Thu Jan 01 00:00:05 1970 +0000 summary: commit 1 +rewrite.update-timestamp can be negated by --no-currentdate + + $ hg amend --config rewrite.update-timestamp=True --no-currentdate -u baz + $ hg log --limit 1 + user: baz + date: Thu Jan 01 00:00:05 1970 +0000 + summary: commit 1 + Bad combination of date options: $ hg amend -D --date '0 0'