#!/usr/bin/env python # usage update.py # currently it only checks for first line of the commit message # which should look like e.g # uclibc: import sys,os from subprocess import * oldrev = sys.argv[1] newrev = sys.argv[2] user = os.getenv('USER') def ErrorOut(message): print "Please reformat the message per guidelines on http://wiki.openembedded.org/index.php/Commit_Policy" print "A sample is at http://wiki.openembedded.org/index.php/Commit_log_example" print "\nFaulty Commit Message:\n\n ", message sys.exit(1) p = os.popen("git rev-list %s...%s" %(oldrev, newrev)) missed_revs = p.read() for r in missed_revs.split(): m1 = Popen(["git", "cat-file", "commit", r],stdout=PIPE) m2 = Popen(["sed", "1,/^$/d"], stdin=m1.stdout, stdout=PIPE) rev = m2.communicate()[0] first_word = rev.split()[0]; if first_word[-1] is ':': print "Your message is not formatted according to commit poilicy" ErrorOut(rev) summary = rev.split(1) if summary is "": print "Commit Message does not have summary line" ErrorOut(rev)