phase: gather remote phase information in a summary object
We keep useful phase information around. The data will be reused with detecting
push-race in later changesets.
--- a/mercurial/exchange.py Wed Oct 11 18:39:34 2017 +0200
+++ b/mercurial/exchange.py Wed Oct 11 18:39:04 2017 +0200
@@ -340,6 +340,8 @@
self.pushbranchmap = None
# testable as a boolean indicating if any nodes are missing locally.
self.incoming = None
+ # summary of the remote phase situation
+ self.remotephases = None
# phases changes that must be pushed along side the changesets
self.outdatedphases = None
# phases changes that must be pushed if changeset push fails
@@ -527,7 +529,6 @@
outgoing = pushop.outgoing
unfi = pushop.repo.unfiltered()
remotephases = pushop.remote.listkeys('phases')
- publishing = remotephases.get('publishing', False)
if (pushop.ui.configbool('ui', '_usedassubrepo')
and remotephases # server supports phases
and not pushop.outgoing.missing # no changesets to be pushed
@@ -544,12 +545,14 @@
pushop.outdatedphases = []
pushop.fallbackoutdatedphases = []
return
- ana = phases.analyzeremotephases(pushop.repo,
- pushop.fallbackheads,
- remotephases)
- pheads, droots = ana
+
+ pushop.remotephases = phases.remotephasessummary(pushop.repo,
+ pushop.fallbackheads,
+ remotephases)
+ droots = pushop.remotephases.draftroots
+
extracond = ''
- if not publishing:
+ if not pushop.remotephases.publishing:
extracond = ' and public()'
revset = 'heads((%%ln::%%ln) %s)' % extracond
# Get the list of all revs draft on remote by public here.
--- a/mercurial/phases.py Wed Oct 11 18:39:34 2017 +0200
+++ b/mercurial/phases.py Wed Oct 11 18:39:04 2017 +0200
@@ -604,6 +604,27 @@
publicheads = newheads(repo, subset, draftroots)
return publicheads, draftroots
+class remotephasessummary(object):
+ """summarize phase information on the remote side
+
+ :publishing: True is the remote is publishing
+ :publicheads: list of remote public phase heads (nodes)
+ :draftheads: list of remote draft phase heads (nodes)
+ :draftroots: list of remote draft phase root (nodes)
+ """
+
+ def __init__(self, repo, remotesubset, remoteroots):
+ unfi = repo.unfiltered()
+ self._allremoteroots = remoteroots
+
+ self.publishing = remoteroots.get('publishing', False)
+
+ ana = analyzeremotephases(repo, remotesubset, remoteroots)
+ self.publicheads, self.draftroots = ana
+ # Get the list of all "heads" revs draft on remote
+ dheads = unfi.set('heads(%ln::%ln)', self.draftroots, remotesubset)
+ self.draftheads = [c.node() for c in dheads]
+
def newheads(repo, heads, roots):
"""compute new head of a subset minus another