betabug... Sascha Welter

home english | home deutsch | Site Map | Sascha | Kontakt | Pro | Weblog | Wiki

27 June 2008

darcs match reminder

Usefull options: exact, date

I'm one of the happiest cows around ever since sm made me discover darcs when I started hacking on Zwiki. Lately I've switched to darcs at work too. For a long time there was one single task in the user interface that had me confused: Seeing the diff for one particular patch in the past...


When looking at a list of patches (e.g. with darcs changes --last=10), you see one with a name like #27 u:w2pform add class="w2pform" (to body tag). Now when I want to see the diff of that patch, I had a hard time to convince darcs diff to show me the patch in question. The problem is that the --patch and -match options need all kind of regex or glob characters escaped when you feed them a patch name, you can't just copy+paste the patch name.

Taking some time going through the manual, I discovered the proper way to do this. The --match option is really powerful, as the manual says you can do things like these:

darcs diff --match 'exact "#27 u:w2pform add class=\"w2pform\" (to body tag)."'

Ok, you still have to escape the double quotes ("), but I seem to be rarely using them in patch names. In this case, where the name starts with a unique identifier (issue number), you could also use a regular expression with good success, which is matched against the patch name:

darcs diff --match 'name #27'

Using name with single word identifiers seems to be a good strategy to find patches in the depths of history - use with darcs changes first to see what you'd get. Similarly you could match against the author field. There's also a hash options, to find patches by their hash identifier, which I probably won't be using - it's meant more for automatic processing.

What I will be using more - even if it's for fun and information - is the date keyword to --match:

darcs changes --match 'date "2008-06-26"'
darcs changes --match 'date "last 3 days"'
# or even:
darcs changes --match 'date "between 2008-06-20 and 2008-06-24"'

I'll close with this wonderful quote from the manual:

The --match pattern can include the logical operators &&, || and not, as well as grouping of patterns with parentheses.

Which means when you really, really have to dig for that one patch you faintly remember back in $MONTH having to do with identifyer xy... you have a powerful search tool to find it!

Posted by betabug at 11:13 | Comments (0) | Trackbacks (0)
ch athens
Life in Athens (Greece) for a foreigner from the other side of the mountains. And with an interest in digital life and the feeling of change in a big city. Multilingual English - German - Greek.
Main blog page
Recent Entries
Best of
Some of the most sought after posts, judging from access logs and search engine queries.

Apple & Macintosh:
Security & Privacy:
Misc technical:
Athens for tourists and visitors:
Life in general:
<< οι | Main | In geheimer Mission >>
Comments
There are no comments.
Trackbacks
You can trackback to: http://betabug.ch/blogs/ch-athens/853/tbping
There are no trackbacks.
Leave a comment