Patchwork [7,of,7] revert: use p2 as parent when reverting against it

login
register
mail settings
Submitter Pierre-Yves David
Date May 19, 2014, 3:58 p.m.
Message ID <31363762399e5c43d6b6.1400515086@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4802/
State Accepted
Commit 87a972b5c0395c1123cedc20a526ee6d36437b15
Headers show

Comments

Pierre-Yves David - May 19, 2014, 3:58 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1400089085 25200
#      Wed May 14 10:38:05 2014 -0700
# Node ID 31363762399e5c43d6b679fece71dc7a0b72ce1d
# Parent  2d09f1521f9497365ae7bdae5e0700441123ec20
revert: use p2 as parent when reverting against it

revert was always using p1 as parent. This created some minor misbehavior when
reverting against p2. See test change for an example of that.

This is also a useful cleanup for coming refactoring to revert.
Durham Goode - May 19, 2014, 5:17 p.m.
On 5/19/14, 8:58 AM, "pierre-yves.david@ens-lyon.org"
<pierre-yves.david@ens-lyon.org> wrote:

># HG changeset patch

># User Pierre-Yves David <pierre-yves.david@fb.com>

># Date 1400089085 25200

>#      Wed May 14 10:38:05 2014 -0700

># Node ID 31363762399e5c43d6b679fece71dc7a0b72ce1d

># Parent  2d09f1521f9497365ae7bdae5e0700441123ec20

>revert: use p2 as parent when reverting against it

>

>revert was always using p1 as parent. This created some minor misbehavior

>when

>reverting against p2. See test change for an example of that.

>

>This is also a useful cleanup for coming refactoring to revert.


This series looks good to me.  I’d queue it, but there’s already 158
pending changes in the queue, and piling more on probably won’t help.
Matt Mackall - May 27, 2014, 10:47 p.m.
On Mon, 2014-05-19 at 08:58 -0700, pierre-yves.david@ens-lyon.org wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1400089085 25200
> #      Wed May 14 10:38:05 2014 -0700
> # Node ID 31363762399e5c43d6b679fece71dc7a0b72ce1d
> # Parent  2d09f1521f9497365ae7bdae5e0700441123ec20
> revert: use p2 as parent when reverting against it

These are queued for default, thanks.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2238,10 +2238,12 @@  def commitstatus(repo, node, branch, bhe
 def revert(ui, repo, ctx, parents, *pats, **opts):
     parent, p2 = parents
     node = ctx.node()
 
     mf = ctx.manifest()
+    if node == p2:
+        parent = p2
     if node == parent:
         pmf = mf
     else:
         pmf = None
 
diff --git a/tests/test-revert.t b/tests/test-revert.t
--- a/tests/test-revert.t
+++ b/tests/test-revert.t
@@ -361,14 +361,12 @@  Test revert of a file added by one side 
   M base
   R ignored
   R newadd
 
 (revert file added by p2() to p2() state)
-spurious message comes from revert confusion when using p2. To be fixed soon.
 
   $ hg revert -r 'p2()' 'glob:allyou?'
-  reverting allyour
   $ hg status
   M allyour
   M base
   R ignored
   R newadd