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

Matt Harbison mharbison72 at gmail.com
Wed Nov 11 19:11:28 CST 2015


On Wed, 11 Nov 2015 09:16:42 -0500, Yuya Nishihara <yuya at tcha.org> wrote:

> On Sun, 08 Nov 2015 18:48:44 -0500, Matt Harbison wrote:
>> # 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
>
> This seems good, but I'm not certain because 51930a7180bd says that the
> intermediate-source was introduced to change the hash of the grafted  
> revision.
> For this purpose, rebase_source is enough.

I think this is more useful than just to change the hash, since unlike the  
equivalent fields for rebase and transplant, 'source' always points to the  
original cset after a sequence of grafts.  This one points to the source  
of the graft operation actually used.  I'm sure I read a comment to this  
effect the other day (but can't find it now), or I would have put it in  
the commit comment.

I thought there was a request to track the immediate graft source on the  
ML, but the closest I could find is this:

     http://markmail.org/message/jpxdojn7mf74pusz

Currently, immediate-source is already being updated on conversion [1],  
and used for other purposes [2].

[1] https://selenic.com/hg/rev/273d94255e1e
[2] https://selenic.com/hg/rev/28d76bc069db


More information about the Mercurial-devel mailing list