##// END OF EJS Templates
Added new little utility for wrapping svn commits with email notifications,...
fperez -
r7:ee902204
parent child
Show More
@@ -0,0 +1,69
1 #!/usr/bin/env python
2 """Simple svn commit wrapper which emails a given list of people.
3
4 Usage:
5
6 ipsvnc [args]
7
8 This is equivalent to doing
9
10 svn commit [args]
11
12 If the commit operation is successful (the script asks for confirmation), a
13 hardwired list of maintainers is informed of the commit.
14
15 This is a poor-man's substitute for a proper svn post-commit hook with an
16 ipython-svn email list, which we're waiting to get soon. It should be removed
17 once that facility is in place.
18
19 This only works on a unix box which can send mail by itself."""
20
21 import os
22 import commands
23 import sys
24 import time
25
26 # Package maintainers to be alerted
27 maintainers = ['fperez@colorado.edu', 'rkern@ucsd.edu', 'antont@an.org',
28 'tsanko@gmail.com']
29
30 #maintainers = ['fperez@colorado.edu'] # dbg
31
32 # Assemble command line back, before passing it to svn
33 svnargs = []
34 for arg in sys.argv[1:]:
35 if ' ' in arg:
36 svnargs.append('"%s"' % arg)
37 else:
38 svnargs.append(arg)
39 svnargs = ' '.join(svnargs)
40
41 #print 'SVN args: <%s>' % svnargs; sys.exit() # dbg
42
43 # perform commit
44 os.system('svn commit %s' % svnargs)
45 svntime = time.asctime()
46 svnstatus = commands.getoutput('svn log -r COMMITTED')
47
48 # Confirm with user (trying to get the status from the svn commit blocks
49 # silently, I don't care to debug it)
50 ans = raw_input('If commit was succesful, proceed with email notification? [Y/n]')
51 if ans.lower().startswith('n'):
52 print "Exiting now..."
53 sys.exit(1)
54 else:
55 print "OK. Emailing maintainers..."
56
57 # Send emails
58 subject = "[IPython SVN] New commit performed by %s" % os.getlogin()
59 body = """\
60 Commit performed at: %s
61
62 SVN arguments used: %s
63
64 Current SVN status after last commit:
65 %s""" % (svntime,svnargs,svnstatus)
66
67 for maint in maintainers:
68 print "Emailing",maint
69 os.system('echo "%s" | mail -s "%s" %s' % (body, subject,maint))
General Comments 0
You need to be logged in to leave comments. Login now