Submitter | Yuya Nishihara |
---|---|
Date | Jan. 10, 2019, 1:50 p.m. |
Message ID | <d954358f5b9e810fadf9.1547128214@mimosa> |
Download | mbox | patch |
Permalink | /patch/37619/ |
State | Accepted |
Headers | show |
Comments
On Thu, Jan 10, 2019 at 7:24 PM Yuya Nishihara <yuya@tcha.org> wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1547123557 -32400 > # Thu Jan 10 21:32:37 2019 +0900 > # Node ID d954358f5b9e810fadf9171d9724d99950b3358a > # Parent 33b5a23d3b3b5a8fed27e34987bbef9749e84dd7 > amend: turn currentdate into tri-state bool so config option can be negated > > Otherwise, rewrite.update-timestap couldn't be overridden by > --no-currentdate. > Nice one! Queued the series, many thanks! > > 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". > I will be happy with both.
On Thu, Jan 10, 2019 at 7:43 PM Pulkit Goyal <7895pulkit@gmail.com> wrote: > > > On Thu, Jan 10, 2019 at 7:24 PM Yuya Nishihara <yuya@tcha.org> wrote: > >> # HG changeset patch >> # User Yuya Nishihara <yuya@tcha.org> >> # Date 1547123557 -32400 >> # Thu Jan 10 21:32:37 2019 +0900 >> # Node ID d954358f5b9e810fadf9171d9724d99950b3358a >> # Parent 33b5a23d3b3b5a8fed27e34987bbef9749e84dd7 >> amend: turn currentdate into tri-state bool so config option can be >> negated >> >> Otherwise, rewrite.update-timestap couldn't be overridden by >> --no-currentdate. >> > > Nice one! Queued the series, many thanks! > >> >> 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". >> > > I will be happy with both. > I mean I will be happy with any of them!
Patch
diff --git a/hgext/amend.py b/hgext/amend.py --- a/hgext/amend.py +++ b/hgext/amend.py @@ -36,7 +36,7 @@ command = registrar.command(cmdtable) ('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 --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2450,7 +2450,8 @@ def amend(ui, repo, old, extra, pats, op 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 --git a/tests/test-amend.t b/tests/test-amend.t --- a/tests/test-amend.t +++ b/tests/test-amend.t @@ -453,6 +453,14 @@ Unlike rewrite.update-timestamp, -D/--cu 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'