merge with stable
authorMartin Geisler <mg@lazybytes.net>
Wed, 01 Sep 2010 12:28:34 +0200
changeset 12130 48735ce02345
parent 12127 36a65283c3af (current diff)
parent 12129 07ac2a560fce (diff)
child 12131 c061f9882ff7
merge with stable
mercurial/commands.py
tests/test-remove.t
--- a/mercurial/commands.py	Tue Aug 31 16:36:31 2010 +0200
+++ b/mercurial/commands.py	Wed Sep 01 12:28:34 2010 +0200
@@ -2798,7 +2798,7 @@
         try:
             revs = [other.lookup(rev) for rev in revs]
         except error.CapabilityError:
-            err = _("Other repository doesn't support revision lookup, "
+            err = _("other repository doesn't support revision lookup, "
                     "so a rev cannot be specified.")
             raise util.Abort(err)
 
@@ -2913,21 +2913,24 @@
             ui.warn(_('not removing %s: file is untracked\n') % m.rel(f))
             ret = 1
 
-    def warn(files, reason):
-        for f in files:
-            ui.warn(_('not removing %s: file %s (use -f to force removal)\n')
-                    % (m.rel(f), reason))
-            ret = 1
-
     if force:
         remove, forget = modified + deleted + clean, added
     elif after:
         remove, forget = deleted, []
-        warn(modified + added + clean, _('still exists'))
+        for f in modified + added + clean:
+            ui.warn(_('not removing %s: file still exists (use -f'
+                      ' to force removal)\n') % m.rel(f))
+            ret = 1
     else:
         remove, forget = deleted + clean, []
-        warn(modified, _('is modified'))
-        warn(added, _('has been marked for add'))
+        for f in modified:
+            ui.warn(_('not removing %s: file is modified (use -f'
+                      ' to force removal)\n') % m.rel(f))
+            ret = 1
+        for f in added:
+            ui.warn(_('not removing %s: file has been marked for add (use -f'
+                      ' to force removal)\n') % m.rel(f))
+            ret = 1
 
     for f in sorted(remove + forget):
         if ui.verbose or not m.exact(f):
--- a/tests/test-remove.t	Tue Aug 31 16:36:31 2010 +0200
+++ b/tests/test-remove.t	Wed Sep 01 12:28:34 2010 +0200
@@ -1,5 +1,6 @@
   $ remove() {
   >     hg rm $@
+  >     echo "exit code: $?"
   >     hg st
   >     # do not use ls -R, which recurses in .hg subdirs on Mac OS X 10.5
   >     find . -name .hg -prune -o -type f -print | sort
@@ -14,6 +15,7 @@
 
   $ remove foo
   not removing foo: file is untracked
+  exit code: 1
   ? foo
   ./foo
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -28,6 +30,7 @@
   $ hg add bar
   $ remove bar
   not removing bar: file has been marked for add (use -f to force removal)
+  exit code: 1
   A bar
   ./bar
   ./foo
@@ -36,6 +39,7 @@
 01 state clean, options none
 
   $ remove foo
+  exit code: 0
   R foo
   ? bar
   ./bar
@@ -46,6 +50,7 @@
   $ echo b >> foo
   $ remove foo
   not removing foo: file is modified (use -f to force removal)
+  exit code: 1
   M foo
   ? bar
   ./bar
@@ -56,6 +61,7 @@
 
   $ rm foo
   $ remove foo
+  exit code: 0
   R foo
   ? bar
   ./bar
@@ -66,6 +72,7 @@
   $ echo b > bar
   $ hg add bar
   $ remove -f bar
+  exit code: 0
   ? bar
   ./bar
   ./foo
@@ -75,6 +82,7 @@
 11 state clean, options -f
 
   $ remove -f foo
+  exit code: 0
   R foo
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
@@ -82,6 +90,7 @@
 
   $ echo b >> foo
   $ remove -f foo
+  exit code: 0
   R foo
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
@@ -89,6 +98,7 @@
 
   $ rm foo
   $ remove -f foo
+  exit code: 0
   R foo
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
@@ -98,6 +108,7 @@
   $ hg add bar
   $ remove -A bar
   not removing bar: file still exists (use -f to force removal)
+  exit code: 1
   A bar
   ./bar
   ./foo
@@ -107,6 +118,7 @@
 
   $ remove -A foo
   not removing foo: file still exists (use -f to force removal)
+  exit code: 1
   ? bar
   ./bar
   ./foo
@@ -117,6 +129,7 @@
   $ echo b >> foo
   $ remove -A foo
   not removing foo: file still exists (use -f to force removal)
+  exit code: 1
   M foo
   ? bar
   ./bar
@@ -127,6 +140,7 @@
 
   $ rm foo
   $ remove -A foo
+  exit code: 0
   R foo
   ? bar
   ./bar
@@ -137,6 +151,7 @@
   $ echo b > bar
   $ hg add bar
   $ remove -Af bar
+  exit code: 0
   ? bar
   ./bar
   ./foo
@@ -146,6 +161,7 @@
 31 state clean, options -Af
 
   $ remove -Af foo
+  exit code: 0
   R foo
   ./foo
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -154,6 +170,7 @@
 
   $ echo b >> foo
   $ remove -Af foo
+  exit code: 0
   R foo
   ./foo
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -162,6 +179,7 @@
 
   $ rm foo
   $ remove -Af foo
+  exit code: 0
   R foo
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
@@ -180,6 +198,7 @@
   $ remove test
   removing test/bar
   removing test/foo
+  exit code: 0
   R test/bar
   R test/foo
   ./foo
@@ -191,6 +210,7 @@
   $ remove -f test
   removing test/bar
   removing test/foo
+  exit code: 0
   R test/bar
   R test/foo
   ./foo
@@ -202,6 +222,7 @@
   $ remove -A test
   not removing test/foo: file still exists (use -f to force removal)
   removing test/bar
+  exit code: 1
   R test/bar
   ./foo
   ./test/foo
@@ -213,6 +234,7 @@
   $ remove -Af test
   removing test/bar
   removing test/foo
+  exit code: 0
   R test/bar
   R test/foo
   ./foo