backout: reverse changeset belongs on current branch
Backing out a changeset that is before a named branch branchpoint was
making the reverse changeset the tip of the old branch, which is wrong
and very confusing. So instead, we put it on the current named branch.
--- a/mercurial/commands.py Sat Mar 29 12:39:47 2008 -0500
+++ b/mercurial/commands.py Sat Mar 29 12:39:47 2008 -0500
@@ -227,7 +227,10 @@
raise util.Abort(_('cannot use --parent on non-merge changeset'))
parent = p1
+ # the backout should appear on the same branch
+ branch = repo.dirstate.branch()
hg.clean(repo, node, show_stats=False)
+ repo.dirstate.setbranch(branch)
revert_opts = opts.copy()
revert_opts['date'] = None
revert_opts['all'] = True
--- a/tests/test-backout.out Sat Mar 29 12:39:47 2008 -0500
+++ b/tests/test-backout.out Sat Mar 29 12:39:47 2008 -0500
@@ -74,7 +74,7 @@
adding file2
removing file1
created new head
-changeset 3:f1c642b1d8e5 backs out changeset 1:bf1602f437f3
+changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3
the backout changeset is a new head - do not forget to merge
(use "backout --merge" if you want to auto-merge)
% on branch2 with branch1 not merged, so file1 should still exist:
@@ -85,10 +85,11 @@
% on branch2 with branch1 merged, so file1 should be gone:
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
(branch merge, don't forget to commit)
-21d4dc6f9a41 (branch2) tip
+22149cdde76d (branch2) tip
C default
C file2
% on branch1, so no file1 and file2:
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-f1c642b1d8e5 (branch1)
+1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+bf1602f437f3 (branch1)
C default
+C file1