You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:49:43 UTC

[buildstream] 05/13: repo/git.py: Add optional date argument to add_commit

This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch tmewett/merge-git-tag
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit c3f1a1f0c6eab12491634a78b9209e5aa0d79155
Author: Tom Mewett <to...@codethink.co.uk>
AuthorDate: Thu Jan 9 14:00:04 2020 +0000

    repo/git.py: Add optional date argument to add_commit
---
 tests/testutils/repo/git.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/testutils/repo/git.py b/tests/testutils/repo/git.py
index 1deca3f..779eb76 100644
--- a/tests/testutils/repo/git.py
+++ b/tests/testutils/repo/git.py
@@ -42,8 +42,11 @@ class Git(Repo):
     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")
+    def add_commit(self, date=None):
+        env = self.env
+        if date is not None:
+            env["GIT_AUTHOR_DATE"] = env["GIT_COMMITTER_DATE"] = str(date)
+        self._run_git("commit", "--allow-empty", "-m", "Additional commit", env=env)
         return self.latest_commit()
 
     def add_file(self, filename):