mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-06 15:30:28 +03:00
Simplify 'Tags <pattern>' by using regex on top of vcs.gettags()
This automagically enables support for pattern-based tags for all vcs types that support Tags
This commit is contained in:
parent
08607a3cd4
commit
409188a4e5
2 changed files with 5 additions and 12 deletions
|
|
@ -98,8 +98,6 @@ def check_tags(app, pattern):
|
||||||
|
|
||||||
if repotype not in ('git', 'git-svn', 'hg', 'bzr'):
|
if repotype not in ('git', 'git-svn', 'hg', 'bzr'):
|
||||||
return (None, 'Tags update mode only works for git, hg, bzr and git-svn repositories currently', None)
|
return (None, 'Tags update mode only works for git, hg, bzr and git-svn repositories currently', None)
|
||||||
if pattern and repotype not in ('git'):
|
|
||||||
return (None, 'Tags with pattern update mode only works for git repositories currently', None)
|
|
||||||
|
|
||||||
# Set up vcs interface and make sure we have the latest code...
|
# Set up vcs interface and make sure we have the latest code...
|
||||||
vcs = common.getvcs(app['Repo Type'], app['Repo'], build_dir)
|
vcs = common.getvcs(app['Repo Type'], app['Repo'], build_dir)
|
||||||
|
|
@ -117,7 +115,11 @@ def check_tags(app, pattern):
|
||||||
hver = None
|
hver = None
|
||||||
hcode = "0"
|
hcode = "0"
|
||||||
|
|
||||||
tags = vcs.gettags_pattern(pattern) if pattern else vcs.gettags()
|
tags = vcs.gettags()
|
||||||
|
if pattern:
|
||||||
|
print pattern
|
||||||
|
pat = re.compile(pattern)
|
||||||
|
tags = [tag for tag in tags if pat.match(tag)]
|
||||||
|
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
logging.info("Check tag: '{0}'".format(tag))
|
logging.info("Check tag: '{0}'".format(tag))
|
||||||
|
|
|
||||||
|
|
@ -275,10 +275,6 @@ class vcs:
|
||||||
def gettags(self):
|
def gettags(self):
|
||||||
raise VCSException('gettags not supported for this vcs type')
|
raise VCSException('gettags not supported for this vcs type')
|
||||||
|
|
||||||
# Get a list of all known tags
|
|
||||||
def gettags_pattern(self, pattern):
|
|
||||||
raise VCSException('gettags with pattern not supported for this vcs type')
|
|
||||||
|
|
||||||
# Get current commit reference (hash, revision, etc)
|
# Get current commit reference (hash, revision, etc)
|
||||||
def getref(self):
|
def getref(self):
|
||||||
raise VCSException('getref not supported for this vcs type')
|
raise VCSException('getref not supported for this vcs type')
|
||||||
|
|
@ -356,11 +352,6 @@ class vcs_git(vcs):
|
||||||
p = FDroidPopen(['git', 'tag'], cwd=self.local)
|
p = FDroidPopen(['git', 'tag'], cwd=self.local)
|
||||||
return p.stdout.splitlines()
|
return p.stdout.splitlines()
|
||||||
|
|
||||||
def gettags_pattern(self, pattern):
|
|
||||||
self.checkrepo()
|
|
||||||
p = FDroidPopen(['git', 'tag', '-l', pattern], cwd=self.local)
|
|
||||||
return p.stdout.splitlines()
|
|
||||||
|
|
||||||
|
|
||||||
class vcs_gitsvn(vcs):
|
class vcs_gitsvn(vcs):
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue