These days, most of my attempts to do anonymous checkouts or updates from SF.net's CVS repositories result in timeouts. For projects I'm a member of, I can use my account, but for others I just have to keep trying until an attempt doesn't timeout. After getting sick of doing that, I wrote a little script to do it for me.
The script below keeps trying to update until it's successful. After each failed attempt, it pauses for 5 seconds before trying again.
#!/usr/bin/env python
import os, sys, time
DEFAULT_CVS_ARGS = '-z9 -q up -dP'
SLEEP = 5 # seconds
def main(args=None):
if args is None:
args = sys.argv
cvs_args = ' '.join(args[1:])
if not cvs_args:
cvs_args = DEFAULT_CVS_ARGS
cmd = 'cvs %s' % cvs_args
print 'running %s...' % cmd
while 1:
r = os.system(cmd)
if not r:
break
for i in range(SLEEP):
time.sleep(1)
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
pass
# :indentSize=4:lineSeparator=\n:noTabs=true:tabSize=4:
Here's what it looks like running:
C:\sandbox\ctypes>cvsup running cvs -z9 -q up -dP... cvs [update aborted]: Error reading from server cvs.sourceforge.net: -1 cvs [update aborted]: Error reading from server cvs.sourceforge.net: 0 cvs [update aborted]: Error reading from server cvs.sourceforge.net: 0 cvs [update aborted]: Error reading from server cvs.sourceforge.net: 0 cvs [update aborted]: Error reading from server cvs.sourceforge.net: -1 cvs [update aborted]: Error reading from server cvs.sourceforge.net: 0 cvs [update aborted]: Error reading from server cvs.sourceforge.net: 0 cvs [update aborted]: Error reading from server cvs.sourceforge.net: 0 cvs [update aborted]: Error reading from server cvs.sourceforge.net: -1 cvs [update aborted]: Error reading from server cvs.sourceforge.net: 0 P setup.py M samples/Windows/FindFile.py M samples/Windows/wtl/readme.txt P source/_ctypes.c P source/callproc.c P source/ctypes.h P win32/com/register.py P win32/com/server.py P win32/com/samples/server/test_w32.py P win32/com/tools/readtlb.py C:\sandbox\ctypes>
Saved Monday, June 23, 2003 at 10:45 AM
View June, 2003, latest entries, or archive <../../../archive.html>