import os import sys # for reference, here's v3: # https://svn.dev.java.net/svn/glassfish-svn/trunk/v3 if len(sys.argv) != 2: exit('usage: pyton svngetter ') checkoutworked = False updatecount = 0 wsloc = sys.argv[1] if wsloc.endswith('/'): wsloc = wsloc[0:-1] # try to check out svncocommand = 'svn co ' + wsloc print 'running:', svncocommand res = os.system(svncocommand) if res == 0: checkoutworked = True # now update and update and update targetdir = wsloc.split('/')[-1] if not os.path.exists(targetdir): exit("Checkout really failed. Can't find: " + targetdir) svnupcommand = 'svn up ' + targetdir print 'running:', svnupcommand while True: updatecount = updatecount + 1 res = os.system(svnupcommand) if res == 0: break # print results print 'Checkout worked:', checkoutworked print 'Number of updates:', updatecount