[PATCH 3 of 4] amend: add boolean to ignore date-only change
Yuya Nishihara
yuya at tcha.org
Mon Jan 7 13:33:12 UTC 2019
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1546864775 -32400
# Mon Jan 07 21:39:35 2019 +0900
# Node ID d3181b286250540ecae30e46518c0fbdd43b5bb9
# Parent 224a7e7feb44b205dcb3900e1a0e003287278640
amend: add boolean to ignore date-only change
I want to add -D/--currentdate option, which should behave slightly different
from the update-timestamp option.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2442,10 +2442,12 @@ def amend(ui, repo, old, extra, pats, op
user = opts.get('user') or old.user()
+ datemaydiffer = False # date-only change should be ignored?
if opts.get('date'):
date = dateutil.parsedate(opts.get('date'))
elif ui.configbool('rewrite', 'update-timestamp'):
date = dateutil.makedate()
+ datemaydiffer = True
else:
date = old.date()
@@ -2561,15 +2563,13 @@ def amend(ui, repo, old, extra, pats, op
if ((not changes)
and newdesc == old.description()
and user == old.user()
+ and (date == old.date() or datemaydiffer)
and pureextra == old.extra()):
# nothing changed. continuing here would create a new node
# anyway because of the amend_source noise.
#
# This not what we expect from amend.
- if (date == old.date() or
- (ui.configbool('rewrite', 'update-timestamp') and
- not opts.get('date'))):
- return old.node()
+ return old.node()
commitphase = None
if opts.get('secret'):
More information about the Mercurial-devel
mailing list