amend: don't preserve most extra fields stable
authorSiddharth Agarwal <sid0@fb.com>
Wed, 03 Feb 2016 08:59:46 -0800
branchstable
changeset 27973 ce9696193175
parent 27972 92a61d7618ac
child 27974 bb14a81ce647
amend: don't preserve most extra fields This backs out changeset 39163708825cd. There are some extra fields that absolutely should not be preserved, like the convert_revision field introduced by the convert and hgsubversion extensions. The problem with extensions blacklisting certain extra fields is that they might not be enabled at the time the amend is performed. In the long run we probably want separately marked transferable and non-transferable extra fields, but for now restore the old Mercurial 3.6 behavior.
mercurial/cmdutil.py
mercurial/commands.py
--- a/mercurial/cmdutil.py	Wed Feb 03 11:01:11 2016 -0200
+++ b/mercurial/cmdutil.py	Wed Feb 03 08:59:46 2016 -0800
@@ -2623,11 +2623,6 @@
                 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,
@@ -2645,7 +2640,7 @@
                 and newdesc == old.description()
                 and user == old.user()
                 and date == old.date()
-                and pureextra == pureoldextra):
+                and pureextra == old.extra()):
                 # nothing changed. continuing here would create a new node
                 # anyway because of the amend_source noise.
                 #
--- a/mercurial/commands.py	Wed Feb 03 11:01:11 2016 -0200
+++ b/mercurial/commands.py	Wed Feb 03 08:59:46 2016 -0800
@@ -1682,9 +1682,6 @@
         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,