Patchwork [5,of,5] resolve: run happily after conflict-free merge

login
register
mail settings
Submitter Martin von Zweigbergk
Date Oct. 10, 2014, 4:14 p.m.
Message ID <6bc7728101ed55652879.1412957665@handduk2.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6186/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Oct. 10, 2014, 4:14 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@gmail.com>
# Date 1412832604 25200
#      Wed Oct 08 22:30:04 2014 -0700
# Node ID 6bc7728101ed556528790f8949091724e3047a0a
# Parent  806a523b8b91284e01fbc41f767f87a8fdeac342
resolve: run happily after conflict-free merge
Augie Fackler - Oct. 17, 2014, 2:48 p.m.
On Fri, Oct 10, 2014 at 09:14:25AM -0700, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@gmail.com>
> # Date 1412832604 25200
> #      Wed Oct 08 22:30:04 2014 -0700
> # Node ID 6bc7728101ed556528790f8949091724e3047a0a
> # Parent  806a523b8b91284e01fbc41f767f87a8fdeac342
> resolve: run happily after conflict-free merge

All looks good to me. Queued.

>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -5291,7 +5291,7 @@
>      try:
>          ms = mergemod.mergestate(repo)
>
> -        if not ms.active() and not show:
> +        if not (ms.active() or repo.dirstate.p2() != nullid) and not show:
>              raise util.Abort(
>                  _('resolve command not applicable when not merging'))
>
> diff --git a/tests/test-resolve.t b/tests/test-resolve.t
> --- a/tests/test-resolve.t
> +++ b/tests/test-resolve.t
> @@ -88,16 +88,14 @@
>    2 files updated, 0 files merged, 0 files removed, 0 files unresolved
>    (branch merge, don't forget to commit)
>
> -BROKEN: resolve --all should do nothing in merge without conflicts
> +resolve --all should do nothing in merge without conflicts
>    $ hg resolve --all
> -  abort: resolve command not applicable when not merging
> -  [255]
> +  (no more unresolved files)
>
> -BROKEN: resolve -m should do nothing in merge without conflicts
> +resolve -m should do nothing in merge without conflicts
>
>    $ hg resolve -m
> -  abort: resolve command not applicable when not merging
> -  [255]
> +  (no more unresolved files)
>
>  get back to conflicting state
>
> _______________________________________________
> 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
@@ -5291,7 +5291,7 @@ 
     try:
         ms = mergemod.mergestate(repo)
 
-        if not ms.active() and not show:
+        if not (ms.active() or repo.dirstate.p2() != nullid) and not show:
             raise util.Abort(
                 _('resolve command not applicable when not merging'))
 
diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -88,16 +88,14 @@ 
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
 
-BROKEN: resolve --all should do nothing in merge without conflicts
+resolve --all should do nothing in merge without conflicts
   $ hg resolve --all
-  abort: resolve command not applicable when not merging
-  [255]
+  (no more unresolved files)
 
-BROKEN: resolve -m should do nothing in merge without conflicts
+resolve -m should do nothing in merge without conflicts
 
   $ hg resolve -m
-  abort: resolve command not applicable when not merging
-  [255]
+  (no more unresolved files)
 
 get back to conflicting state