Use file contexts in tags code
authorMatt Mackall <mpm@selenic.com>
Wed, 18 Oct 2006 14:14:59 -0500
changeset 3455 baa271270829
parent 3454 23ede9e7ad4d
child 3456 3464f5e77f34
Use file contexts in tags code
mercurial/localrepo.py
tests/test-tags.out
--- a/mercurial/localrepo.py	Wed Oct 18 14:06:48 2006 -0500
+++ b/mercurial/localrepo.py	Wed Oct 18 14:14:59 2006 -0500
@@ -247,15 +247,12 @@
             heads.reverse()
             fl = self.file(".hgtags")
             for node in heads:
-                change = self.changelog.read(node)
-                rev = self.changelog.rev(node)
-                fn, ff = self.manifest.find(change[0], '.hgtags')
-                if fn is None: continue
+                f = self.filectx('.hgtags', node)
+                if not f: continue
                 count = 0
-                for l in fl.read(fn).splitlines():
+                for l in f.data().splitlines():
                     count += 1
-                    parsetag(l, _(".hgtags (rev %d:%s), line %d") %
-                             (rev, short(node), count))
+                    parsetag(l, _("%s, line %d") % (str(f), count))
             try:
                 f = self.opener("localtags")
                 count = 0
--- a/tests/test-tags.out	Wed Oct 18 14:06:48 2006 -0500
+++ b/tests/test-tags.out	Wed Oct 18 14:14:59 2006 -0500
@@ -18,20 +18,17 @@
 M .hgtags
 tip                                6:e2174d339386
 first                              0:0acdaf898367
-.hgtags (rev 7:c071f74ab5eb), line 2: cannot parse entry
-.hgtags (rev 7:c071f74ab5eb), line 4: node 'foo' is not well formed
-localtags, line 1: tag 'invalid' refers to unknown node
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-.hgtags (rev 7:c071f74ab5eb), line 2: cannot parse entry
-.hgtags (rev 7:c071f74ab5eb), line 4: node 'foo' is not well formed
-.hgtags (rev 8:4ca6f1b1a68c), line 2: node 'x' is not well formed
+.hgtags@c071f74ab5eb, line 2: cannot parse entry
+.hgtags@c071f74ab5eb, line 4: node 'foo' is not well formed
+.hgtags@4ca6f1b1a68c, line 2: node 'x' is not well formed
 localtags, line 1: tag 'invalid' refers to unknown node
 tip                                8:4ca6f1b1a68c
 first                              0:0acdaf898367
 changeset:   8:4ca6f1b1a68c
-.hgtags (rev 7:c071f74ab5eb), line 2: cannot parse entry
-.hgtags (rev 7:c071f74ab5eb), line 4: node 'foo' is not well formed
-.hgtags (rev 8:4ca6f1b1a68c), line 2: node 'x' is not well formed
+.hgtags@c071f74ab5eb, line 2: cannot parse entry
+.hgtags@c071f74ab5eb, line 4: node 'foo' is not well formed
+.hgtags@4ca6f1b1a68c, line 2: node 'x' is not well formed
 localtags, line 1: tag 'invalid' refers to unknown node
 tag:         tip
 parent:      3:b2ef3841386b