tags:

views:

34

answers:

3

When I started my Mercurial project I forgot to exclude everything under my target/classes directory, such as:

target/classes/com/mypackage/MyClass.class

Now these binary files are causing conflicts when I do a hg update.

Is there a single command that would allow me to delete all of these files from the entire project history?

Or, if not, is there a command that would allow me to remove them one file at a time?

+2  A: 

If you delete the files in question then do hg addremove then the files will be removed from the repository. However they will still be in the history though, but is that really a problem?

Gabor Kulcsar
+2  A: 

Use hg remove --after target/classes/com/mypackage/*.class. (--after will avoid deleting the on-disk files).

tonfa
+3  A: 

If you just want to remove files from last revision, remove files from disk and use hg addremove or hg remove --after target/classes/com/mypackage/*.class to inform Mercurial about your deletion.

If you want to permanently remove all class files from you entire history use hg convert and --filemap option to rewrite your repository and get rid of files from all revisions. However this solution alters revision ids. In multi user environment it may cause some problems because it creates a new repository effectively.

Michal Sznajder