rebase: preserve the 'intermediate-source' attribute of grafts
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 08 Nov 2015 17:56:48 -0500
changeset 26902 7ffebbdcb371
parent 26901 0e3d093c468e
child 26903 7e8912dbcea2
rebase: preserve the 'intermediate-source' attribute of grafts Preserving the 'source' attribute of grafts started with a69a77a80900, which predates the introduction of 'intermediate-source' in 51930a7180bd by a year and a half. It looks like not preserving this was an oversight. On a related note, notice how the source value of 32af76 is no longer visible in the graph above this test. Is it reasonable to import the sha1 translation from evolve.py:relocate() into scmutil or similar, and use that to fixup these attributes as well as the commit message? (I realize that evolve is still experimental, but I don't see a way to do this from the evolve extension.)
hgext/rebase.py
tests/test-rebase-obsolete.t
--- a/hgext/rebase.py	Wed Nov 11 15:08:08 2015 -0600
+++ b/hgext/rebase.py	Sun Nov 08 17:56:48 2015 -0500
@@ -48,6 +48,9 @@
     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()
--- a/tests/test-rebase-obsolete.t	Wed Nov 11 15:08:08 2015 -0600
+++ b/tests/test-rebase-obsolete.t	Sun Nov 08 17:56:48 2015 -0500
@@ -248,6 +248,30 @@
   D
   
   
+  $ hg up -qr 'desc(G)'
+  $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003
+  grafting 11:4596109a6a43 "D"
+  $ hg up -qr 'desc(E)'
+  $ hg rebase -s tip -d .
+  rebasing 14:9e36056a46e3 "D" (tip)
+  $ hg log --style default --debug -r tip
+  changeset:   15:627d4614809036ba22b9e7cb31638ddc06ab99ab
+  tag:         tip
+  phase:       draft
+  parent:      4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba
+  parent:      -1:0000000000000000000000000000000000000000
+  manifest:    15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42
+  user:        Nicolas Dumazet <nicdumz.commits@gmail.com>
+  date:        Sat Apr 30 15:24:48 2011 +0200
+  files+:      D
+  extra:       branch=default
+  extra:       intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003
+  extra:       rebase_source=9e36056a46e37c9776168c7375734eebc70e294f
+  extra:       source=32af7686d403cf45b5d95f2d70cebea587ac806a
+  description:
+  D
+  
+  
   $ cd ..
 
 collapse rebase