[PATCH 3 of 3 RFC] commit: preserve extra when amending with commit --amend
Mike Edgar
adgar at google.com
Sat Nov 28 03:14:26 CST 2015
# HG changeset patch
# User Mike Edgar <adgar at google.com>
# Date 1448701917 18000
# Sat Nov 28 04:11:57 2015 -0500
# Node ID 389b9907470c61bc502a4e78724aa9b336d81cf6
# Parent 61b51342ac74bc0239a8aa4592ee8df1f70f91c0
commit: preserve extra when amending with commit --amend
The new extra propagation needs to be accounted for in cmdutil.amend,
when checking for a no-changes fast-path.
diff -r 61b51342ac74 -r 389b9907470c mercurial/cmdutil.py
--- a/mercurial/cmdutil.py Sat Nov 28 04:11:38 2015 -0500
+++ b/mercurial/cmdutil.py Sat Nov 28 04:11:57 2015 -0500
@@ -2619,6 +2619,11 @@
message = old.description()
pureextra = extra.copy()
+ if 'amend_source' in pureextra:
+ del pureextra['amend_source']
+ pureoldextra = old.extra()
+ if 'amend_source' in pureoldextra:
+ del pureoldextra['amend_source']
extra['amend_source'] = old.hex()
new = context.memctx(repo,
@@ -2636,7 +2641,7 @@
and newdesc == old.description()
and user == old.user()
and date == old.date()
- and pureextra == old.extra()):
+ and pureextra == pureoldextra):
# nothing changed. continuing here would create a new node
# anyway because of the amend_source noise.
#
diff -r 61b51342ac74 -r 389b9907470c mercurial/commands.py
--- a/mercurial/commands.py Sat Nov 28 04:11:38 2015 -0500
+++ b/mercurial/commands.py Sat Nov 28 04:11:57 2015 -0500
@@ -1547,6 +1547,9 @@
if not allowunstable and old.children():
raise error.Abort(_('cannot amend changeset with children'))
+ newextra = extra.copy()
+ newextra['branch'] = branch
+ extra = newextra
# commitfunc is used only for temporary amend commit by cmdutil.amend
def commitfunc(ui, repo, message, match, opts):
return repo.commit(message,
More information about the Mercurial-devel
mailing list