diff --git a/tools/post-receive b/tools/post-receive index 5ed8c8893e..063ce5c5c5 100755 --- a/tools/post-receive +++ b/tools/post-receive @@ -19,9 +19,23 @@ import subprocess sys.path.append(os.path.dirname(os.path.dirname(os.readlink(__file__)))) import api.common client = api.common.HumbugAPI(email="humbug+commits@humbughq.com", - api_key=options.api_key, - verbose=False, - site=options.site) + api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + verbose=False) + +def check_output(*popenargs, **kwargs): + if 'stdout' in kwargs: + raise ValueError('stdout argument not allowed, it will be overridden.') + process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs) + output, unused_err = process.communicate() + retcode = process.poll() + if retcode: + cmd = kwargs.get("args") + if cmd is None: + cmd = popenargs[0] + raise subprocess.CalledProcessError(retcode, cmd, output=output) + return output + +subprocess.check_output = check_output args = sys.stdin.read() oldrev, newrev, refname = args.split() @@ -30,12 +44,12 @@ if refname in ["refs/heads/master", "refs/heads/test-post-receive"]: subprocess.check_call(["ssh", "app.humbughq.com", "--", "env", "-u", "GIT_DIR", "/home/humbug/humbug/tools/update-deployment", oldrev, newrev, refname]) - commits = subprocess.check_output(["git", "log", "--pretty=%s", "%s..%s" % (oldrev, newrev)]) + commits = subprocess.check_output(["git", "log", "--pretty=- %s", "%s..%s" % (oldrev, newrev)]) message_data = { "type": "class", "class": "devel", "instance": "commits", - "content": "Commit %s pushed to %s! Commits include:\n" % (newrev, refname) + commits, + "content": "The following commits were just pushed to %s:\n\n" % (refname.replace("refs/heads/", ""),) + commits, "recipient": "tabbott@humbughq.com", } client.send_message(message_data)