All of lore.kernel.org
 help / color / mirror / Atom feed
* update hook for git to check push commit message
@ 2010-01-28 20:00 Khem Raj
  2010-01-28 21:52 ` Phil Blundell
  2010-01-28 22:59 ` Tom Rini
  0 siblings, 2 replies; 10+ messages in thread
From: Khem Raj @ 2010-01-28 20:00 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]

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



[-- Attachment #2: update.py --]
[-- Type: text/x-python, Size: 1127 bytes --]

#!/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)

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-01-29  9:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-28 20:00 update hook for git to check push commit message Khem Raj
2010-01-28 21:52 ` Phil Blundell
2010-01-28 22:01   ` Frans Meulenbroeks
2010-01-29  0:26     ` Paul Menzel
2010-01-29  1:30   ` Khem Raj
2010-01-28 22:59 ` Tom Rini
2010-01-28 23:22   ` Chris Larson
2010-01-29  0:10     ` Tom Rini
2010-01-29  8:21     ` Jens Seidel
2010-01-29  9:15       ` Martin Jansa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.