mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-19 21:30:10 +01:00
Use git tag in latesttags
This commit is contained in:
parent
89762f4d48
commit
2de3431296
@ -1171,18 +1171,11 @@ class vcs_git(vcs):
|
|||||||
p = FDroidPopen(['git', 'tag'], cwd=self.local, output=False)
|
p = FDroidPopen(['git', 'tag'], cwd=self.local, output=False)
|
||||||
return p.output.splitlines()
|
return p.output.splitlines()
|
||||||
|
|
||||||
tag_format = re.compile(r'tag: ([^),]*)')
|
|
||||||
|
|
||||||
def latesttags(self):
|
def latesttags(self):
|
||||||
self.checkrepo()
|
self.checkrepo()
|
||||||
p = FDroidPopen(['git', 'log', '--tags',
|
p = FDroidPopen(['git', 'tag', '--sort=-authordate'],
|
||||||
'--simplify-by-decoration', '--pretty=format:%d'],
|
|
||||||
cwd=self.local, output=False)
|
cwd=self.local, output=False)
|
||||||
tags = []
|
return p.output.splitlines()
|
||||||
for line in p.output.splitlines():
|
|
||||||
for tag in self.tag_format.findall(line):
|
|
||||||
tags.append(tag)
|
|
||||||
return tags
|
|
||||||
|
|
||||||
|
|
||||||
class vcs_gitsvn(vcs):
|
class vcs_gitsvn(vcs):
|
||||||
|
@ -2059,6 +2059,19 @@ class CommonTest(unittest.TestCase):
|
|||||||
{'r10e': r10e, 'r17c': ndk_bundle, 'r21e': r21e}, config['ndk_paths']
|
{'r10e': r10e, 'r17c': ndk_bundle, 'r21e': r21e}, config['ndk_paths']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_vcs_git_latesttags(self):
|
||||||
|
vcs = fdroidserver.common.vcs_git(None, None)
|
||||||
|
popenmock = mock.Mock()
|
||||||
|
popenmock.output = "8.9.5\n8.9.4\n8.6.3\n8,9,3"
|
||||||
|
with mock.patch(
|
||||||
|
'fdroidserver.common.FDroidPopen', lambda a, **b: popenmock
|
||||||
|
) as _ignored, mock.patch(
|
||||||
|
'fdroidserver.common.vcs_git.checkrepo'
|
||||||
|
) as _ignored:
|
||||||
|
_ignored # silence the linters
|
||||||
|
tags = vcs.latesttags()
|
||||||
|
self.assertEqual(tags, ['8.9.5', '8.9.4', '8.6.3', '8,9,3'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
os.chdir(os.path.dirname(__file__))
|
os.chdir(os.path.dirname(__file__))
|
||||||
|
Loading…
Reference in New Issue
Block a user