diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-09-14 18:46:27 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-09-14 21:11:31 +0900 |
commit | 354efc50288b383e29307f11bbdf23a1d19e5e4a (patch) | |
tree | 51fdbe34f471cc5b8224ccaa14933f224b5cbb28 /tests | |
parent | fe98e5cb5120db42bba40d3aecc593e8198e0254 (diff) | |
download | buildstream-354efc50288b383e29307f11bbdf23a1d19e5e4a.tar.gz |
testutils/repo/git.py: Added modify_file() method
This allows one to modify a file in an existing git repo,
as opposed to adding a new one.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testutils/repo/git.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/testutils/repo/git.py b/tests/testutils/repo/git.py index eea43d608..75624d597 100644 --- a/tests/testutils/repo/git.py +++ b/tests/testutils/repo/git.py @@ -46,6 +46,13 @@ class Git(Repo): ], env=GIT_ENV, cwd=self.repo) return self.latest_commit() + def modify_file(self, new_file, path): + shutil.copy(new_file, os.path.join(self.repo, path)) + subprocess.call([ + 'git', 'commit', path, '-m', 'Modified {}'.format(os.path.basename(path)) + ], env=GIT_ENV, cwd=self.repo) + return self.latest_commit() + def add_submodule(self, subdir, url=None, checkout=None): submodule = {} if checkout is not None: |