Changed syncmail script to only print urls.

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1301 379699f6-c40d-0410-875b-85095c16579e
master
hoenicke 24 years ago
parent e3e58de150
commit 5a22174883
  1. 37
      CVSROOT/syncmail

@ -116,21 +116,44 @@ def calculate_diff(filespec):
'[...%d lines suppressed...]\n' % removedlines) '[...%d lines suppressed...]\n' % removedlines)
return string.join(lines, '') return string.join(lines, '')
def calculate_url(dir, filespec):
try:
file, oldrev, newrev = string.split(filespec, ',')
except ValueError:
# No diff to report
return '***** Bogus filespec: %s' % filespec
if oldrev == 'NONE':
try:
lines = [ 'http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/%s/%s?cvsroot=jode&rev=%s' % (dir, file, newrev) ]
except IOError, e:
lines = ['***** Error reading new file: ',
str(e), '\n***** file: ', file, ' cwd: ', os.getcwd()]
elif newrev == 'NONE':
lines = [ 'DELETED: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/%s/%s?cvsroot=jode&rev=%s' % (dir, file, oldrev) ]
else:
# This /has/ to happen in the background, otherwise we'll run into CVS
# lock contention. What a crock.
lines = [ 'http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/%s/%s.diff?cvsroot=jode&r1=%s&r2=%s&f=u' % (dir, file, oldrev, newrev) ]
return string.join(lines, '')
def blast_mail(mailcmd, filestodiff): def blast_mail(mailcmd, dir, filestodiff):
# cannot wait for child process or that will cause parent to retain cvs ## cannot wait for child process or that will cause parent to retain cvs
# lock for too long. Urg! ## lock for too long. Urg!
if not os.fork(): #if not os.fork():
# in the child # in the child
# give up the lock you cvs thang! # give up the lock you cvs thang!
time.sleep(2) time.sleep(2)
fp = os.popen(mailcmd, 'w') fp = os.popen(mailcmd, 'w')
fp.write(sys.stdin.read()) fp.write(sys.stdin.read())
fp.write('\n') fp.write('\n')
# append the diffs if available # append the cvsweb urls if available
fp.write('CVSWeb URLs:');
for file in filestodiff: for file in filestodiff:
fp.write(calculate_diff(file)) # fp.write(calculate_diff(file))
fp.write(calculate_url(dir, file))
fp.write('\n') fp.write('\n')
fp.close() fp.close()
# doesn't matter what code we return, it isn't waited on # doesn't matter what code we return, it isn't waited on
@ -176,7 +199,7 @@ def main():
if specs[-3:] == ['-', 'New', 'directory']: if specs[-3:] == ['-', 'New', 'directory']:
del specs[-3:] del specs[-3:]
print 'Generating notification message...' print 'Generating notification message...'
blast_mail(mailcmd, specs[1:]) blast_mail(mailcmd, specs[0], specs[1:])
print 'Generating notification message... done.' print 'Generating notification message... done.'

Loading…
Cancel
Save