Mercurial > hg-stable
changeset 16259:589aab2ca716
convert: support non annotated tags in git backend
Do not blindly filter out non ending ^{} tags. The new logic
is:
- if both "tag" and "tag^{}" exist, "tag^{}" is what we want
- if only "tag" exists, "tag" is fine
author | Edouard Gomez <ed.gomez@free.fr> |
---|---|
date | Wed, 14 Mar 2012 01:13:45 +0100 |
parents | c655e4acaa82 |
children | 33fcad3cfbbc |
files | hgext/convert/git.py |
diffstat | 1 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/git.py Tue Mar 13 16:29:13 2012 -0500 +++ b/hgext/convert/git.py Wed Mar 14 01:13:45 2012 +0100 @@ -143,20 +143,30 @@ def gettags(self): tags = {} + alltags = {} fh = self.gitopen('git ls-remote --tags "%s"' % self.path) prefix = 'refs/tags/' + + # Build complete list of tags, both annotated and bare ones for line in fh: line = line.strip() - if not line.endswith("^{}"): - continue node, tag = line.split(None, 1) if not tag.startswith(prefix): continue - tag = tag[len(prefix):-3] - tags[tag] = node + alltags[tag[len(prefix):]] = node if fh.close(): raise util.Abort(_('cannot read tags from %s') % self.path) + # Filter out tag objects for annotated tag refs + for tag in alltags: + if tag.endswith('^{}'): + tags[tag[:-3]] = alltags[tag] + else: + if tag + '^{}' in alltags: + continue + else: + tags[tag] = alltags[tag] + return tags def getchangedfiles(self, version, i):