[PATCH 1 of 2] rebase: preserve the 'intermediate-source' attribute of grafts

Matt Harbison mharbison72 at gmail.com
Sun Nov 8 23:48:44 UTC 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1447023408 18000
#      Sun Nov 08 17:56:48 2015 -0500
# Node ID 0647a6905581d40d3b9bd27a8438aa54842d49dd
# Parent  f9984f76fd90e439221425d751e29bae17bec995
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.)

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -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()
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -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 at 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


More information about the Mercurial-devel mailing list