changeset 23535:72c23fa4f52f

commit: abort if --addremove is specified, but fails This will be required when subrepo support is added, in order to ensure consistent commits when a subrepo flavor doesn't support addremove.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 26 Nov 2014 15:16:22 -0500
parents 83bbedc16b3f
children fcbc66b5da6a
files mercurial/cmdutil.py tests/test-addremove.t
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Nov 26 14:27:36 2014 -0500
+++ b/mercurial/cmdutil.py	Wed Nov 26 15:16:22 2014 -0500
@@ -2202,7 +2202,9 @@
     # extract addremove carefully -- this function can be called from a command
     # that doesn't support addremove
     if opts.get('addremove'):
-        scmutil.addremove(repo, matcher, opts)
+        if scmutil.addremove(repo, matcher, opts) != 0:
+            raise util.Abort(
+                _("failed to mark all new/missing files as added/removed"))
 
     return commitfunc(ui, repo, message, matcher, opts)
 
--- a/tests/test-addremove.t	Wed Nov 26 14:27:36 2014 -0500
+++ b/tests/test-addremove.t	Wed Nov 26 15:16:22 2014 -0500
@@ -79,4 +79,19 @@
   $ hg addremove -s 50
   adding b
   adding c
+
+  $ rm c
+#if windows
+  $ hg ci -A -m "c" nonexistant
+  nonexistant: The system cannot find the file specified
+  abort: failed to mark all new/missing files as added/removed
+  [255]
+#else
+  $ hg ci -A -m "c" nonexistant
+  nonexistant: No such file or directory
+  abort: failed to mark all new/missing files as added/removed
+  [255]
+#endif
+  $ hg st
+  ! c
   $ cd ..