[darcs-devel] darcs replace -- punctuation

David Roundy droundy at darcs.net
Sat Mar 3 07:41:53 PST 2007


On Fri, Feb 23, 2007 at 08:09:26PM -0800, Samuel A. Falvo II wrote:
> Some background on me...
> 
> Hello; I used to be on this list back in the 0.x days, hence, nobody
> would likely remember me.  I've since lost touch as Darcs has always
> been "good enough" for me.  Indeed, 1.0.1 was the last upgrade I ever
> made when I went off elsewhere.
> 
> Some background on my current problem...
> 
> I now have 1.0.8, and I was attempting to perform a search and replace
> function in several C files, when I came across this:
> 
> bash-2.05b$ darcs replace --token-chars="[a-zA-Z0-9_.\\\"]"
> "\"cpu\\.h\"" "<lib65816/cpu.h>" *.c darcs: '\"' not supported.

The problem is just that darcs doesn't want the '"' character to be
escaped.

> This is bad, not so much because of C, but because I also manage Forth
> projects with Darcs, and guess which character is valid (amongst
> others) in an identifier?  :)  (Answer: anything *but* space!)
> 
> Some prior research on this seems to indicate that the current patch
> storage format does not support recording "weird" character classes.

There is unfortunately a bit of add-hocness in the --token-chars
specification, because it was designed to be "like" a regexp, but the code
was created by myself a long time ago, when I was young and foolish, and
was just written by hand.

The main problem has to do with white spaces in the patch, as I recall.
But I haven't looked into it in ages, just followed those who did.

> Therefore...
> 
> I am curious to learn if any progress is being made in this area.  I
> am new to Haskell; I've gone through the tutorials, and would like to
> get my hands a bit dirty with it.  I apologize if I'm "Such A n00B."
> 
> While I've done some research, I'm sure I missed important points of
> interest.  I was wondering if anyone had a list of URLs I could check
> to bring myself "up to speed" on this particular issue.  In
> particular:
> 
> * are there proposed designs?  What are their pros and cons?
> * Is there a roadmap where this "buglette" will be addressed by a
> certain darcs version?

No, there's no roadmap for issues like this.  If we decide we need a new
on-disk format, we'll have to go through a transition period with
_darcs/format and all (which I'll guide you through), but I'm not sure this
is needed.

I think the on-disk format actually is okay, it's just that older versions
of darcs assumed that there were no spaces in the token specification, so
perhaps we need no on-disk format change, but need to add a _darcs/format
option to allow spaces in replace tokens (which would make the repository
unreadable by older versions of darcs, but they'd *know* that it's
unreadable and so you wouldn't introduce bugs or corruption thereby).

As I recall (and as I write, this is coming back) the problem was *only*
with white space.  Of course, that's very much worth fixing--particularly
for you, as you could then with your forth use:

darcs replace [^ ] 'foo"' 'bar:' forthfile

and you'd have quite a compact (and correct) description of forth tokens.
-- 
David Roundy
http://www.darcs.net


More information about the darcs-devel mailing list