diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-26 00:22:01 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-26 00:22:01 (GMT) |
commit | 9c6636a761d2bc627e744e6b0efc45cc7672c485 (patch) | |
tree | 9140286204564cc901ef645caeac3155e0fd2b19 /devbot/utils.py | |
parent | 15980e294fcb70ce8e04efb198b26f66c4241ecb (diff) |
On run check the system only if something changed
Diffstat (limited to 'devbot/utils.py')
-rw-r--r-- | devbot/utils.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/devbot/utils.py b/devbot/utils.py new file mode 100644 index 0000000..2864948 --- /dev/null +++ b/devbot/utils.py @@ -0,0 +1,18 @@ +import os +import subprocess + +devnull = open("/dev/null", "w") + +def get_commit_id(dir): + orig_cwd = os.getcwd() + os.chdir(dir) + + try: + commit_id = subprocess.check_output(["git", "rev-parse", "HEAD"], + stderr=devnull).strip() + except subprocess.CalledProcessError: + commit_id = None + + os.chdir(orig_cwd) + + return commit_id |