Export with diff hash?

Jason Harris jason at jasonfharris.com
Sun Jun 20 06:09:29 CDT 2010


On Jun 20, 2010, at 12:44 PM, Martin Geisler wrote:

> Jason Harris <jason at jasonfharris.com> writes:
> 
>> However if one is importing the patch to a different tree or the
>> history has been edited, which one can do through export followed by
>> import, then the parent hash number will not exist as is. However,
>> likely there is still the same 'parent' just with a different hash
>> set. Ie the diff is the same for the parent, the author is the same,
>> etc.
>> 
>> So would it make sense to include this in the above header. Something
>> like:
>> 
>> ---------
>> 
>> # HG changeset patch
>> # User jfh <jason at jasonfharris.com>
>> # Date 1276961422 -7200
>> # Node ID 58e3679ba81330385744e98ccd5de9fb9e18e84b
>> # Parent  fb24fe2f74e0e97fca3044923ff24c817bf37d73
>> # Diff Hash  c2838b6b38ab0823bac3486f82a246eb
>> Some message
>> 
>> <diff content...>
>> 
>> ---------
>> 
>> Where the diff hash is just calculated hg diff -c parentRev | md5
> 
> That would be very fragile since patches are often edited before being
> applied in order to solve conclicts. This is yet another case where
> editing history effectively voids your guarantee of being able to import
> things from others.
> 
> I'm normally not even interested in applying the patch at the point
> where it was exported. Part of what makes the exchange of patches so
> powerful is the implicit rebase that takes place when it is applied to
> the tip of a tree.


Hmmm... Maybe you are right then... I just found I have needed this concept and it would be handy in a number of situations. I do a lot of rebasing and moving stuff around so I don't actually modify the patches much, but I guess if I did then as you say this concept would not be as useful and you would have to resort to specifying for each patch where it should go.

Cheers,
  Jas


More information about the Mercurial-devel mailing list