summaryrefslogtreecommitdiff
path: root/client/utils/git.py
diff options
context:
space:
mode:
authorMark Wong2018-07-18 00:10:17 +0000
committerMark Wong2018-07-18 00:10:17 +0000
commit611e28c6a76b0c43def17fc2cefffbe2c4ea2357 (patch)
tree89d0a13be617d171bac5b99dcdfd59d1627aa3ff /client/utils/git.py
parentdb094c62bbdd024127a399547f62c7ecda073bfd (diff)
Save postgres branch, commit, and settings in results json
Diffstat (limited to 'client/utils/git.py')
-rw-r--r--client/utils/git.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/client/utils/git.py b/client/utils/git.py
index d380d7f..abef886 100644
--- a/client/utils/git.py
+++ b/client/utils/git.py
@@ -40,6 +40,15 @@ class GitRepository(object):
with TemporaryFile() as strout:
call(['git', 'pull'], cwd=self._path, stdout=strout, stderr=STDOUT)
+ def current_branch(self):
+ 'returns current branch'
+
+ with TemporaryFile() as strout:
+ call(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], cwd=self._path,
+ stdout=strout, stderr=STDOUT)
+ strout.seek(0)
+ return strout.read().strip()
+
def current_commit(self):
'returns current commit hash'
@@ -57,6 +66,7 @@ class GitRepository(object):
else:
self._clone()
+ log("current branch '%s'" % (self.current_branch(),))
log("current commit '%s'" % (self.current_commit(),))
def build_and_install(self, path, remove=True):