@@ -930,11 +930,11 @@ class queue(object):
oldqbase = repo[qfinished[0]]
tphase = repo.ui.config('phases', 'new-commit', phases.draft)
if oldqbase.phase() > tphase and oldqbase.p1().phase() <= tphase:
tr = repo.transaction('qfinish')
try:
- phases.advanceboundary(repo, tphase, qfinished)
+ phases.advanceboundary(repo, tr, tphase, qfinished)
tr.close()
finally:
tr.release()
def delete(self, repo, patches, opts):
@@ -698,16 +698,16 @@ def addchangegroup(repo, source, srctype
# exists locally as secret
#
# We should not use added here but the list of all change in
# the bundle
if publishing:
- phases.advanceboundary(repo, phases.public, srccontent)
+ phases.advanceboundary(repo, tr, phases.public, srccontent)
else:
# Those changesets have been pushed from the outside, their
# phases are going to be pushed alongside. Therefor
# `targetphase` is ignored.
- phases.advanceboundary(repo, phases.draft, srccontent)
+ phases.advanceboundary(repo, tr, phases.draft, srccontent)
phases.retractboundary(repo, phases.draft, added)
elif srctype != 'strip':
# publishing only alter behavior during push
#
# strip should not touch boundary at all
@@ -4581,11 +4581,11 @@ def phase(ui, repo, *revs, **opts):
# set phase
if not revs:
raise util.Abort(_('empty revision set'))
nodes = [repo[r].node() for r in revs]
olddata = repo._phasecache.getphaserevs(repo)[:]
- phases.advanceboundary(repo, targetphase, nodes)
+ phases.advanceboundary(repo, tr, targetphase, nodes)
if opts['force']:
phases.retractboundary(repo, targetphase, nodes)
tr.close()
finally:
if tr is not None:
@@ -577,11 +577,11 @@ def _pushsyncphase(pushop):
def _localphasemove(pushop, nodes, phase=phases.public):
"""move <nodes> to <phase> in the local source repo"""
if pushop.locallocked:
tr = pushop.repo.transaction('push-phase-sync')
try:
- phases.advanceboundary(pushop.repo, phase, nodes)
+ phases.advanceboundary(pushop.repo, tr, phase, nodes)
tr.close()
finally:
tr.release()
else:
# repo is not locked, do not change any phases!
@@ -840,16 +840,18 @@ def _pullapplyphases(pullop, remotephase
draft = phases.draft
# exclude changesets already public locally and update the others
pheads = [pn for pn in pheads if phase(unfi, rev(pn)) > public]
if pheads:
- phases.advanceboundary(pullop.repo, public, pheads)
+ tr = pullop.gettransaction()
+ phases.advanceboundary(pullop.repo, tr, public, pheads)
# exclude changesets already draft locally and update the others
dheads = [pn for pn in dheads if phase(unfi, rev(pn)) > draft]
if dheads:
- phases.advanceboundary(pullop.repo, draft, dheads)
+ tr = pullop.gettransaction()
+ phases.advanceboundary(pullop.repo, tr, draft, dheads)
def _pullobsolete(pullop):
"""utility function to pull obsolete markers from a remote
The `gettransaction` is function that return the pull transaction, creating
@@ -206,11 +206,11 @@ class phasecache(object):
def _updateroots(self, phase, newroots):
self.phaseroots[phase] = newroots
self._phaserevs = None
self.dirty = True
- def advanceboundary(self, repo, targetphase, nodes):
+ def advanceboundary(self, repo, tr, targetphase, nodes):
# Be careful to preserve shallow-copied values: do not update
# phaseroots values, replace them.
repo = repo.unfiltered()
delroots = [] # set of root deleted by this path
@@ -276,19 +276,19 @@ class phasecache(object):
# anyway. If this change we should consider adding a dedicated
# "destroyed" function to phasecache or a proper cache key mechanism
# (see branchmap one)
self._phaserevs = None
-def advanceboundary(repo, targetphase, nodes):
+def advanceboundary(repo, tr, targetphase, nodes):
"""Add nodes to a phase changing other nodes phases if necessary.
This function move boundary *forward* this means that all nodes
are set in the target phase or kept in a *lower* phase.
Simplify boundary to contains phase roots only."""
phcache = repo._phasecache.copy()
- phcache.advanceboundary(repo, targetphase, nodes)
+ phcache.advanceboundary(repo, tr, targetphase, nodes)
repo._phasecache.replace(phcache)
def retractboundary(repo, targetphase, nodes):
"""Set nodes back to a phase changing other nodes phases if
necessary.
@@ -337,11 +337,11 @@ def pushphase(repo, nhex, oldphasestr, n
currentphase = repo[nhex].phase()
newphase = abs(int(newphasestr)) # let's avoid negative index surprise
oldphase = abs(int(oldphasestr)) # let's avoid negative index surprise
if currentphase == oldphase and newphase < oldphase:
tr = repo.transaction('pushkey-phase')
- advanceboundary(repo, newphase, [bin(nhex)])
+ advanceboundary(repo, tr, newphase, [bin(nhex)])
tr.close()
return 1
elif currentphase == newphase:
# raced, but got correct result
return 1