[darcs-users] Eclipse integration, refactoring, and combinato rial explosion?

David Roundy droundy at jdj5.mit.edu
Fri Dec 12 15:45:24 UTC 2003


On Fri, Dec 12, 2003 at 04:05:35PM +0100, Marnix Klooster wrote:
> > > Especially the latter point seems to relate strongly to the
> > > refactoring feature of IDEs like Eclipse (http://www.eclipse.org) and
> > > IntelliJ IDEA (http://www.intellij.com/idea/).  Because in a
> > > refactoring, you express your intention: "Rename class
> > > com.mklooster.vehicles.Automobile to com.mklooster.interfaces.ICar
> > > throughout the entire tree".  Such a new patch type would fit ideally
> > > within the darcs philosophy.
> > 
> > This sound very similar to the existing replace patch type...
> 
> As Kevin already explained, it is not so simple.  To do the above
> refactoring, you have to:
>  - change the uses of both com.mklooster.vehicles.Automobile and
>    Automobile, in the latter case not all uses (e.g., not
>    those referring to carwash.util.Automobile);
>  - rename the file Automobile.java to ICar.java, and move it
>    to a different directory;
>  - change/add related import statements.
> So this really is language-dependent, and not simple search-and-replace.

Yes, but it can at least be approximated by a set of existing darcs
patches.

darcs mv Automobile.java ICar.java
darcs replace com.mklooster.vehicles.Automobile \
              com.mklooster.interfaces.ICar *.java
darcs replace Automobile ICar [files that don't use carwash.util]
[fix by hand any files using both carwash.util and com.mklooster.vehicles]

and replaces to fix the import statements (of which I don't know the
syntax).

And ordinary hunk patches to clean up any remaining mess.

It's not perfect, but with care should make most merging afterwards a lot
easier than if you used just plain hunk patches, and the above could all be
done automatically by a refactoring tool.  Before adding extra complexity
to darcs to analyze, for example, whether Automobile is referring to
carwash.util, etc, we'd either have to be sure both that the added code is
clean and easy to maintain, *and* that it provides a significant gain over
simply using existing patch types to approximate the refactoring process.
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list