[darcs-devel] help understanding patches filenames

Juliusz Chroboczek Juliusz.Chroboczek at pps.jussieu.fr
Sun Apr 24 05:41:17 PDT 2005


> e.g.: 20050424104714-a9258-665fbe3365b723b91df6c95d1434c7bc2be5d6d7.gz
>
> I understand that the first section ("20050424104714") is the timestamp
> that is also stored in the inventory, but beyond that I'm at a loss.

>From PatchInfo.lhs:

  make_filename :: PatchInfo -> String
  make_filename (PatchInfo dps nps aps lps inv) =
      cleanDate d++"-"++sha1_a++"-"++sha1PS sha1_me++".gz"
          where b2ps True = packString "t"
                b2ps False = packString "f"
                sha1_me = concatPS [nps, aps, dps, concatPS lps, b2ps inv]
                d = unpackPS dps
                sha1_a = take 5 $ sha1PS aps

In plain words, the first section is ``cleanDate d'', where ``d'' is
the date stored in the patch.  The second section, ``take 5 $ sha1PS aps''
are the first 5 characters of the SHA1 hash of the author.  The third
section, ``sha1PS sha1_me'', is the SHA1 hash of the string sha1_me,
which is the concatenation of the name of the patch, the author, the
date, the log, and the boolean ``true'' or ``false'' depending on
whether the patch is inverted or not.

Note that this is likely to change in the future, so you should not
build darcs filenames yourself; if you're trying to grok a Darcs
repository, you should get your filenames from the index file
``_darcs/inventory''.  If you're trying to programmatically build a
Darcs repository, you should probaly feed it through ``darcs apply''.

                                        Juliusz





More information about the darcs-devel mailing list