[cig-commits] commit: Specific to VPAC-CSD derived stuff... script to build up the "virtual"

Mercurial hg at geodynamics.org
Mon Nov 24 11:27:19 PST 2008


changeset:   84:7412e17d383e
user:        steve at SteveNb.unknownNetwork
date:        Wed Apr 23 15:48:39 2008 +1000
files:       obtainRepositories.py
description:
Specific to VPAC-CSD derived stuff... script to build up the "virtual"
repositories. To be copied and implemented per virtual repository


diff -r 715440e45bf4 -r 7412e17d383e obtainRepositories.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/obtainRepositories.py	Wed Apr 23 15:48:39 2008 +1000
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+
+from mercurial import hg, ui, util
+import urllib2
+import ConfigParser
+import os, errno
+
+deps = [ \
+	['https://csd.vpac.org/hg/hgforest', '.hg/forest' ], \
+# Add actual deps here... for e.g:
+#	['http://localhost/hg/test-repository1', 'test-repository1' ], \
+#	['https://csd.vpac.org/hg/StGermain', 'StGermain' ] ]
+
+# Make sure the '.hg' directory exists
+try:
+	os.mkdir('.hg')
+except OSError, e:
+	if( e.errno != errno.EEXIST ):
+		raise OSError( e )  # if the error is the directory exists already, keep going
+
+
+# Download the dependancies...
+u = ui.ui()
+for dep in deps:
+	try:
+		print dep[1], '...'
+		hg.clone( u, dep[0], dep[1] );
+	except util.Abort, e:
+		c = ConfigParser.ConfigParser()
+		try:
+			c.readfp( open( dep[1] + '/.hg/hgrc', 'r' ) )
+			if( c.get( 'paths', 'default' ) != dep[0] ):
+				print 'Creation failed - ', e, ' but points to another repository'
+			else:
+				print dep[1], 'already present'
+		except:
+			print 'Creation failed - ', e, ' and does not seem to be a valid repository'
+	except urllib2.URLError, e:
+		print 'Download failed - ', e
+
+# Tell this root repository that its has forest
+c=ConfigParser.ConfigParser()
+c.read('.hg/hgrc')
+try:
+	c.add_section('Extensions')
+except ConfigParser.DuplicateSectionError:
+	pass    # If the error is that it exists already, keep going
+c.set( 'Extensions', 'hgext.forest', 'forest/forest.py' )
+c.write( open( '.hg/hgrc', 'w' ) )
+



More information about the CIG-COMMITS mailing list