[darcs-users] New patch name format details?

Kevin Smith yarcs at qualitycode.com
Wed Nov 19 05:05:30 UTC 2003


I'm struggling a little trying to understand exactly what goes in to a 
new-format patch filename. Here's the code from PatchInfo.lhs:

-----
make_filename :: PatchInfo -> String
make_filename (PatchInfo dps nps aps lps inv) =
     cleanDate d++"-"++fix_author a++"-"++sha1 (n++a++d++concat l++b2c 
inv)++".gz"
         where b2c True = ['t']
               b2c False = ['f']
               d = unpackPS dps
               n = unpackPS nps
               a = unpackPS aps
               l = map unpackPS lps

fix_author a = take 5 $ sha1 a
-----

So we have the date as YYYYMMDDHHMMSS, then the first five characters of 
a string representation of the sha1 of the author name, then the full 
sha1 of: the patch name (nps) and the patch author (aps) and the patch 
date (dps) and the patch log.

I tried to get the same value for author name, using sha1sum. The couple 
test cases I tried (with "David Roundy <droundy at abridgegame.org>") gave 
different results from the corresponding patch file name. Do I need to 
append something to the end?

Can you describe the format that the date is in at the point it is added 
to the string to be hashed?

Exactly what string would be used for a log entry that has a one-liner 
plus a couple lines of long entries? Does it include everything inside 
the square brackets? Does it include the square brackets? Is it assumed 
to be normalized to LF only for newlines?

Is there any place in the code that does verifies the hash yet? If not, 
that would eventually be a nice sanity check for each patch file.

Thanks much,

Kevin





More information about the darcs-users mailing list