rebase: backout changeset d755a9531fce stable
authorSiddharth Agarwal <sid0@fb.com>
Wed, 03 Feb 2016 09:24:47 -0800
branchstable
changeset 27976 8f4d3eeb5198
parent 27975 6f92d6bd2972
child 27977 b698abf971e7
rebase: backout changeset d755a9531fce This is a dependency for a future backout of 88fde8db5307. See the previous patches for why.
hgext/rebase.py
--- a/hgext/rebase.py	Wed Feb 03 09:23:52 2016 -0800
+++ b/hgext/rebase.py	Wed Feb 03 09:24:47 2016 -0800
@@ -47,6 +47,17 @@
 def _nothingtorebase():
     return 1
 
+def _savegraft(ctx, extra):
+    s = ctx.extra().get('source', None)
+    if s is not None:
+        extra['source'] = s
+    s = ctx.extra().get('intermediate-source', None)
+    if s is not None:
+        extra['intermediate-source'] = s
+
+def _savebranch(ctx, extra):
+    extra['branch'] = ctx.branch()
+
 def _makeextrafn(copiers):
     """make an extrafn out of the given copy-functions.
 
@@ -208,7 +219,7 @@
         collapsemsg = cmdutil.logmessage(ui, opts)
         date = opts.get('date', None)
         e = opts.get('extrafn') # internal, used by e.g. hgsubversion
-        extrafns = []
+        extrafns = [_savegraft]
         if e:
             extrafns = [e]
         keepf = opts.get('keep', False)
@@ -398,6 +409,10 @@
                 ui.status(_('reopening closed branch head %s\n') % dest)
 
         if keepbranchesf:
+            # insert _savebranch at the start of extrafns so if
+            # there's a user-provided extrafn it can clobber branch if
+            # desired
+            extrafns.insert(0, _savebranch)
             if collapsef:
                 branches = set()
                 for rev in state: