Using: Mercurial Distributed SCM (version 1.8.1) I believe I've found a bug in rebase. Summary: In a repository which contains a set of renames that cancel each other out ( rev 1: rename file1 to file2, rev2: unrelated, rev3: rename file2 back to file1), if you base a changeset off of a parent somewhere inbetween the renames, then rebase that changeset to somewhere beyond the second rename, the rebased changeset will delete file1. Script to reproduce issue: hg init rebase-test cd rebase-test echo testing > file1.txt hg add file1.txt hg ci -m "Adding file1" hg rename file1.txt file2.txt hg ci -m "Rename file1 to file2" echo Unrelated change > unrelated.txt hg add unrelated.txt hg ci -m "Unrelated change" hg rename file2.txt file1.txt hg ci -m "Rename file2 back to file1" hg update -r -2 echo Another unrelated change >> unrelated.txt hg ci -m "Another unrelated change" hg rebase -s . -d -2 hg log -v -r . Output --- note the last changeset removes file1.txt even though it should only affect unrelated.txt: C:\>hg init rebase-test C:\>cd rebase-test C:\rebase-test>echo testing 1>file1.txt C:\rebase-test>hg add file1.txt C:\rebase-test>hg ci -m "Adding file1" C:\rebase-test>hg rename file1.txt file2.txt C:\rebase-test>hg ci -m "Rename file1 to file2" C:\rebase-test>echo Unrelated change 1>unrelated.txt C:\rebase-test>hg add unrelated.txt C:\rebase-test>hg ci -m "Unrelated change" C:\rebase-test>hg rename file2.txt file1.txt C:\rebase-test>hg ci -m "Rename file2 back to file1" C:\rebase-test>hg update -r -2 1 files updated, 0 files merged, 1 files removed, 0 files unresolved C:\rebase-test>echo Another unrelated change 1>>unrelated.txt C:\rebase-test>hg ci -m "Another unrelated change" created new head C:\rebase-test>hg rebase -s . -d -2 saved backup bundle to C:\rebase-test\.hg\strip-backup\8d44750eacae-backup.hg C:\rebase-test>hg log -v -r . changeset: 4:88546ee25e97 tag: tip user: me date: Thu Mar 24 14:12:59 2011 -0500 files: file1.txt unrelated.txt description: Another unrelated change
Fixed by http://selenic.com/repo/hg/rev/46c3043253fb Stefano Tortarolo <stefano.tortarolo@gmail.com> rebase: don't mark file as removed if missing in parent's manifest (issue2725) (please test the fix)
Tested fix by Stefano in both contrived example and original repository. Issue appears fixed. Thanks Stefano!
Fixed by http://selenic.com/repo/hg/rev/14c0988c314d Stefano Tortarolo <stefano.tortarolo@gmail.com> rebase: don't mark file as removed if missing in parent's manifest (issue2725) (please test the fix)
Tested with version 1.8.2+25-82845434e974, issue appears fixed. Thanks!
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:18 EDT --- This bug was previously known as _bug_ 2725 at http://mercurial.selenic.com/bts/issue2725