[darcs-users] annotate output

Lele Gaifax lele at nautilus.homeip.net
Mon Sep 6 09:11:27 UTC 2010


On Mon, 06 Sep 2010 09:49:19 +0200
Petr Rockai <me at mornfall.net> wrote:

> PS: I find it curios, if somewhat amusing, how nothing happened with
> the annotate output for a couple years, until someone re-implements
> it with a new output format. All of sudden, everyone has an opinion
> on how should the output look...

With respect, that's not true. Just because some of us is more
productive with other languages, it does not mean that "nothing
happened"! I bet most of us had an opinion on the subject since the
beginning, but given that workaround existed for a long time, there
were better ways to spend hacker's time...

I initially proposed YAML because I consider it a better markup, in
the context we are talking about, against both XML and JSON. And I
really hope that my suggestion gets considered for what it is, a
constructive alternative idea, even in the light that, I admit, I'm
not up-to-the-task of implementing it in Haskell.

As already said, I still think it is a viable alternative when it
comes to the task: dumping *structured* data that you want
re-elaborate later by some other machine code, without sacrifying
human readability.

So, while I agree that subsequent reasoning (the fact that YAML is not
well suited to render the annotated lines of content) marks the limits
of the approach, I'm biased to split the problem in two parts:

a) dumping "annotate" information in a way that's easy to elaborate
b) dumping an "annotated" content that's easy to the human eye

IMHO, folding the two in the same solution is wrong.

That brings me to still another suggestion: solve subproblem b) with a
syntax similar to other VCs, like

    $ darcs annotate README
    p1      First line
    p2      second line
    p3      third line

where "pX" is whatever we recognize as minimal indentification of the
patch that touched that line of code.

For subproblem b), I'll ideally code something like

    $ darcs annotate --yaml README
    - 20100903001327-fb03a-045b1923d4b1b1b432d3e3b03840101f4f9891e3
    - 20100904030947-fb03a-fac657d51ee80c33488031d8bdcfab769aa7f83c
    - 20100904151247-a433a-oac77ade86ab7772cbb1932acdffc65f11abcd81
    lines_patch: [1, 3, 2]

where "lines_patch" (an attribute with a better name to come) is an
array where each item is the index to the patch that touched the
"positional-corresponding" line of content. No fancy escape needed,
very compact, and basically all that tracdarcs needs to do its work.

ciao, lele.
--
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