tags:

views:

42

answers:

3
  • I clone a repo to c:\mycopy
  • I create new files in my working dir

How can I tell hg update to delete any new files in my working dir? I don't want it to delete files that are in the ignored file patterns.

+2  A: 

Use the purge extension. It won't be update doing it, but you can purge after updating.

Ry4an
+2  A: 

Danger, Will Robinson! Danger! Danger!

I strongly recommend you do not even try to do this. Here's a User Story:

It was a dark and stormy night. Rain and hail beats against the window, sounding like heavy weapons fire echoing through time from some long-forgotten battle fought off the shoulder of Orion. The programmer is under incredible stress, trying to complete the last critical piece of the code that will Save Humanity. Suddenly he knows he has it! He grabs a quick update and then does a commit! ... But he forgot to first do hg add whatever to add the files to his repository and his magic cleanup script instantly destroys the code, never to be reclaimed again.

Humanity is lost ... LOST!

and all because of an auto-cleanup script.

YMMV.

Peter Rowell
+1  A: 

This script will produce a list of unknown (untracked but not ignored) files and remove them. Run without the xargs part to preview which files will be deleted:

hg status -un | xargs rm
gavinb
Too bad this does work on Windows. But the -un is still god to know.
Sly