Patchwork [3,of,8,V3] commit: abort if --addremove is specified, but fails

login
register
mail settings
Submitter Matt Harbison
Date Dec. 12, 2014, 3:35 a.m.
Message ID <da5bde55b5296f0cce6d.1418355315@Envy>
Download mbox | patch
Permalink /patch/7057/
State Accepted
Commit 72c23fa4f52f04595f3958f7401b7ed290ad0b08
Headers show

Comments

Matt Harbison - Dec. 12, 2014, 3:35 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1417032982 18000
#      Wed Nov 26 15:16:22 2014 -0500
# Node ID da5bde55b5296f0cce6dd7582c0c5d1edb323ec8
# Parent  c9c90f5a0d75593301d725a0784fca57f429e606
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.
Martin von Zweigbergk - Dec. 12, 2014, 5:59 p.m.
On Thu Dec 11 2014 at 7:36:06 PM Matt Harbison <mharbison72@gmail.com>
wrote:

> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1417032982 18000
> #      Wed Nov 26 15:16:22 2014 -0500
> # Node ID da5bde55b5296f0cce6dd7582c0c5d1edb323ec8
> # Parent  c9c90f5a0d75593301d725a0784fca57f429e606
> commit: abort if --addremove is specified, but fails
>

I think this should be tagged with "(BC)" since it seems to break backwards
compatibility.
Matt Mackall - Dec. 12, 2014, 9:01 p.m.
On Fri, 2014-12-12 at 17:59 +0000, Martin von Zweigbergk wrote:
> On Thu Dec 11 2014 at 7:36:06 PM Matt Harbison <mharbison72@gmail.com>
> wrote:
> 
> > # HG changeset patch
> > # User Matt Harbison <matt_harbison@yahoo.com>
> > # Date 1417032982 18000
> > #      Wed Nov 26 15:16:22 2014 -0500
> > # Node ID da5bde55b5296f0cce6dd7582c0c5d1edb323ec8
> > # Parent  c9c90f5a0d75593301d725a0784fca57f429e606
> > commit: abort if --addremove is specified, but fails
> >
> 
> I think this should be tagged with "(BC)" since it seems to break backwards
> compatibility.

Nah, it's just a bug fix.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -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)
 
diff --git a/tests/test-addremove.t b/tests/test-addremove.t
--- a/tests/test-addremove.t
+++ b/tests/test-addremove.t
@@ -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 ..