Skip to content

Commit

Permalink
use new names for tags cache attributes if they're available
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed May 21, 2011
1 parent 2299641 commit ae0b0be
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions hggit/hgrepo.py
Expand Up @@ -60,22 +60,24 @@ def gitrefs(self):
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

Expand Down

0 comments on commit ae0b0be

Please sign in to comment.