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