Mercurial > hg > hg-git
changeset 399:132fb69af782
use new names for tags cache attributes if they're available
author | Adrian Sampson <adrian@radbox.org> |
---|---|
date | Fri, 20 May 2011 22:36:06 -0700 |
parents | 50c8d033638b |
children | 6d4f3b6d2e08 |
files | hggit/hgrepo.py |
diffstat | 1 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/hgrepo.py +++ b/hggit/hgrepo.py @@ -60,22 +60,24 @@ return {} def tags(self): - if not hasattr(self, 'tagscache'): - # mercurial 1.4 - tmp = super(hgrepo, self).tags() - tmp.update(self.gitrefs()) - return tmp - if self.tagscache: + if hasattr(self, 'tagscache') and self.tagscache: + # Mercurial 1.4 and earlier. return self.tagscache + elif hasattr(self, '_tags') and self._tags: + # Mercurial 1.5 and later. + return self._tags git = GitHandler(self, self.ui) tagscache = super(hgrepo, self).tags() + tagscache.update(self.gitrefs()) for tag, rev in git.tags.iteritems(): if tag in tagscache: continue tagscache[tag] = bin(rev) - self._tagstypecache[tag] = 'git' + if hasattr(self, '_tagstypecache'): + # Only present in Mercurial 1.3 and earlier. + self._tagstypecache[tag] = 'git' return tagscache