##// END OF EJS Templates
convert: support non annotated tags in git backend...
Edouard Gomez -
r16259:589aab2c default
parent child Browse files
Show More
@@ -143,20 +143,30 b' class convert_git(converter_source):'
143
143
144 def gettags(self):
144 def gettags(self):
145 tags = {}
145 tags = {}
146 alltags = {}
146 fh = self.gitopen('git ls-remote --tags "%s"' % self.path)
147 fh = self.gitopen('git ls-remote --tags "%s"' % self.path)
147 prefix = 'refs/tags/'
148 prefix = 'refs/tags/'
149
150 # Build complete list of tags, both annotated and bare ones
148 for line in fh:
151 for line in fh:
149 line = line.strip()
152 line = line.strip()
150 if not line.endswith("^{}"):
151 continue
152 node, tag = line.split(None, 1)
153 node, tag = line.split(None, 1)
153 if not tag.startswith(prefix):
154 if not tag.startswith(prefix):
154 continue
155 continue
155 tag = tag[len(prefix):-3]
156 alltags[tag[len(prefix):]] = node
156 tags[tag] = node
157 if fh.close():
157 if fh.close():
158 raise util.Abort(_('cannot read tags from %s') % self.path)
158 raise util.Abort(_('cannot read tags from %s') % self.path)
159
159
160 # Filter out tag objects for annotated tag refs
161 for tag in alltags:
162 if tag.endswith('^{}'):
163 tags[tag[:-3]] = alltags[tag]
164 else:
165 if tag + '^{}' in alltags:
166 continue
167 else:
168 tags[tag] = alltags[tag]
169
160 return tags
170 return tags
161
171
162 def getchangedfiles(self, version, i):
172 def getchangedfiles(self, version, i):
General Comments 0
You need to be logged in to leave comments. Login now