Henri Sivonen committed 7317a6a

Change the build script to pull from hg instead of svn.

Comments (0)

Files changed (1)

 hgCmd = 'hg'
 buildRoot = '.'
-svnRoot = ''
+hgRoot = ''
+parserHgRoot = ''
 portNumber = '8888'
 controlPort = None
 useAjp = 0
+def hgCloneOrUpdate(mod, baseUrl):
+  if os.path.exists(mod):
+    if os.path.exists(mod + "/.hg"):
+      runCmd('"%s" pull --update -R %s %s%s/' % (hgCmd, mod, baseUrl, mod))
+    else:
+      if os.path.exists(mod + "-old"):
+        print "The %s module has moved to hg. Can't proceed automatically, because %s-old exists. Please remove it." % (mod, mod)
+        sys.exit(3)
+      else:
+        print "The %s module has moved to hg. Renaming the old directory to %s-old and pulling from hg." % (mod, mod)
+        os.rename(mod, mod + "-old")
+        runCmd('"%s" clone %s%s/ %s' % (hgCmd, baseUrl, mod, mod))
+  else:
+    runCmd('"%s" clone %s%s/ %s' % (hgCmd, baseUrl, mod, mod))
 def checkout():
   # XXX root dir
   for mod in moduleNames:
-    runCmd('"%s" co "%s" "%s"' % (svnCmd, svnRoot + mod + '/trunk/', mod))
+    hgCloneOrUpdate(mod, hgRoot)
   runCmd('"%s" co jing-trang' % (svnCmd))
-  if os.path.exists("htmlparser"):
-    if os.path.exists("htmlparser/.hg"):
-      runCmd('"%s" pull --update -R htmlparser' % (hgCmd))
-    else:
-      print "The htmlparser module has moved to hg. Please back up local changes (if any) and remove the htmlparser directory."
-      sys.exit(3)
-  else:
-    runCmd('"%s" clone htmlparser' % (hgCmd))
+  hgCloneOrUpdate("htmlparser", parserHgRoot)
 def selfUpdate():
-  runCmd('"%s" co "%s" "%s"' % (svnCmd, svnRoot + 'build' + '/trunk/', 'build'))
+  hgCloneOrUpdate("build", hgRoot)
   newArgv = [sys.executable, buildScript, '--no-self-update']
   if == 'nt':
       jarCmd = os.path.join(jdkBinDir, "jar")
       javacCmd = os.path.join(jdkBinDir, "javac")
       javadocCmd = os.path.join(jdkBinDir, "javadoc")
-    elif arg.startswith("--svnRoot="):
-      svnRoot = arg[10:]
+    elif arg.startswith("--hgRoot="):
+      hgRoot = arg[9:]
+    elif arg.startswith("--parserHgRoot="):
+      parserHgRoot = arg[15:]
     elif arg.startswith("--port="):
       portNumber = arg[7:]
     elif arg.startswith("--control-port="):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.