Patchwork [Bug,5052] New: revert -r on an uncommited merge does not fully revert to the specified revision

login
register
mail settings
Submitter mercurial-bugs@selenic.com
Date Jan. 19, 2016, 8:55 p.m.
Message ID <bug-5052-285@https.bz.mercurial-scm.org/>
Download mbox | patch
Permalink /patch/12836/
State Accepted
Headers show

Comments

mercurial-bugs@selenic.com - Jan. 19, 2016, 8:55 p.m.
https://bz.mercurial-scm.org/show_bug.cgi?id=5052

            Bug ID: 5052
           Summary: revert -r on an uncommited merge does not fully revert
                    to the specified revision
           Product: Mercurial
           Version: 3.6.3
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla@selenic.com
          Reporter: michael.forbes+hg@gmail.com
                CC: mercurial-devel@selenic.com

Demonstration of a case when revert -r on an uncommited merge does not fully
revert to the specified revision.

The following commands produce a repository that demonstrates this bug:

hg init
echo "0" > A
hg add A
hg com -m "0"
hg tag -l t0
hg up 00000
hg branch "other"
hg com -m "Added other branch"
hg up default
echo "1" >> A
hg com -m "1"
hg tag -l t1
hg up other
hg merge t1 --tool :other

At this point, trying to revert to t0 does something strange.  The file A,
which is in revision t0, is removed.

hg revert --all -r t0   # Removes file
hg diff -r t0           # File gone!

Reverting once more gets things back to normal

hg revert --all -r t0   # Adds file back
hg diff -r t0           # Now we are okay

Here is the output:

bash$ hg init
bash$ echo "0" > A
bash$ hg add A
bash$ hg com -m "0"
bash$ hg tag -l t0
bash$ hg up 00000
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
bash$ hg branch "other"
marked working directory as branch other
(branches are permanent and global, did you want a bookmark?)
bash$ hg com -m "Added other branch"
bash$ hg up default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
bash$ echo "1" >> A
bash$ hg com -m "1"
bash$ hg tag -l t1
bash$ hg up other
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
bash$ hg merge t1 --tool :other
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
bash$ hg revert --all -r t0   # Removes file
removing A
bash$ hg diff -r t0           # File gone!
bash$ hg revert --all -r t0   # Adds file back
undeleting A
bash$ hg diff -r t0           # Now we are okay

Tried with 3.6.3 and 3.6.2+0-44f717c87903.

Patch

diff --git a/A b/A
deleted file mode 100644
--- a/A
+++ /dev/null
@@ -1,1 +0,0 @@ 
-0