CVSROOT syncmail,1.1,1.2
Elliot Lee (sopwith)
fedora-extras-commits at redhat.com
Thu Dec 8 21:35:28 UTC 2005
Author: sopwith
Update of /cvs/devel/CVSROOT
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22492/CVSROOT-ext-devel
Modified Files:
syncmail
Log Message:
fix syncmail
Index: syncmail
===================================================================
RCS file: /cvs/devel/CVSROOT/syncmail,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- syncmail 22 Apr 2005 22:42:19 -0000 1.1
+++ syncmail 8 Dec 2005 21:35:26 -0000 1.2
@@ -5,6 +5,7 @@
# check out the CVSROOT directory on your local machine,
# make the changes there and commit. Otherwise your changes
# will be lost. --gafton
+# - updated by sopwith to add a --require-keyword option that only sends mail if 'keyword' is found in the comment message
#
# - updated by gafton to allow for --nodiff option. The nodiff option
# still sends out messages when something changes in a directory, but
@@ -62,6 +63,9 @@
Use <path> as the environment variable CVSROOT. Otherwise this
variable must exist in the environment.
+ --require-keyword=STRING
+ Only send mail if STRING is found in the commit message.
+
--nodiff
Don't bother generating the full diff, just report if the files changed
or not.
@@ -183,7 +187,7 @@
return string.join(lines, '')
# send mail using sendmail
-def blast_mail(subject, people):
+def blast_mail(subject, people):
global optDiffStat
# the redirection sequence in this command is actually intentional
@@ -198,7 +202,11 @@
del diff_files[-3:]
if diff_files[-3:] == ['-', 'Imported', 'sources']:
del diff_files[-3:]
-
+ commit_message = sys.stdin.read()
+ for I in optRequireKeyword:
+ if commit_message.find(I) < 0:
+ return
+
# cannot wait for child process or that will cause parent to retain cvs
# lock for too long. Urg!
if not os.fork(): # in the child
@@ -220,7 +228,7 @@
fp.write("\n")
fp.write("Author: %s\n\n" % (username,))
# now insert the CVS blurb
- fp.write(sys.stdin.read())
+ fp.write(commit_message)
fp.write('\n')
# append the diffs if available and sensible
graphics = re.compile(r".*\.(jp(e)?g|gif|png|tif(f)?),", re.IGNORECASE)
@@ -246,14 +254,16 @@
global DIFF_HEAD_LINES
global DIFF_TAIL_LINES
global DIFF_TRUNCATE_IF_LARGER
+ global optRequireKeyword
try:
opts, args = getopt.getopt(sys.argv[1:], 'h', [
'cvsroot=', 'quiet', 'nodiff', 'nodiffstat', 'help',
- 'headlines=', 'taillines=', 'truncate='])
+ 'headlines=', 'taillines=', 'truncate=', 'require-keyword='])
except getopt.error, msg:
usage(1, msg)
+ optRequireKeyword = []
# parse the options
for opt, arg in opts:
if opt in ('-h', '--help'):
@@ -269,12 +279,14 @@
optDiffStat = 0
elif opt == '--nodiffstat':
optDiffStat = 0
- elif opt == 'headlines=':
+ elif opt == '--headlines':
DIFF_HEAD_LINES = arg
- elif opt == 'taillines=':
+ elif opt == '--taillines':
DIFF_TAIL_LINES = arg
- elif opt == 'truncate=':
+ elif opt == '--truncate':
DIFF_TRUNCATE_IF_LARGER = arg
+ elif opt == '--require-keyword':
+ optRequireKeyword.append(arg)
# What follows is the specification containing the files that were
# modified. The argument actually must be split, with the first component
More information about the scm-commits
mailing list