mercurial/branchmap.py
changeset 43106 d783f945a701
parent 43104 74802979dd9d
child 43499 1a47fe4bc154
equal deleted inserted replaced
43105:649d3ac37a12 43106:d783f945a701
   226     def __contains__(self, key):
   226     def __contains__(self, key):
   227         self._verifybranch(key)
   227         self._verifybranch(key)
   228         return key in self._entries
   228         return key in self._entries
   229 
   229 
   230     def iteritems(self):
   230     def iteritems(self):
   231         for k, v in self._entries.iteritems():
   231         for k, v in pycompat.iteritems(self._entries):
   232             self._verifybranch(k)
   232             self._verifybranch(k)
   233             yield k, v
   233             yield k, v
   234 
   234 
   235     items = iteritems
   235     items = iteritems
   236 
   236 
   342         if not closed:
   342         if not closed:
   343             heads = list(self.iteropen(heads))
   343             heads = list(self.iteropen(heads))
   344         return heads
   344         return heads
   345 
   345 
   346     def iterbranches(self):
   346     def iterbranches(self):
   347         for bn, heads in self.iteritems():
   347         for bn, heads in pycompat.iteritems(self):
   348             yield (bn, heads) + self._branchtip(heads)
   348             yield (bn, heads) + self._branchtip(heads)
   349 
   349 
   350     def iterheads(self):
   350     def iterheads(self):
   351         """ returns all the heads """
   351         """ returns all the heads """
   352         self._verifyall()
   352         self._verifyall()
   368             cachekey = [hex(self.tipnode), b'%d' % self.tiprev]
   368             cachekey = [hex(self.tipnode), b'%d' % self.tiprev]
   369             if self.filteredhash is not None:
   369             if self.filteredhash is not None:
   370                 cachekey.append(hex(self.filteredhash))
   370                 cachekey.append(hex(self.filteredhash))
   371             f.write(b" ".join(cachekey) + b'\n')
   371             f.write(b" ".join(cachekey) + b'\n')
   372             nodecount = 0
   372             nodecount = 0
   373             for label, nodes in sorted(self._entries.iteritems()):
   373             for label, nodes in sorted(pycompat.iteritems(self._entries)):
   374                 label = encoding.fromlocal(label)
   374                 label = encoding.fromlocal(label)
   375                 for node in nodes:
   375                 for node in nodes:
   376                     nodecount += 1
   376                     nodecount += 1
   377                     if node in self._closednodes:
   377                     if node in self._closednodes:
   378                         state = b'c'
   378                         state = b'c'
   418         ntiprev = self.tiprev
   418         ntiprev = self.tiprev
   419 
   419 
   420         # if older branchheads are reachable from new ones, they aren't
   420         # if older branchheads are reachable from new ones, they aren't
   421         # really branchheads. Note checking parents is insufficient:
   421         # really branchheads. Note checking parents is insufficient:
   422         # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
   422         # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
   423         for branch, newheadrevs in newbranches.iteritems():
   423         for branch, newheadrevs in pycompat.iteritems(newbranches):
   424             bheads = self._entries.setdefault(branch, [])
   424             bheads = self._entries.setdefault(branch, [])
   425             bheadset = set(cl.rev(node) for node in bheads)
   425             bheadset = set(cl.rev(node) for node in bheads)
   426 
   426 
   427             # This have been tested True on all internal usage of this function.
   427             # This have been tested True on all internal usage of this function.
   428             # run it again in case of doubt
   428             # run it again in case of doubt