mercurial/localrepo.py
changeset 20195 4274eda143cb
parent 20189 1831993d0902
child 20216 01bdccfeb9d9
equal deleted inserted replaced
20194:9985e188d940 20195:4274eda143cb
   657     def branchmap(self):
   657     def branchmap(self):
   658         '''returns a dictionary {branch: [branchheads]}'''
   658         '''returns a dictionary {branch: [branchheads]}'''
   659         branchmap.updatecache(self)
   659         branchmap.updatecache(self)
   660         return self._branchcaches[self.filtername]
   660         return self._branchcaches[self.filtername]
   661 
   661 
   662 
       
   663     def _branchtip(self, heads):
       
   664         '''return the tipmost branch head in heads'''
       
   665         tip = heads[-1]
       
   666         for h in reversed(heads):
       
   667             if not self[h].closesbranch():
       
   668                 tip = h
       
   669                 break
       
   670         return tip
       
   671 
       
   672     def branchtip(self, branch):
   662     def branchtip(self, branch):
   673         '''return the tip node for a given branch'''
   663         '''return the tip node for a given branch'''
   674         try:
   664         try:
   675             return self.branchmap().branchtip(branch)
   665             return self.branchmap().branchtip(branch)
   676         except KeyError:
   666         except KeyError:
   677             raise error.RepoLookupError(_("unknown branch '%s'") % branch)
   667             raise error.RepoLookupError(_("unknown branch '%s'") % branch)
   678 
       
   679     def branchtags(self):
       
   680         '''return a dict where branch names map to the tipmost head of
       
   681         the branch, open heads come before closed'''
       
   682         bt = {}
       
   683         for bn, heads in self.branchmap().iteritems():
       
   684             bt[bn] = self._branchtip(heads)
       
   685         return bt
       
   686 
   668 
   687     def lookup(self, key):
   669     def lookup(self, key):
   688         return self[key].node()
   670         return self[key].node()
   689 
   671 
   690     def lookupbranch(self, key, remote=None):
   672     def lookupbranch(self, key, remote=None):