Mercurial > hg-stable
changeset 22069:616a455b02ca
phase: add a transaction argument to advanceboundary
We now pass a transaction option to this phase movement function. The object
is currently not used by the function, but it will be in the future.
All call sites have been updated. Most call sites were already enclosed in a
transaction for a long time. The handful of others have been recently
updated in previous commit.
The retractboundary function remains to be upgraded.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 06 Aug 2014 01:54:19 -0700 |
parents | d34058dd3246 |
children | c1ca47204590 |
files | hgext/mq.py mercurial/changegroup.py mercurial/commands.py mercurial/exchange.py mercurial/phases.py |
diffstat | 5 files changed, 13 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Wed Aug 06 00:54:37 2014 -0700 +++ b/hgext/mq.py Wed Aug 06 01:54:19 2014 -0700 @@ -932,7 +932,7 @@ 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()
--- a/mercurial/changegroup.py Wed Aug 06 00:54:37 2014 -0700 +++ b/mercurial/changegroup.py Wed Aug 06 01:54:19 2014 -0700 @@ -700,12 +700,12 @@ # 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
--- a/mercurial/commands.py Wed Aug 06 00:54:37 2014 -0700 +++ b/mercurial/commands.py Wed Aug 06 01:54:19 2014 -0700 @@ -4583,7 +4583,7 @@ 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()
--- a/mercurial/exchange.py Wed Aug 06 00:54:37 2014 -0700 +++ b/mercurial/exchange.py Wed Aug 06 01:54:19 2014 -0700 @@ -577,7 +577,7 @@ 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() @@ -840,12 +840,14 @@ # 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
--- a/mercurial/phases.py Wed Aug 06 00:54:37 2014 -0700 +++ b/mercurial/phases.py Wed Aug 06 01:54:19 2014 -0700 @@ -208,7 +208,7 @@ 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. @@ -278,7 +278,7 @@ # (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 @@ -286,7 +286,7 @@ 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): @@ -339,7 +339,7 @@ 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: