[darcs-users] tag name listing

Sean E. Russell ser at germane-software.com
Wed Jan 28 14:56:50 UTC 2004


On Wednesday 28 January 2004 07:00, David Roundy wrote:
> > I'm sorry. I misunderstood tag and patch. What I mean is; how do i print
> > the current patch name. By "current", i mean the last recorded/applied.
> > My understanding of "patch name" is that it is similar to RCS's revision
> > number, except that it can be any string.
>
> Well, the best I can think of would be to use darcs changes and parse the
> machine readable output.  The following will work as long as your patch
> name is less than 10,000 characters:

The other thing is to use the XML output option:

	darcs changes --xml-output | grep name | head -1

That'll give you the last patch name no matter how long it is :-)

You'd probably want to strip out the XML markup, too:

	darcs changes --xml-output | grep '<name>' | head -1 | \
		sed 's/^.*<name>//;s/<\/name>$//'

Change the number argument to 'head' to get the last N patch names.  Oh, and 
you'll have to mentally unescape the XML entities quotes, apostrophes, 
less-thans, and ampersands, or expand the sed replace

=== BEGIN
#!/bin/sh
darcs changes --xml-output |\
    grep '<name>' |\
    head -${1} |\
    sed 's/^.*<name>//;s/<\/name>$//;s/&quot;/"/g;s/&apos;/`/g;s/&lt;/</g'
=== END

If you want the list to be "prettier", you can try things like replacing 
"<name>" with "* " and "</name>" with "\n":

   ...
   sed 's/^.*<name>/* /;s/<\/name>$/\n/;s/&quot;/"/g;s/&apos;/`/g;s/&lt;/</g'


Here's some example output from one of my projects:

ser at petra Work/StatusReport% darcs changes --xml-output |\
grep '<name>' |\
head -5 |\
sed 's/^.*<name>/* /;s/<\/name>$/\n/;s/&quot;/"/g;s/&apos;/`/g;s/&lt;/</g'

* Removed the interactive change feature

* Added "stress" and "long" flags, major refactoring of sitrep

* Build system now works with both GHC and NHC98

* Changed todo list

* Refactored and simplified options handling


Cheers

-- 
### SER   
### Deutsch|Esperanto|Francaise|Linux|XML|Java|Ruby|Aikido
### http://www.germane-software.com/~ser  jabber.com:ser  ICQ:83578737 
### GPG: http://www.germane-software.com/~ser/Security/ser_public.gpg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url : http://lists.osuosl.org/pipermail/darcs-users/attachments/20040128/f863b620/attachment.pgp 


More information about the darcs-users mailing list