# HG changeset patch # User Pierre-Yves David # Date 1407369957 25200 # Node ID 9d538ebf3985433076462ebfa6cd5f17e3051425 # Parent 7c8e3941241fbda29d633b7712e9d27ac7342b9b evolve: add a tr arguement to retractboundary Mercurial core is adding a transaction argument to its phase movement function. We do the same. If Mercurial appears to be an old version (without the extra args) we call it the old way. diff --git a/hgext/evolve.py b/hgext/evolve.py --- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -96,8 +96,12 @@ ##################################################################### -def retractboundary(repo, targetphase, nodes): - return phases.retractboundary(repo, targetphase, nodes) +def retractboundary(repo, tr, targetphase, nodes): + """Older mercurial version does not move phase within a transaction""" + try: + return phases.retractboundary(repo, tr, targetphase, nodes) + except TypeError: + return phases.retractboundary(repo, targetphase, nodes) ##################################################################### @@ -870,7 +874,7 @@ raise oldbookmarks = repo.nodebookmarks(nodesrc) if nodenew is not None: - retractboundary(repo, destphase, [nodenew]) + retractboundary(repo, tr, destphase, [nodenew]) createmarkers(repo, [(repo[nodesrc], (repo[nodenew],))]) for book in oldbookmarks: repo._bookmarks[book] = nodenew @@ -1463,7 +1467,7 @@ createmarkers(repo, [(tmpctx, ())]) newid = prec.node() else: - retractboundary(repo, bumped.phase(), [newid]) + retractboundary(repo, tr, bumped.phase(), [newid]) createmarkers(repo, [(tmpctx, (repo[newid],))], flag=obsolete.bumpedfix) bmupdate(newid) @@ -1568,7 +1572,7 @@ else: new = repo['.'] createmarkers(repo, [(other, (new,))]) - retractboundary(repo, other.phase(), [new.node()]) + retractboundary(repo, tr, other.phase(), [new.node()]) tr.close() finally: tr.release() @@ -1969,7 +1973,7 @@ hint=_("use --all to uncommit all files")) # Move local changes on filtered changeset createmarkers(repo, [(old, (repo[newid],))]) - retractboundary(repo, oldphase, [newid]) + retractboundary(repo, tr, oldphase, [newid]) repo.dirstate.setparents(newid, node.nullid) _uncommitdirstate(repo, old, match) updatebookmarks(newid) @@ -2055,7 +2059,7 @@ newmapping[ctx.node()] = new if not duplicate: createmarkers(repo, [(ctx, (repo[new],))]) - retractboundary(repo, ctx.phase(), [new]) + retractboundary(repo, tr, ctx.phase(), [new]) if ctx in repo[None].parents(): repo.dirstate.setparents(new, node.nullid) tr.close() @@ -2158,7 +2162,7 @@ newid, unusedvariable = rewrite(repo, root, allctx, head, [root.p1().node(), root.p2().node()], commitopts=commitopts) - retractboundary(repo, targetphase, [newid]) + retractboundary(repo, tr, targetphase, [newid]) createmarkers(repo, [(ctx, (repo[newid],)) for ctx in allctx]) tr.close()