Patchwork [1,of,5,STABLE,emergency-fix] amend: don't preserve most extra fields

login
register
mail settings
Submitter Siddharth Agarwal
Date Feb. 3, 2016, 5:26 p.m.
Message ID <cbaa30443fd7280b212a.1454520367@dev666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/12952/
State Accepted
Headers show

Comments

Siddharth Agarwal - Feb. 3, 2016, 5:26 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1454518786 28800
#      Wed Feb 03 08:59:46 2016 -0800
# Branch stable
# Node ID cbaa30443fd7280b212ad887e19af57bfaed6649
# Parent  f5d06d31b7937249ed8e02fa3ea5af867130eb2d
# Available At http://42.netv6.net/sid0-wip/hg/
#              hg pull http://42.netv6.net/sid0-wip/hg/ -r cbaa30443fd7
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.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2623,11 +2623,6 @@  def amend(ui, repo, commitfunc, old, ext
                 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 @@  def amend(ui, repo, commitfunc, old, ext
                 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.
                 #
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1682,9 +1682,6 @@  def _docommit(ui, repo, *pats, **opts):
         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,