From 9c6636a761d2bc627e744e6b0efc45cc7672c485 Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Mon, 26 Nov 2012 00:22:01 +0000 Subject: On run check the system only if something changed --- (limited to 'devbot/utils.py') 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 -- cgit v0.9.1