Hi

Attached is a small hook for updates that are pushed into repo.
Right now it only checks the first line of the commit and expects
module: summary

I have not tested it at all

Comments ?

Thanks
-Khem


#!/usr/bin/env python
# usage update.py <oldrev> <newrev>
# currently it only checks for first line of the commit message
# which should look like e.g
# uclibc: <pretty summary>

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)
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

Reply via email to