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

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Tue Jan 19 20:55:57 UTC 2016


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 at selenic.com
          Reporter: michael.forbes+hg at gmail.com
                CC: mercurial-devel at 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!
diff --git a/A b/A
deleted file mode 100644
--- a/A
+++ /dev/null
@@ -1,1 +0,0 @@
-0
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list