comparison mercurial/hg.py @ 609:2acf1f5df2e6

[PATCH] hg tag: local tag support in file .hg/localtags -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] hg tag: local tag support in file .hg/localtags From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl> Support local tags in .hg/localtags Also minor cleanups in related functions manifest hash: 553b2e896fed3c9055ed18482ce15cfaa4fc41ce -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCyYdJywK+sNU5EO8RAhohAKC2I3U44EXi+k4ofo5AWHBOg+94bgCfcbzs VQ2yWkPPHZycjtswOBmepa8= =v5AX -----END PGP SIGNATURE-----
author Matt Mackall <mpm@selenic.com>
date Mon, 04 Jul 2005 11:00:25 -0800
parents d2994b5298fb
children 48c3eb2bf844
comparison
equal deleted inserted replaced
608:d2994b5298fb 609:2acf1f5df2e6
436 436
437 def tags(self): 437 def tags(self):
438 '''return a mapping of tag to node''' 438 '''return a mapping of tag to node'''
439 if not self.tagscache: 439 if not self.tagscache:
440 self.tagscache = {} 440 self.tagscache = {}
441 def addtag(self, k, n):
442 try:
443 bin_n = bin(n)
444 except TypeError:
445 bin_n = ''
446 self.tagscache[k.strip()] = bin_n
447
441 try: 448 try:
442 # read each head of the tags file, ending with the tip 449 # read each head of the tags file, ending with the tip
443 # and add each tag found to the map, with "newer" ones 450 # and add each tag found to the map, with "newer" ones
444 # taking precedence 451 # taking precedence
445 fl = self.file(".hgtags") 452 fl = self.file(".hgtags")
447 h.reverse() 454 h.reverse()
448 for r in h: 455 for r in h:
449 for l in fl.revision(r).splitlines(): 456 for l in fl.revision(r).splitlines():
450 if l: 457 if l:
451 n, k = l.split(" ", 1) 458 n, k = l.split(" ", 1)
452 try: 459 addtag(self, k, n)
453 bin_n = bin(n)
454 except TypeError:
455 bin_n = ''
456 self.tagscache[k.strip()] = bin_n
457 except KeyError: 460 except KeyError:
458 pass 461 pass
459 for k, n in self.ui.configitems("tags"): 462
460 try: 463 try:
461 bin_n = bin(n) 464 f = self.opener("localtags")
462 except TypeError: 465 for l in f:
463 bin_n = '' 466 n, k = l.split(" ", 1)
464 self.tagscache[k] = bin_n 467 addtag(self, k, n)
465 468 except IOError:
469 pass
470
466 self.tagscache['tip'] = self.changelog.tip() 471 self.tagscache['tip'] = self.changelog.tip()
467 472
468 return self.tagscache 473 return self.tagscache
469 474
470 def tagslist(self): 475 def tagslist(self):
471 '''return a list of tags ordered by revision''' 476 '''return a list of tags ordered by revision'''
472 l = [] 477 l = []