From: Khem Raj <raj.khem@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: update hook for git to check push commit message
Date: Thu, 28 Jan 2010 12:00:49 -0800 [thread overview]
Message-ID: <20100128200049.GA4958@gmail.com> (raw)
[-- 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)
next reply other threads:[~2010-01-28 20:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-28 20:00 Khem Raj [this message]
2010-01-28 21:52 ` update hook for git to check push commit message 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100128200049.GA4958@gmail.com \
--to=raj.khem@gmail.com \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox