mercurial/hg.py
changeset 328 dac675ef6189
parent 324 ce81bdd91d06
child 330 27d08c0c2a7e
equal deleted inserted replaced
327:a9ad98a9c9bc 328:dac675ef6189
   732             r = []
   732             r = []
   733             while unknown:
   733             while unknown:
   734                 n = unknown.pop(0)
   734                 n = unknown.pop(0)
   735                 if n[0] in seen:
   735                 if n[0] in seen:
   736                     continue
   736                     continue
   737                 seen[n[0]] = 1
       
   738 
   737 
   739                 self.ui.debug("examining %s:%s\n" % (short(n[0]), short(n[1])))
   738                 self.ui.debug("examining %s:%s\n" % (short(n[0]), short(n[1])))
   740                 if n[0] == nullid:
   739                 if n[0] == nullid:
   741                     break
   740                     break
   742                 if n[1] in seenbranch:
   741                 if n in seenbranch:
   743                     self.ui.debug("branch already found\n")
   742                     self.ui.debug("branch already found\n")
   744                     continue
   743                     continue
   745                 if n[1] and n[1] in m: # do we know the base?
   744                 if n[1] and n[1] in m: # do we know the base?
   746                     self.ui.debug("found incomplete branch %s:%s\n"
   745                     self.ui.debug("found incomplete branch %s:%s\n"
   747                                   % (short(n[0]), short(n[1])))
   746                                   % (short(n[0]), short(n[1])))
   748                     search.append(n) # schedule branch range for scanning
   747                     search.append(n) # schedule branch range for scanning
   749                     seenbranch[n[1]] = 1
   748                     seenbranch[n] = 1
   750                 else:
   749                 else:
   751                     if n[1] not in seen and n[1] not in fetch:
   750                     if n[1] not in seen and n[1] not in fetch:
   752                         if n[2] in m and n[3] in m:
   751                         if n[2] in m and n[3] in m:
   753                             self.ui.debug("found new changeset %s\n" %
   752                             self.ui.debug("found new changeset %s\n" %
   754                                           short(n[1]))
   753                                           short(n[1]))
   757 
   756 
   758                     for a in n[2:4]:
   757                     for a in n[2:4]:
   759                         if a not in rep:
   758                         if a not in rep:
   760                             r.append(a)
   759                             r.append(a)
   761                             rep[a] = 1
   760                             rep[a] = 1
       
   761 
       
   762                 seen[n[0]] = 1
   762 
   763 
   763             if r:
   764             if r:
   764                 reqcnt += 1
   765                 reqcnt += 1
   765                 self.ui.debug("request %d: %s\n" %
   766                 self.ui.debug("request %d: %s\n" %
   766                             (reqcnt, " ".join(map(short, r))))
   767                             (reqcnt, " ".join(map(short, r))))
   773   
   774   
   774         while search:
   775         while search:
   775             n = search.pop(0)
   776             n = search.pop(0)
   776             reqcnt += 1
   777             reqcnt += 1
   777             l = remote.between([(n[0], n[1])])[0]
   778             l = remote.between([(n[0], n[1])])[0]
       
   779             l.append(n[1])
   778             p = n[0]
   780             p = n[0]
   779             f = 1
   781             f = 1
   780             for i in l + [n[1]]:
   782             for i in l:
       
   783                 self.ui.debug("narrowing %d:%d %s\n" % (f, len(l), short(i)))
   781                 if i in m:
   784                 if i in m:
   782                     if f <= 2:
   785                     if f <= 2:
   783                         self.ui.debug("found new branch changeset %s\n" %
   786                         self.ui.debug("found new branch changeset %s\n" %
   784                                           short(p))
   787                                           short(p))
   785                         fetch.append(p)
   788                         fetch.append(p)