Patchwork resolve: don't abort resolve -l even when no merge is in progress

login
register
mail settings
Submitter Siddharth Agarwal
Date May 23, 2014, 8:10 p.m.
Message ID <d7e972540001ab42a774.1400875844@dev1738.prn1.facebook.com>
Download mbox | patch
Permalink /patch/4857/
State Accepted
Headers show

Comments

Siddharth Agarwal - May 23, 2014, 8:10 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1400875831 25200
#      Fri May 23 13:10:31 2014 -0700
# Node ID d7e972540001ab42a77443a2ccd6d3968d9b55b7
# Parent  9fb6f328576ac4e38f4e5071c4d669a6ceb3a76e
resolve: don't abort resolve -l even when no merge is in progress

This broke some internal automation that was quite reasonably checking for
unresolved files as a way to determine whether a merge happened cleanly. We
still abort for resolve --mark etc.
Gregory Szorc - May 23, 2014, 8:55 p.m.
On 5/23/14, 1:10 PM, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1400875831 25200
> #      Fri May 23 13:10:31 2014 -0700
> # Node ID d7e972540001ab42a77443a2ccd6d3968d9b55b7
> # Parent  9fb6f328576ac4e38f4e5071c4d669a6ceb3a76e
> resolve: don't abort resolve -l even when no merge is in progress
>
> This broke some internal automation that was quite reasonably checking for
> unresolved files as a way to determine whether a merge happened cleanly. We
> still abort for resolve --mark etc.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -4921,7 +4921,7 @@
>
>       ms = mergemod.mergestate(repo)
>
> -    if not ms.active():
> +    if not ms.active() and not show:
>           raise util.Abort(_('resolve command not applicable when not merging'))
>
>       m = scmutil.match(repo[None], pats, opts)
> diff --git a/tests/test-histedit-non-commute-abort.t b/tests/test-histedit-non-commute-abort.t
> --- a/tests/test-histedit-non-commute-abort.t
> +++ b/tests/test-histedit-non-commute-abort.t
> @@ -85,8 +85,6 @@
>
>   log after abort
>     $ hg resolve -l
> -  abort: resolve command not applicable when not merging
> -  [255]
>     $ hg log --graph
>     @  changeset:   6:bfa474341cc9
>     |  tag:         tip
> diff --git a/tests/test-resolve.t b/tests/test-resolve.t
> --- a/tests/test-resolve.t
> +++ b/tests/test-resolve.t
> @@ -42,9 +42,12 @@
>     no more unresolved files
>     $ hg commit -m 'resolved'
>
> -resolve -l should error since no merge in progress
> +resolve -l should be empty
>
>     $ hg resolve -l
> +
> +resolve -m should abort since no merge in progress
> +  $ hg resolve -m
>     abort: resolve command not applicable when not merging
>     [255]
>
> diff --git a/tests/test-shelve.t b/tests/test-shelve.t
> --- a/tests/test-shelve.t
> +++ b/tests/test-shelve.t
> @@ -262,8 +262,6 @@
>     summary:     second
>
>     $ hg resolve -l
> -  abort: resolve command not applicable when not merging
> -  [255]
>     $ hg status
>     A foo/foo
>     ? a/a.orig

As the author of the patch that added this abort behavior, I think this 
change is sane. I was mostly interested in presenting the notice after 
the final `resolve -m` anyway.
Augie Fackler - May 26, 2014, 4:11 p.m.
On Fri, May 23, 2014 at 01:10:44PM -0700, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1400875831 25200
> #      Fri May 23 13:10:31 2014 -0700
> # Node ID d7e972540001ab42a77443a2ccd6d3968d9b55b7
> # Parent  9fb6f328576ac4e38f4e5071c4d669a6ceb3a76e
> resolve: don't abort resolve -l even when no merge is in progress

sure, queued

>
> This broke some internal automation that was quite reasonably checking for
> unresolved files as a way to determine whether a merge happened cleanly. We
> still abort for resolve --mark etc.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -4921,7 +4921,7 @@
>
>      ms = mergemod.mergestate(repo)
>
> -    if not ms.active():
> +    if not ms.active() and not show:
>          raise util.Abort(_('resolve command not applicable when not merging'))
>
>      m = scmutil.match(repo[None], pats, opts)
> diff --git a/tests/test-histedit-non-commute-abort.t b/tests/test-histedit-non-commute-abort.t
> --- a/tests/test-histedit-non-commute-abort.t
> +++ b/tests/test-histedit-non-commute-abort.t
> @@ -85,8 +85,6 @@
>
>  log after abort
>    $ hg resolve -l
> -  abort: resolve command not applicable when not merging
> -  [255]
>    $ hg log --graph
>    @  changeset:   6:bfa474341cc9
>    |  tag:         tip
> diff --git a/tests/test-resolve.t b/tests/test-resolve.t
> --- a/tests/test-resolve.t
> +++ b/tests/test-resolve.t
> @@ -42,9 +42,12 @@
>    no more unresolved files
>    $ hg commit -m 'resolved'
>
> -resolve -l should error since no merge in progress
> +resolve -l should be empty
>
>    $ hg resolve -l
> +
> +resolve -m should abort since no merge in progress
> +  $ hg resolve -m
>    abort: resolve command not applicable when not merging
>    [255]
>
> diff --git a/tests/test-shelve.t b/tests/test-shelve.t
> --- a/tests/test-shelve.t
> +++ b/tests/test-shelve.t
> @@ -262,8 +262,6 @@
>    summary:     second
>
>    $ hg resolve -l
> -  abort: resolve command not applicable when not merging
> -  [255]
>    $ hg status
>    A foo/foo
>    ? a/a.orig
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4921,7 +4921,7 @@ 
 
     ms = mergemod.mergestate(repo)
 
-    if not ms.active():
+    if not ms.active() and not show:
         raise util.Abort(_('resolve command not applicable when not merging'))
 
     m = scmutil.match(repo[None], pats, opts)
diff --git a/tests/test-histedit-non-commute-abort.t b/tests/test-histedit-non-commute-abort.t
--- a/tests/test-histedit-non-commute-abort.t
+++ b/tests/test-histedit-non-commute-abort.t
@@ -85,8 +85,6 @@ 
 
 log after abort
   $ hg resolve -l
-  abort: resolve command not applicable when not merging
-  [255]
   $ hg log --graph
   @  changeset:   6:bfa474341cc9
   |  tag:         tip
diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -42,9 +42,12 @@ 
   no more unresolved files
   $ hg commit -m 'resolved'
 
-resolve -l should error since no merge in progress
+resolve -l should be empty
 
   $ hg resolve -l
+
+resolve -m should abort since no merge in progress
+  $ hg resolve -m
   abort: resolve command not applicable when not merging
   [255]
 
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -262,8 +262,6 @@ 
   summary:     second
   
   $ hg resolve -l
-  abort: resolve command not applicable when not merging
-  [255]
   $ hg status
   A foo/foo
   ? a/a.orig