Commit 84ecb647 authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

evolvecmd: simplify code for moving bookmarks when relocating node

We had very similar code for updating bookmarks to handle the case
when the relocation resulted in no changes and for the normal
case. This restructures the code a bit so the common part is better
parent 18fa4797b5dd
......@@ -956,26 +956,25 @@ def _relocatecommit(repo, orig, commitmsg):, extra=extra)
def _finalizerelocate(repo, orig, dest, nodenew, tr, category, evolvestate):
nodesrc = orig.node()
oldbookmarks = repo.nodebookmarks(nodesrc)
bmchanges = []
if nodenew is not None:
obsolete.createmarkers(repo, [(orig, (repo[nodenew],))],
for book in oldbookmarks:
bmchanges.append((book, nodenew))
evolvestate[b'bookmarkchanges'].append((book, nodesrc))
bmdest = nodenew
if category == b'orphan':
repo.ui.status(_(b"evolution of %d:%s created no changes "
b"to commit\n") % (orig.rev(), orig))
obsolete.createmarkers(repo, [(orig, ())], operation=b'evolve')
# Behave like rebase, move bookmarks to dest
bmdest = dest.node()
nodesrc = orig.node()
oldbookmarks = repo.nodebookmarks(nodesrc)
if oldbookmarks:
bmchanges = []
for book in oldbookmarks:
evolvestate[b'bookmarkchanges'].append((book, nodesrc))
bmchanges.append((book, dest.node()))
if bmchanges:
bmchanges.append((book, bmdest))
repo._bookmarks.applychanges(repo, tr, bmchanges)
def _evolvemerge(repo, orig, dest, pctx, keepbranch):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment