diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -247,15 +247,12 @@ class localrepository(repo.repository): 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 diff --git a/tests/test-tags.out b/tests/test-tags.out --- a/tests/test-tags.out +++ b/tests/test-tags.out @@ -18,20 +18,17 @@ 8216907a933d+8a3ca90d111d+ tip 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