Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/hg.py Sun Jul 03 21:51:09 2005 -0800 +++ b/mercurial/hg.py Mon Jul 04 11:00:25 2005 -0800 @@ -438,6 +438,13 @@ '''return a mapping of tag to node''' if not self.tagscache: self.tagscache = {} + def addtag(self, k, n): + try: + bin_n = bin(n) + except TypeError: + bin_n = '' + self.tagscache[k.strip()] = bin_n + try: # read each head of the tags file, ending with the tip # and add each tag found to the map, with "newer" ones @@ -449,22 +456,20 @@ for l in fl.revision(r).splitlines(): if l: n, k = l.split(" ", 1) - try: - bin_n = bin(n) - except TypeError: - bin_n = '' - self.tagscache[k.strip()] = bin_n + addtag(self, k, n) except KeyError: pass - for k, n in self.ui.configitems("tags"): - try: - bin_n = bin(n) - except TypeError: - bin_n = '' - self.tagscache[k] = bin_n - + + try: + f = self.opener("localtags") + for l in f: + n, k = l.split(" ", 1) + addtag(self, k, n) + except IOError: + pass + self.tagscache['tip'] = self.changelog.tip() - + return self.tagscache def tagslist(self):