[darcs-users] [issue861] make hash matching work for the new hashed repo patch file names

Ben Coburn btcoburn at silicodon.net
Sun May 18 18:45:05 UTC 2008


On May 18, 2008, at 10:45, Lele Gaifax wrote:

> On Sun, 18 May 2008 16:57:10 -0000
> Ben Coburn <bugs at darcs.net> wrote:
>
>> For example, take a patch with a traditional darcs hash of
>> '20080513112149-05dcb-4c273a98eae16cc9d273f18af9907f9f2e567224'
>> and a new hashed file name of
>> '0000012256
>> -2f91882e2149f43e2463fb9ee80edd67e379734ab0e395ae6cf36655a595bff0'.
>>
>> The command "darcs2 changes --match 'hash ...'" should be smart
>> enough to match either hash type. Currently it only matches the old
>> hash.
>
> Beware, I'm just trying to understand/solve issue859, that in turn
> lead me to understand the "new hash", so...
>
> While the *hash* of a patch is a constant thing, being computed from
> the patch *metadata* such as date, author, name and log, the *name* of
> a patch, in the new hashed format, is computed from the *actual*
> contents of the patch itself, and it is actually
>
>  length_of_the_whole_patch-sha256sum_of_the_whole_patch
>
> Now, I am *not* sure, but AFAIK the actual contents of a given patch
> *may* change, when darcs commutes it with other patches, and thus
> both the length and the sha256 checksum is not constant, and cannot be
> used to identify a patch.
>

I've just been reverse-engineering the repo format from the files on  
disk so I can't answer this....

Even so, I think one could always go the long way around: Load the  
patch file directly. Compute the old-style hash. Then, proceed with  
matching as usual.

However, there are probably much simpler and better ways to do this. :-)

Regards, Ben Coburn




More information about the darcs-users mailing list