# caution, because it's inappropriate for many projects.
# Returns (None, "a message") if this didn't work, or (version, vercode) for
# the details of the current version.
-def check_tags(app):
+def check_tags(app, pattern):
try:
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)
+ 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...
vcs = common.getvcs(app['Repo Type'], app['Repo'], build_dir)
hver = None
hcode = "0"
- for tag in vcs.gettags():
+ tags = vcs.gettags_pattern(pattern) if pattern else vcs.gettags()
+
+ for tag in tags:
logging.info("Check tag: '{0}'".format(tag))
vcs.gotorevision(tag)
msg = None
vercode = None
mode = app['Update Check Mode']
- if mode == 'Tags':
- (version, vercode, tag) = check_tags(app)
+ if mode.startswith('Tags'):
+ pattern = mode[5:] if len(mode) > 4 else None
+ (version, vercode, tag) = check_tags(app, pattern)
elif mode == 'RepoManifest':
(version, vercode) = check_repomanifest(app)
elif mode.startswith('RepoManifest/'):
def gettags(self):
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)
def getref(self):
raise VCSException('getref not supported for this vcs type')
p = FDroidPopen(['git', 'tag'], cwd=self.local)
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):
[ ]),
'updatecheckmodes' : FieldType("Update Check Mode",
- r"^(Tags|RepoManifest|RepoManifest/.+|RepoTrunk|HTTP|Static|None)$", None,
+ r"^(Tags|Tags .+|RepoManifest|RepoManifest/.+|RepoTrunk|HTTP|Static|None)$", None,
[ "Update Check Mode" ],
[ ])
}