diff options
author | Valentin David <valentin.david@codethink.co.uk> | 2018-10-26 16:38:53 +0200 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-12-05 18:47:52 +0900 |
commit | 8251310950e72f18c2d171de375051fb0e126655 (patch) | |
tree | f76c349c7c06825a0813ccb3cdc54861262db7e0 /tests/testutils | |
parent | 5d77b871a343c8a196569ab17fd5e4f04bb6baec (diff) | |
download | buildstream-8251310950e72f18c2d171de375051fb0e126655.tar.gz |
git source plugin: Track git tags and save them to reproduce a minimum shallow repository
Instead of tag information being fetched which can change with time,
they are tracked and saved in the projects.refs/.bst. Then we re-tag
automatically the closest tag so that `git describe` works and is
reproducible.
This new feature is opt-in with the new `track-tags` configuration,
and must be used to fix modules which are broken by our new policy
of omitting the `.git/` repository when staging git sources.
This fixes issue #487
Diffstat (limited to 'tests/testutils')
-rw-r--r-- | tests/testutils/repo/git.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/testutils/repo/git.py b/tests/testutils/repo/git.py index bc2dae691..fe3ebd547 100644 --- a/tests/testutils/repo/git.py +++ b/tests/testutils/repo/git.py @@ -45,6 +45,9 @@ class Git(Repo): def add_tag(self, tag): self._run_git('tag', tag) + def add_annotated_tag(self, tag, message): + self._run_git('tag', '-a', tag, '-m', message) + def add_commit(self): self._run_git('commit', '--allow-empty', '-m', 'Additional commit') return self.latest_commit() @@ -95,3 +98,14 @@ class Git(Repo): def branch(self, branch_name): self._run_git('checkout', '-b', branch_name) + + def checkout(self, commit): + self._run_git('checkout', commit) + + def merge(self, commit): + self._run_git('merge', '-m', 'Merge', commit) + return self.latest_commit() + + def rev_parse(self, rev): + output = self._run_git('rev-parse', rev, stdout=subprocess.PIPE).stdout + return output.decode('UTF-8').strip() |