[darcs-users] Getting a full diff for pulled patches

Alexander Staubo alex at purefiction.net
Wed Aug 1 20:51:42 UTC 2007


On 8/1/07, David Roundy <droundy at darcs.net> wrote:
> > I have spent a lot of time now driving Darcs from programs, and the
> > minimal support for this idiom makes it painful. The XML format is not
> > terribly useful to me since it doesn't provide diffs. Darcs uses at
> > least three vaguely different formats [*] to express patches, and my
> > parser must process all of them. Cleaning up and streamlining this
> > would be helpful.
>
> If you want to do something with the XML format, you could ask for new
> output to be added.  As I have mentioned, this is the only format darcs
> generates that's intended to be parsed by external programs.

Absolutely. My wish list gets pretty short once it boils down to
extending the XML:

* "changes" should include diffs in an XML structure that closely
mirrors the current text format.
* "changes" should provide dependency information and include it in the XML.
* "pull" and "push" need to support XML. The structure should mirror
the human-readable output.
* "pull" and "push" should provide dependency information, as above.

> > [*] There's the normal "pull -v" format, there's the "changes -v"
> > format (same as pull, but indented for some reason) and there's the
> > context format.
>
> The first two are formatted so as to look friendly to humans.  The
> indentation in changes -v is so that users can easily recognize the
> boundaries between one change and the next.

I don't understand the distinction; or rather, that "pull -v" should
not use the same user-friendly format as "changes -v". Consider the
current format:

$ darcs pull --all --no-summary --dry -v
We have the following new (to them) patches:
They have the following patches to pull:
Fri Jul 27 05:27:17 CEST 2007  Alexander Staubo <alex at purefiction.net>
  * Small fix.
Would pull the following changes:
Fri Jul 27 05:27:17 CEST 2007  Alexander Staubo <alex at purefiction.net>
  * Small fix.
hunk ./ProgressController.h 14
-        contextInfo: (void*) contextInfos;
+        contextInfo: (void*) contextInfo;

Compare this to:

$ darcs changes -v
Fri Jul 27 05:27:17 CEST 2007  Alexander Staubo <alex at purefiction.net>
  * Small fix.

    hunk ./ProgressController.h 14
    -        contextInfo: (void*) contextInfos;
    +        contextInfo: (void*) contextInfo;

(Also note the confusing "We have the following new (to them)
patches:" bit, printed even though the list is empty.)

> The context format is darcs' internal format.

That's the other bit of weird inconsistency; why print the context
format at all, especially when it's internal to Darcs? And especially
when "pull -v --dry-run" lists the full contents of all the patches in
the simple diff-style format? "pull -v" doesn't. If the context format
is useful to someone, you could move it into a dedicated flag (like
--context).

> > > > (2) Add a flag to "pull" and possibly "changes" that included the
> > > > patch context in the output. I believe this would be sufficient to
> > > > determine dependencies.
> > >
> > > I'm not sure what you mean by the "patch context."  In standard darcs
> > > terminology, this would mean the set of all preceding patches, which is
> > > pretty obvious in darcs changes, and also completely useless with regard to
> > > determining dependencies.
> >
> > Yeah, I just realized this. Change that to mean dependencies, then. Possible?
>
> What do you mean by "changes to that"?

I meant: Change what I wrote about "patch context" and read that to
say "dependencies" instead.

> You also might need to clear some environment variables, since they can
> also affect darcs output formatting (particularly those related to
> coloring).

I'm setting these:

DARCS_DONT_COLOR=1
DARCS_DONT_ESCAPE_TRAILING_SPACES=1
DARCS_DONT_ESCAPE_ANYTHING=1

I'm disabling the escaping because I don't need it -- I want the raw
data. (Does ANYTHING imply TRAILING_SPACES? The manual is ambiguous on
the matter, so I'm setting the latter to be sure.)

Alexander.



More information about the darcs-users mailing list