[cig-commits] commit: Putting a check in this script to prevent it from doing os operations on directories that potentially don't exist. (eg. Experimental)

Mercurial hg at geodynamics.org
Mon Feb 1 15:30:16 PST 2010


changeset:   222:864074fa6dfd
branch:      1.4.x
user:        JulianGiordani
date:        Tue Jan 05 16:25:05 2010 +1100
files:       updateRepos.py
description:
Putting a check in this script to prevent it from doing os operations on directories that potentially don't exist. (eg. Experimental)


diff -r 814cc1c4f5fc -r 864074fa6dfd updateRepos.py
--- a/updateRepos.py	Tue Jan 05 13:04:38 2010 +1100
+++ b/updateRepos.py	Tue Jan 05 16:25:05 2010 +1100
@@ -20,17 +20,20 @@ cwd = os.getcwd()
 
 # check if there are 
 if len(sys.argv) != 2:
-	print "ERROR - must supply one argument only (the branch name), currently\n" 
-	print sys.argv
-	print "\nExample usage: ./updateRepos.py v1.3.x\n\n"
-	sys.exit()
+   print "ERROR - must supply one argument only (the branch name), currently\n" 
+   print sys.argv
+   print "\nExample usage: ./updateRepos.py v1.3.x\n\n"
+   sys.exit()
 
 for dep in deps:
-	os.chdir(cwd + "/" + dep)
-# get the branch name
-	branch = os.popen('hg branch').readlines()
-	branch = branch[0].replace("\n","")
-# check branch
-	os.system("hg up -C " + sys.argv[1])
-	print "updating " + dep + " to branch " + sys.argv[1]
+   if not os.path.exists(cwd + "/" + dep ):
+      continue
 
+   os.chdir(cwd + "/" + dep)
+   # get the branch name
+   branch = os.popen('hg branch').readlines()
+   branch = branch[0].replace("\n","")
+   # check branch
+   os.system("hg up -C " + sys.argv[1])
+   print "updating " + dep + " to branch " + sys.argv[1]
+



More information about the CIG-COMMITS mailing list