[darcs-users] Finding patches that span multiple subdirectories

Yitzchak Gale gale at sefer.org
Sun Jul 19 13:36:09 UTC 2009

I wrote:
> ...I don't recall ever needing to
> record a patch that touched files in more than one
> subdirectory at once.

I decided to investigate this. I'll record here how I did it.

First, I verified that the output of

darcs changes -s | grep -v '^  *' | grep ' ./'

contains only lines of one of the following two formats:

"   ./foo -> ./bar"
"    X ./foo other_stuff"
  where the space and other_stuff are optional

There weren't very many of the first case, so I checked
them all by hand and found that none of them were
a problem.

For the second case, I did

Prelude Data.List> let
8).filter((" ./"`isPrefixOf`).drop 5).filter("
*"`isPrefixOf`))).iterate(drop 1.dropWhile(not.("

Prelude Data.List> System.Process.readProcess "/usr/bin/darcs"
["cha","-s"] "">>=return.multi

Unfortunately, there were 14 hits. 3 of those were just noise generated
by a few straggler files still left in the root of the repo, but the other
11 were actually patches than spanned 2 or more subdirectories.

Wow, what a hack. Is there any easier way to do this?

Well, of course, I could write a nice neat program that scrapes
the output of darcs changes -s instead of a GHCi
one-liner hack. Or I could write an even bigger program
that paws through the output of darcs changes -s --xml.
What I mean is, is there anything better than scraping
darcs changes -s like that?


More information about the darcs-users mailing list