[PATCH 4 of 8] commit: abort if --addremove is specified, but fails
Matt Harbison
matt_harbison at yahoo.com
Wed Nov 26 19:12:17 CST 2014
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1417032982 18000
# Wed Nov 26 15:16:22 2014 -0500
# Node ID 7bb194b9451bfc35667ae64d675af1178ec274ef
# Parent 0cdf9472ba6aab34b5e95babc8283e3388dbb668
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.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2200,7 +2200,8 @@
# 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(_("addremove failed"))
return commitfunc(ui, repo, message, matcher, opts)
diff --git a/tests/test-addremove.t b/tests/test-addremove.t
--- a/tests/test-addremove.t
+++ b/tests/test-addremove.t
@@ -64,4 +64,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: addremove failed
+ [255]
+#else
+ $ hg ci -A -m "c" nonexistant
+ nonexistant: No such file or directory
+ abort: addremove failed
+ [255]
+#endif
+ $ hg st
+ ! c
$ cd ..
More information about the Mercurial-devel
mailing list