Adrian Schröter
6e55d7df19
- add new 'versionformat' option to determine how version is extracted via git show --pretty=... (and similar for svn / hg / bzr) - support caching of cloned repositories to speed up fetch from upstream - use mktemp -u because git/hg refuse to clone into an empty directory on SLES11 OBS-URL: https://build.opensuse.org/request/show/105386 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-tar_scm?expand=0&rev=33
39 lines
1.5 KiB
Python
39 lines
1.5 KiB
Python
#!/usr/bin/python
|
|
|
|
import os
|
|
|
|
from commontests import CommonTests
|
|
from utils import run_hg
|
|
|
|
class GitHgTests(CommonTests):
|
|
mixed_version_template = '%s.master.%s'
|
|
|
|
def test_versionformat_abbrevhash(self):
|
|
self.tar_scm_std('--versionformat', self.abbrev_hash_format)
|
|
self.assertTarOnly(self.basename(version = self.sha1s(self.rev(2))))
|
|
|
|
def test_versionformat_timestamp(self):
|
|
self.tar_scm_std('--versionformat', self.timestamp_format)
|
|
self.assertTarOnly(self.basename(version = self.timestamps(self.rev(2))))
|
|
|
|
def _mixed_version_format(self):
|
|
return self.mixed_version_template % (self.timestamp_format, self.abbrev_hash_format)
|
|
|
|
def _mixed_version(self):
|
|
return self.mixed_version_template % (self.timestamps(self.rev(2)), self.sha1s(self.rev(2)))
|
|
|
|
def test_versionformat_mixed(self):
|
|
self.tar_scm_std('--versionformat', self._mixed_version_format())
|
|
self.assertTarOnly(self.basename(version = self._mixed_version()))
|
|
|
|
def test_version_versionformat(self):
|
|
self.tar_scm_std('--version', '3.0', '--versionformat', self._mixed_version_format())
|
|
self.assertTarOnly(self.basename(version = self._mixed_version()))
|
|
|
|
def test_versionformat_revision(self):
|
|
self.fixtures.create_commits(4)
|
|
self.tar_scm_std('--versionformat', self.abbrev_hash_format, '--revision', self.rev(2))
|
|
basename = self.basename(version = self.sha1s(self.rev(2)))
|
|
th = self.assertTarOnly(basename)
|
|
self.assertTarMemberContains(th, basename + '/a', '2')
|