super().__init__(name, label, **kw)
self._choice_list = []
- @property
- def choices(self):
+ def getRevTags(self, findtag=None):
taglist = []
branchvers = []
if not line:
break
- (ref, tag) = line.split()
+ (rev, tag) = line.split()
tagver = re.search(r'\brefs/tags/(v[0-9]+\.[0-9]+\.[0-9]+(?:-rc[0-9]+)?)$', tag.decode().strip())
# only list tags matching configured branches
if tagver and any(tagver[1][1:].startswith(b) for b in branchvers):
- taglist.append(tagver[1])
+ if findtag and findtag != tagver[1]:
+ continue
+ taglist.append({'rev': rev.decode().strip(), 'tag': tagver[1]})
+
+ return taglist
+ @property
+ def choices(self):
+ taglist = [rt['tag'] for rt in self.getRevTags()]
taglist.sort(reverse=True, key=lambda tag: tag if re.search(r'-rc[0-9]+$', tag) else tag + '-z')
taglist.insert(0, '')
properties[self.name] = tag
# find the commit matching the tag
- findrev = subprocess.Popen(['git', 'rev-parse', 'tags/'+tag], stdout=subprocess.PIPE, cwd=work_dir+'/work.git')
- findrev.wait(timeout=10)
- line = findrev.stdout.readline()
+ findtag = self.getRevTags(tag)
- if findrev.returncode!=0 or not line:
+ if not findtag:
raise ValidationError("Couldn't find tag")
- properties['force_revision'] = line.decode().strip()
+ properties['force_revision'] = findtag[0]['rev']
# find the branch matching the tag
branch = None