mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-19 03:30:12 +02:00
Use hash of tag when adding new version
Also extend getref with a refname parameter and implement it for vcs_git.
This commit is contained in:
parent
35cf7f289e
commit
cd405cc93e
@ -217,6 +217,12 @@ def check_tags(app, pattern):
|
|||||||
hver = version
|
hver = version
|
||||||
|
|
||||||
if hver:
|
if hver:
|
||||||
|
try:
|
||||||
|
commit = vcs.getref(htag)
|
||||||
|
if commit:
|
||||||
|
return (hver, hcode, commit)
|
||||||
|
except VCSException:
|
||||||
|
pass
|
||||||
return (hver, hcode, htag)
|
return (hver, hcode, htag)
|
||||||
return (None, "Couldn't find any version information", None)
|
return (None, "Couldn't find any version information", None)
|
||||||
|
|
||||||
|
@ -1026,7 +1026,7 @@ class vcs:
|
|||||||
"""Get a list of all the known tags, sorted from newest to oldest"""
|
"""Get a list of all the known tags, sorted from newest to oldest"""
|
||||||
raise VCSException('latesttags not supported for this vcs type')
|
raise VCSException('latesttags not supported for this vcs type')
|
||||||
|
|
||||||
def getref(self):
|
def getref(self, revname=None):
|
||||||
"""Get current commit reference (hash, revision, etc)"""
|
"""Get current commit reference (hash, revision, etc)"""
|
||||||
raise VCSException('getref not supported for this vcs type')
|
raise VCSException('getref not supported for this vcs type')
|
||||||
|
|
||||||
@ -1205,6 +1205,15 @@ class vcs_git(vcs):
|
|||||||
tags.append(tag)
|
tags.append(tag)
|
||||||
return tags
|
return tags
|
||||||
|
|
||||||
|
def getref(self, revname='HEAD'):
|
||||||
|
self.checkrepo()
|
||||||
|
p = FDroidPopen(['git', 'rev-parse', '--verify',
|
||||||
|
'{revname}^{{commit}}'.format(revname=revname)], cwd=self.local,
|
||||||
|
output=False)
|
||||||
|
if p.returncode != 0:
|
||||||
|
return None
|
||||||
|
return p.output.strip()
|
||||||
|
|
||||||
|
|
||||||
class vcs_gitsvn(vcs):
|
class vcs_gitsvn(vcs):
|
||||||
|
|
||||||
@ -1366,9 +1375,9 @@ class vcs_gitsvn(vcs):
|
|||||||
if os.path.isdir(d):
|
if os.path.isdir(d):
|
||||||
return os.listdir(d)
|
return os.listdir(d)
|
||||||
|
|
||||||
def getref(self):
|
def getref(self, revname='HEAD'):
|
||||||
self.checkrepo()
|
self.checkrepo()
|
||||||
p = FDroidPopen(['git', 'svn', 'find-rev', 'HEAD'], cwd=self.local, output=False)
|
p = FDroidPopen(['git', 'svn', 'find-rev', revname], cwd=self.local, output=False)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
return None
|
return None
|
||||||
return p.output.strip()
|
return p.output.strip()
|
||||||
|
Loading…
Reference in New Issue
Block a user