Fix rm -A with no patterns, which I just broke.
authorBrendan Cully <brendan@kublai.com>
Mon, 30 Apr 2007 09:13:27 -0700
changeset 4393 cf5f35ec4720
parent 4392 9770d260a405
child 4394 a6436e9333db
Fix rm -A with no patterns, which I just broke.
mercurial/commands.py
tests/test-remove
tests/test-remove.out
--- a/mercurial/commands.py	Mon Apr 30 08:51:59 2007 -0700
+++ b/mercurial/commands.py	Mon Apr 30 09:13:27 2007 -0700
@@ -2083,7 +2083,8 @@
     entire project history.  If the files still exist in the working
     directory, they will be deleted from it.  If invoked with --after,
     files are marked as removed, but not actually unlinked unless --force
-    is also given.
+    is also given. Without an explicit pattern, --after will only mark
+    files as removed if they are no longer in the working directory.
 
     This command schedules the files to be removed at the next commit.
     To undo a remove before that, see hg revert.
@@ -2110,6 +2111,8 @@
             reason = _('has been marked for add (use -f to force removal)')
         elif abs in unknown:
             reason = _('is not managed')
+        elif opts['after'] and not pats and abs not in deleted:
+            continue
         elif abs in removed:
             continue
         if reason:
--- a/tests/test-remove	Mon Apr 30 08:51:59 2007 -0700
+++ b/tests/test-remove	Mon Apr 30 09:13:27 2007 -0700
@@ -29,7 +29,14 @@
 hg rm b
 hg rm -f b
 hg rm -A c
+hg st
 cat c
+hg revert c
+hg rm -A
+hg st
+rm c
+hg rm -A
+hg st
 
 cd ..
 hg clone a b
--- a/tests/test-remove.out	Mon Apr 30 08:51:59 2007 -0700
+++ b/tests/test-remove.out	Mon Apr 30 09:13:27 2007 -0700
@@ -54,5 +54,11 @@
 adding b
 adding c
 not removing b: file is modified (use -f to force removal)
+R b
+R c
 c
+R b
+removing c
+R b
+R c
 3 files updated, 0 files merged, 0 files removed, 0 files unresolved