mercurial/hg.py
changeset 484 934279f3ca53
parent 471 4c7f687e4313
parent 477 520540fd6b64
child 487 2ad41189bee5
child 495 e94cebc60d96
equal deleted inserted replaced
474:b2ae8283d1a6 484:934279f3ca53
   371             if pat.search(f): return True
   371             if pat.search(f): return True
   372         return False
   372         return False
   373 
   373 
   374     def tags(self):
   374     def tags(self):
   375         '''return a mapping of tag to node'''
   375         '''return a mapping of tag to node'''
   376         if not self.tagscache: 
   376         if not self.tagscache:
   377             self.tagscache = {}
   377             self.tagscache = {}
   378             try:
   378             try:
   379                 # read each head of the tags file, ending with the tip
   379                 # read each head of the tags file, ending with the tip
   380                 # and add each tag found to the map, with "newer" ones
   380                 # and add each tag found to the map, with "newer" ones
   381                 # taking precedence
   381                 # taking precedence
   384                 h.reverse()
   384                 h.reverse()
   385                 for r in h:
   385                 for r in h:
   386                     for l in fl.revision(r).splitlines():
   386                     for l in fl.revision(r).splitlines():
   387                         if l:
   387                         if l:
   388                             n, k = l.split(" ", 1)
   388                             n, k = l.split(" ", 1)
   389                             self.tagscache[k.strip()] = bin(n)
   389                             try:
   390             except KeyError: pass
   390                                 bin_n = bin(n)
       
   391                             except TypeError:
       
   392                                 bin_n = ''
       
   393                             self.tagscache[k.strip()] = bin_n
       
   394             except KeyError:
       
   395                 pass
   391             for k, n in self.ui.configitems("tags"):
   396             for k, n in self.ui.configitems("tags"):
   392                 self.tagscache[k] = bin(n)
   397                 try:
   393                 
   398                     bin_n = bin(n)
       
   399                 except TypeError:
       
   400                     bin_n = ''
       
   401                 self.tagscache[k] = bin_n
       
   402 
   394             self.tagscache['tip'] = self.changelog.tip()
   403             self.tagscache['tip'] = self.changelog.tip()
   395 
   404 
   396         return self.tagscache
   405         return self.tagscache
   397 
   406 
   398     def tagslist(self):
   407     def tagslist(self):
   399         '''return a list of tags ordered by revision'''
   408         '''return a list of tags ordered by revision'''
   400         l = []
   409         l = []
   401         for t,n in self.tags().items():
   410         for t, n in self.tags().items():
   402             try:
   411             try:
   403                 r = self.changelog.rev(n)
   412                 r = self.changelog.rev(n)
   404             except:
   413             except:
   405                 r = -2 # sort to the beginning of the list if unknown
   414                 r = -2 # sort to the beginning of the list if unknown
   406             l.append((r,t,n))
   415             l.append((r,t,n))