mercurial/setdiscovery.py
changeset 35304 f77121b6bf1b
parent 32768 483d47753726
child 35849 5cfdf6137af8
equal deleted inserted replaced
35303:67b7e39b441b 35304:f77121b6bf1b
   131     return sample
   131     return sample
   132 
   132 
   133 def findcommonheads(ui, local, remote,
   133 def findcommonheads(ui, local, remote,
   134                     initialsamplesize=100,
   134                     initialsamplesize=100,
   135                     fullsamplesize=200,
   135                     fullsamplesize=200,
   136                     abortwhenunrelated=True):
   136                     abortwhenunrelated=True,
       
   137                     ancestorsof=None):
   137     '''Return a tuple (common, anyincoming, remoteheads) used to identify
   138     '''Return a tuple (common, anyincoming, remoteheads) used to identify
   138     missing nodes from or in remote.
   139     missing nodes from or in remote.
   139     '''
   140     '''
   140     start = util.timer()
   141     start = util.timer()
   141 
   142 
   142     roundtrips = 0
   143     roundtrips = 0
   143     cl = local.changelog
   144     cl = local.changelog
   144     dag = dagutil.revlogdag(cl)
   145     localsubset = None
       
   146     if ancestorsof is not None:
       
   147         rev = local.changelog.rev
       
   148         localsubset = [rev(n) for n in ancestorsof]
       
   149     dag = dagutil.revlogdag(cl, localsubset=localsubset)
   145 
   150 
   146     # early exit if we know all the specified remote heads already
   151     # early exit if we know all the specified remote heads already
   147     ui.debug("query 1; heads\n")
   152     ui.debug("query 1; heads\n")
   148     roundtrips += 1
   153     roundtrips += 1
   149     ownheads = dag.heads()
   154     ownheads = dag.heads()