mercurial/setdiscovery.py
changeset 39161 858a12846f4f
parent 39159 5b32b3c618b2
child 39165 860e83cd97de
equal deleted inserted replaced
39160:0e46b92b37b1 39161:858a12846f4f
   141     start = util.timer()
   141     start = util.timer()
   142 
   142 
   143     roundtrips = 0
   143     roundtrips = 0
   144     cl = local.changelog
   144     cl = local.changelog
   145     clnode = cl.node
   145     clnode = cl.node
       
   146     clrev = cl.rev
   146     localsubset = None
   147     localsubset = None
   147 
   148 
   148     if ancestorsof is not None:
   149     if ancestorsof is not None:
   149         rev = local.changelog.rev
   150         localsubset = [clrev(n) for n in ancestorsof]
   150         localsubset = [rev(n) for n in ancestorsof]
       
   151     dag = dagutil.revlogdag(cl, localsubset=localsubset)
   151     dag = dagutil.revlogdag(cl, localsubset=localsubset)
   152 
   152 
   153     # early exit if we know all the specified remote heads already
   153     # early exit if we know all the specified remote heads already
   154     ui.debug("query 1; heads\n")
   154     ui.debug("query 1; heads\n")
   155     roundtrips += 1
   155     roundtrips += 1
   173 
   173 
   174     # start actual discovery (we note this before the next "if" for
   174     # start actual discovery (we note this before the next "if" for
   175     # compatibility reasons)
   175     # compatibility reasons)
   176     ui.status(_("searching for changes\n"))
   176     ui.status(_("searching for changes\n"))
   177 
   177 
   178     srvheads = dag.internalizeall(srvheadhashes, filterunknown=True)
   178     srvheads = []
       
   179     for node in srvheadhashes:
       
   180         if node == nullid:
       
   181             continue
       
   182 
       
   183         try:
       
   184             srvheads.append(clrev(node))
       
   185         # Catches unknown and filtered nodes.
       
   186         except error.LookupError:
       
   187             continue
       
   188 
   179     if len(srvheads) == len(srvheadhashes):
   189     if len(srvheads) == len(srvheadhashes):
   180         ui.debug("all remote heads known locally\n")
   190         ui.debug("all remote heads known locally\n")
   181         return srvheadhashes, False, srvheadhashes
   191         return srvheadhashes, False, srvheadhashes
   182 
   192 
   183     if len(sample) == len(ownheads) and all(yesno):
   193     if len(sample) == len(ownheads) and all(yesno):