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