[darcs-users] "darcs replace" out of place?

Michael G Schwern schwern at pobox.com
Mon Apr 4 01:22:24 UTC 2005


On Sun, Apr 03, 2005 at 02:30:45PM +0200, Tommy Pettersson wrote:
> On Sun, Apr 03, 2005 at 04:09:21AM -0700, Michael G Schwern wrote:
> > Is there an example of its use in the changes to darcs-unstable?  I'd like
> > to look at one.  I see several changes which describe themselves as
> > replacing things...
> 
> $ cd darcs-unstable/_darcs/patches/
> $ ls | xargs zgrep -l '^replace'
> 
> 20030506070245-e9342-9e32aadd86cfb9ecda15d17928667c1841fa9529.gz
> 20030507065650-e9342-83e14e57ddff09379215156155172b5bce970715.gz
*snip*

Thanks, that's what I was looking for.  Seeing if its getting used and
how.  The changes I found in the log which said they were doing a "replace"
were doing it without "darcs replace".

My worry is that this sort of simple search and replace might not be
generally applicable, even in languages with simple grammar like Haskell
and C, either because of simple issues of comments and strings...

	// A comment with foo in it
	foo("And some more foo")

Every "foo" there is a token but only one is the function call I want
to replace.  The other foo's might be related but who knows?

Or because of languages which have more complicated grammars where one
cannot describe a token using a simple character set.  Perl and Ruby, for
example, where variables have sigils attached.  $foo and $bar.

The idea of storing refactoring operations as refactoring operations rather
than just textual changes is an interesting one.  But in order to truly
be useful to record these changes, rather than just when they happen to be
simple enough for "darcs replace", you have to involve a whole refactoring
browser.





More information about the darcs-users mailing list