[darcs-users] annotate output (Was: machine-readable formats)

Lele Gaifax lele at nautilus.homeip.net
Sat Sep 4 13:20:32 UTC 2010

On Sat, 4 Sep 2010 11:38:23 +0100
Eric Kow <kowey at darcs.net> wrote:

> As for the patch info hash prefix (see http://wiki.darcs.net/Hashes ),
> this hash is produced in Darcs.Patch.Info.makeFileName and seems
> to use three sections: timestamp, author hash, actual patchinfo hash,
> as an example:
>   20100904030947-fb03a-fac657d51ee80c33488031d8bdcfab769aa7f83c
> I guess we could use a prefix of the third segment, so continuing that
> example:
>                        fac658d5
> We originally had an idea of intelligently picking the smallest prefix
> that would be unambiguous for a given local repository, but I think
> Ganesh has recently pointed out on IRC that maybe just going for
> uniformly chars could be a better alternative.

I'm -0 on such a prefix, even assuming it would unambiguously identify
a single patch (regardless being the smallest possible).

That would imply two things at the very minimum:

a) darcs hash matcher should learn the trick, so that the user could
   quickly looking up the related patch

b) tracdarcs would use a "SELECT ... WHERE hash LIKE %-fac658d5%" to
   locate patch metadata within the database. Given that that kind of
   expression cannot use the unique index on the hash column, this
   would result in a sensible slowdown on modest-to-big repositories.

So, I would prefer either the full hash name, or an arbitrary index
coupled with a legend (that could be sorted by patch date to gain a
little sense in the numbering...) like in Petr's original

In the latter case, maybe we could go with a mix of YAML and a custom
microformat, taking advantage of the "multiple documents"[1] feature:

    - hash: 20100903001327-fb03a-045b1923d4b1b1b432d3e3b03840101f4f9891e3
      name: Remove redundant set -ev from tentative_revert.sh.
      date: 2010-09-03 00:13:27 +0
      author: Petr Rockai <me at mornfall.net>
    - hash: 20100904030947-fb03a-fac657d51ee80c33488031d8bdcfab769aa7f83c
      name: What a patch!
      date: 2010-09-04T03:09:47Z
      author: John Doe
    - hash: 20100904151247-a433a-oac77ade86ab7772cbb1932acdffc65f11abcd81
      name: Last atch
      date: 2010-09-04T15:12:47Z
      author: Lele
    1       First line of the file
    3       second line, tweaked by Lele
    2       third line, added by John

Here I used a TAB to enhance readability, but it could be anything. I
also used a one-based index, that seems appropriate bikeshedding :)

ciao, lele.

[1] http://www.yaml.org/spec/1.2/spec.html#id2800132
nickname: Lele Gaifax    | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas    | comincerò ad aver paura di chi mi copia.
lele at nautilus.homeip.net |                 -- Fortunato Depero, 1929.

More information about the darcs-users mailing list