changeset 21579:87a972b5c039

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 14 May 2014 10:38:05 -0700
parents 7cfe51661e98
children 32601b0b74c0
files mercurial/cmdutil.py tests/test-revert.t
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed May 14 10:37:25 2014 -0700
+++ b/mercurial/cmdutil.py	Wed May 14 10:38:05 2014 -0700
@@ -2250,6 +2250,8 @@
     node = ctx.node()
 
     mf = ctx.manifest()
+    if node == p2:
+        parent = p2
     if node == parent:
         pmf = mf
     else:
--- a/tests/test-revert.t	Wed May 14 10:37:25 2014 -0700
+++ b/tests/test-revert.t	Wed May 14 10:38:05 2014 -0700
@@ -363,10 +363,8 @@
   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