comparison hgext/rebase.py @ 9815:49efeed49c94

rebase: make sure the newancestor is used during the whole update (issue1561) Before this change, newancestor was used only once as a replacement for ancestor.ancestor, but merge.update calls ancestor.ancestor several times, so it ends up with the "wrong" ancestor (the real ancestor, but we want the parent of the rebased changeset for all but the first rebased changeset). Added a new test case for this: test-rebase-newancestor. Also, in one scenario in test-rebase-collapse, there was a spurious conflict caused by the same issue, so that test case was fixed by removing the now unneeded conflict resolution and the output was adapted accordingly.
author Christian Boos <cboos@bct-technology.com>
date Mon, 09 Nov 2009 20:15:49 +0100
parents f3404b7f37ca
children 25e572394f5c
comparison
equal deleted inserted replaced
9814:5070e4d57276 9815:49efeed49c94
25 def rebasemerge(repo, rev, first=False): 25 def rebasemerge(repo, rev, first=False):
26 'return the correct ancestor' 26 'return the correct ancestor'
27 oldancestor = ancestor.ancestor 27 oldancestor = ancestor.ancestor
28 28
29 def newancestor(a, b, pfunc): 29 def newancestor(a, b, pfunc):
30 ancestor.ancestor = oldancestor
31 if b == rev: 30 if b == rev:
32 return repo[rev].parents()[0].rev() 31 return repo[rev].parents()[0].rev()
33 return ancestor.ancestor(a, b, pfunc) 32 return oldancestor(a, b, pfunc)
34 33
35 if not first: 34 if not first:
36 ancestor.ancestor = newancestor 35 ancestor.ancestor = newancestor
37 else: 36 else:
38 repo.ui.debug("first revision, do not change ancestor\n") 37 repo.ui.debug("first revision, do not change ancestor\n")
39 stats = merge.update(repo, rev, True, True, False) 38 try:
40 return stats 39 stats = merge.update(repo, rev, True, True, False)
40 return stats
41 finally:
42 ancestor.ancestor = oldancestor
41 43
42 def rebase(ui, repo, **opts): 44 def rebase(ui, repo, **opts):
43 """move changeset (and descendants) to a different branch 45 """move changeset (and descendants) to a different branch
44 46
45 Rebase uses repeated merging to graft changesets from one part of 47 Rebase uses repeated merging to graft changesets from one part of