mercurial/discovery.py
changeset 18120 88990d3e3d75
parent 18104 a2cebd3e4daa
child 18124 79db6d40bced
equal deleted inserted replaced
18119:5264464b5f68 18120:88990d3e3d75
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 from node import nullid, short
     8 from node import nullid, short
     9 from i18n import _
     9 from i18n import _
    10 import util, setdiscovery, treediscovery, phases, obsolete, bookmarks
    10 import util, setdiscovery, treediscovery, phases, obsolete, bookmarks
       
    11 import branchmap
    11 
    12 
    12 def findcommonincoming(repo, remote, heads=None, force=False):
    13 def findcommonincoming(repo, remote, heads=None, force=False):
    13     """Return a tuple (common, anyincoming, heads) used to identify the common
    14     """Return a tuple (common, anyincoming, heads) used to identify the common
    14     subset of nodes between repo and remote.
    15     subset of nodes between repo and remote.
    15 
    16 
   192 
   193 
   193     # D. Update newmap with outgoing changes.
   194     # D. Update newmap with outgoing changes.
   194     # This will possibly add new heads and remove existing ones.
   195     # This will possibly add new heads and remove existing ones.
   195     newmap = dict((branch, heads[1]) for branch, heads in headssum.iteritems()
   196     newmap = dict((branch, heads[1]) for branch, heads in headssum.iteritems()
   196                   if heads[0] is not None)
   197                   if heads[0] is not None)
   197     repo._updatebranchcache(newmap, missingctx)
   198     branchmap.update(repo, newmap, missingctx)
   198     for branch, newheads in newmap.iteritems():
   199     for branch, newheads in newmap.iteritems():
   199         headssum[branch][1][:] = newheads
   200         headssum[branch][1][:] = newheads
   200     return headssum
   201     return headssum
   201 
   202 
   202 def _oldheadssummary(repo, remoteheads, outgoing, inc=False):
   203 def _oldheadssummary(repo, remoteheads, outgoing, inc=False):
   203     """Compute branchmapsummary for repo without branchmap support"""
   204     """Compute branchmapsummary for repo without branchmap support"""
   204 
   205 
   205     cl = repo.changelog
   206     cl = repo.changelog
   206     # 1-4b. old servers: Check for new topological heads.
   207     # 1-4b. old servers: Check for new topological heads.
   207     # Construct {old,new}map with branch = None (topological branch).
   208     # Construct {old,new}map with branch = None (topological branch).
   208     # (code based on _updatebranchcache)
   209     # (code based on update)
   209     oldheads = set(h for h in remoteheads if h in cl.nodemap)
   210     oldheads = set(h for h in remoteheads if h in cl.nodemap)
   210     # all nodes in outgoing.missing are children of either:
   211     # all nodes in outgoing.missing are children of either:
   211     # - an element of oldheads
   212     # - an element of oldheads
   212     # - another element of outgoing.missing
   213     # - another element of outgoing.missing
   213     # - nullrev
   214     # - nullrev