[darcs-users] bug or inconsistency in darcs replace

David Roundy droundy at abridgegame.org
Sat Mar 27 12:10:30 UTC 2004


On Fri, Mar 26, 2004 at 08:08:51PM +0100, Tommy Pettersson wrote:
> It seems 'darcs replace' behaves strangely.  It can replace
> unrecorded previous 'darcs replace':s, but not unrecorded
> manual changes.
> 
> As I now gave it a thought I think I understand why.  So here
> is how I first thought:
...
> Ok, so maybe I'm slow in mind, or maybe the help text for
> replace needs to hint the user a bit.

Yeah, that wasn't very well documented.  I've added a couple of paragraphs
on the subject to the "replace" section of the manual.  It'll be a bit
before it appears in the main repo (since I'm running the test suite right
now, and will run it again before the change gets to the server), but when
it gets there, if you could take a look and see if it's clear, that would
be great.

> And in my case a 'darcs replace --force ...' would have
> been useful.

I've thought about something like that.  I could do it by making darcs
automatically create "hunk" patches replacing the new token with the old
token before the replace, and queue those patches prior to the replace.
The problem is that this could be very confusing.  The queued changes
(which are stored in _darcs/patches/pending) would look like

{
hunk ./foo.c 50
-I want to replace the word oldtoken with newtoken.
+I want to replace the word oldtoken with oldtoken.
replace [a-zA-Z] oldtoken newtoken ./foo.c
}

This is nice in that it groups everything together.  However, these are now
two separate (primitive) changes, so when you run darcs revert
interactively, you'll be prompted with each separately, meaning you could
end up reverting just the replace, without the hunk patch.  This isn't a
fundamental problem, but could certainly be confusing to a user who thought
he was replacing oldtoken with newtoken, but somehow ends up replacing
newtoken with oldtoken.

Having heard the limitations (at least with how I would actually implement
it), do you still think a --force option would be nice? It wouldn't be very
hard to implement... the main question is whether it would end up leading
to confusion.
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list