[darcs-users] revision identifiers
Max Battcher
me at worldmaker.net
Sat Mar 29 05:10:11 UTC 2008
Declan Naughton wrote:
> Contexts DEFINITELY deserve much more publicity.
Right. I just realized in writing my article that there is not a
general topic in the Manual about context files...
> The reason I asked about revision identifiers is because I'm looking
> at writing a program that will need to navigate files in a source
> repository - and people need to be able to specify specific versions
> of a file to use. So, I'm hoping it's not too much bother, but how
> does one narrow down the patches (to produce a context file?) that are
> used to reproduce a file? Am I right to say: in other words what is a
> command to find all the patches that depend the addfile patch of a
> particul file?
I'm not quite sure that what you are seeking to do is exactly what the
best approach with darcs would be. If you are willing to get used to
darcs' differences there are some very cool possibilities that you could
try for your source navigator.
First of all, I don't think context files are what you are looking for
specifically. Here's where I would start focusing on:
To get the patches that have added/modified a file, that's the simple
matter of ``darcs changes file-name``. For your program you would want
to append the ``--xml-output`` flag to have a more machine-parseable
response.
The ``darcs annotate`` command is quite useful for examining the current
state and immediate history of a file, and it has a useful
``--xml-output`` as well. For browsing other states you'll want to use
the ``darcs diff`` command. I'd recommend getting familiar with both of
their manual pages.
Programmatically your best bet is probably to make use of ``darcs
diff``'s ``--from-match`` and ``--to-match`` options and use the hash
matching with hashes from changes' xml output to select arbitrary states
in the file history.
Hopefully that might give you some direction to start from...
--
--Max Battcher--
More information about the darcs-users
mailing list