[Python-Dev] Re: [Python-checkins] CVS: python/nondist/peps pep-0228.txt,NONE,1.1 pep-0000.txt,1.44,1.45
Thomas Wouters
thomas@xs4all.net
Sun, 5 Nov 2000 23:29:21 +0100
On Sun, Nov 05, 2000 at 11:12:35PM +0100, Thomas Wouters wrote:
> In the mean time, I'll check in my change. It might be the best thing to
> do anyway, since it shouldn't interfere unless the file isn't there.
Since changes to files in CVSROOT go to python-checkins-admin rather than
python-checkins, here's the diff I just checked in:
Index: syncmail
===================================================================
RCS file: /cvsroot/python/CVSROOT/syncmail,v
retrieving revision 3.14
retrieving revision 3.15
diff -c -c -r3.14 -r3.15
*** syncmail 2000/11/02 21:44:32 3.14
--- syncmail 2000/11/05 22:24:29 3.15
***************
*** 85,91 ****
return '***** Bogus filespec: %s' % filespec
if oldrev == 'NONE':
try:
! fp = open(file)
lines = fp.readlines()
fp.close()
lines.insert(0, '--- NEW FILE ---\n')
--- 85,95 ----
return '***** Bogus filespec: %s' % filespec
if oldrev == 'NONE':
try:
! if os.path.exists(file):
! fp = open(file)
! else:
! update_cmd = 'cvs -fn update -r %s -p %s' % (newrev, file)
! fp = os.popen(update_cmd)
lines = fp.readlines()
fp.close()
lines.insert(0, '--- NEW FILE ---\n')
See the manpage for 'cvs' for an explanation of the options ;) This should
fix 99.95% or so of the problem (there is still a tiny window for the file
being removed inbetween the os.path.exists and the actual open) and is
probably best even if we do remove the fork() from syncmail.
--
Thomas Wouters <thomas@xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!