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

David Roundy droundy at darcs.net
Wed Aug 1 22:48:32 UTC 2007


On Wed, Aug 01, 2007 at 10:51:42PM +0200, Alexander Staubo wrote:
> 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.

This sounds good.  The format, at least, should be devised by someone who's
actually going to use it (e.g. you).  (btw, "sounds good" doesn't mean I
have time to implement it myself, or know of anyone who does, but it's
doable and reasonably so)

> * "changes" should provide dependency information and include it in the
> XML.

This is hard, generally O(N^2) where N is the total number size of the
repository (number of patches * average patch size).  I very much doubt
anyone will actually want to use this, or if they do use it, they'll stop
doing so as their repository grows.

Note that I believe the amount of output is also in general O(N^2), which
would mean that there's no possible algorithm that could make this better
than an O(N^2), even if we were to cache the dependencies.

> * "pull" and "push" need to support XML. The structure should mirror
> the human-readable output.

Reasonable.  This wouldn't happen unless we have a user, though.  It's too
easy to design a feature that couldn't possibly be useful to anyone.

> * "pull" and "push" should provide dependency information, as above.

This once again runs into trouble in terms of how you want to represent
this.  It's O(N^2) with a much smaller N, so it's likely to be feasible,
but we'd need a good format, and we certainly wouldn't want to do this by
default.

> > > [*] 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:

The pull --verbose code is very rarely used, and very old.  If you want it
to display differently (it might be easier to read if it were indented),
you could send in a request to bugs at darcs.net.

My feeling is that the "Would pull the following changes:" listing is
easier to read without indentation, as it is a simple list of patches, but
if you disagree, you could suggest otherwise.

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

That's a bug that you could report (to bugs at darcs.net).

> > 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).

I think to find that out, you could try reading the manual:

http://www.darcs.net/manual/node7.html#SECTION00772000000000000000

although I see that the manual doesn't mention the most common use, which
is with darcs send.
-- 
David Roundy
Department of Physics
Oregon State University



More information about the darcs-users mailing list