[cig-commits] commit: Adding these guys from stgUnderworldE.
Mercurial
hg at geodynamics.org
Mon Feb 1 15:29:48 PST 2010
changeset: 193:1d0be4083c7d
user: JericoRevote
date: Fri Nov 27 13:17:01 2009 +1100
files: bittenObtain.py identify-all.sh makefile pull+update-all.sh updateRepos.py
description:
Adding these guys from stgUnderworldE.
(We need these scripts since we're not using 2 root repositores anymore.)
diff -r f498e50e628b -r 1d0be4083c7d bittenObtain.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bittenObtain.py Fri Nov 27 13:17:01 2009 +1100
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+
+from mercurial import hg, ui, util
+import urllib2
+import ConfigParser
+import os, errno
+import sys
+
+# hacky way to find out what the name of the branch is
+branch = os.popen('hg branch').readlines()
+branch = branch[0].replace("\n","")
+cwd = os.getcwd()
+
+if len(sys.argv) > 1:
+ deps = [ \
+ ['https://' + (sys.argv[1] + '@') + 'csd.vpac.org/hg/hgforest', '.hg/forest' ], \
+ ['https://' + (sys.argv[1] + '@') + 'csd.vpac.org/hg/SConfigure', 'config' ], \
+ ['https://' + (sys.argv[1] + '@') + 'www.mcc.monash.edu.au/hg/gLucifer', 'gLucifer' ], \
+ ['https://' + (sys.argv[1] + '@') + 'csd.vpac.org/hg/PICellerator', 'PICellerator' ], \
+ ['https://' + (sys.argv[1] + '@') + 'csd.vpac.org/hg/StgDomain', 'StgDomain' ], \
+ ['https://' + (sys.argv[1] + '@') + 'csd.vpac.org/hg/StGermain', 'StGermain' ], \
+ ['https://' + (sys.argv[1] + '@') + 'csd.vpac.org/hg/StgFEM', 'StgFEM' ], \
+ ['https://' + (sys.argv[1] + '@') + 'www.mcc.monash.edu.au/hg/Underworld', 'Underworld' ], \
+ ['https://' + (sys.argv[1] + '@') + 'www.mcc.monash.edu.au/hg/Experimental', 'Experimental' ], \
+ ['https://' + (sys.argv[1] + '@') + 'www.mcc.monash.edu.au/hg/Experimental', 'Experimental/PDERework/config' ], \
+ ['https://' + (sys.argv[1] + '@') + 'www.mcc.monash.edu.au/hg/Experimental', 'Experimental/Magma/config' ], \
+ ['https://' + (sys.argv[1] + '@') + 'www.mcc.monash.edu.au/hg/Experimental', 'Experimental/Geothermal/config' ] ]
+else:
+ deps = [ \
+ ['https://csd.vpac.org/hg/hgforest', '.hg/forest' ], \
+ ['https://csd.vpac.org/hg/SConfigure', 'config' ], \
+ ['https://www.mcc.monash.edu.au/hg/gLucifer', 'gLucifer' ], \
+ ['https://csd.vpac.org/hg/PICellerator', 'PICellerator' ], \
+ ['https://csd.vpac.org/hg/StgDomain', 'StgDomain' ], \
+ ['https://csd.vpac.org/hg/StGermain', 'StGermain' ], \
+ ['https://csd.vpac.org/hg/StgFEM', 'StgFEM' ], \
+ ['https://www.mcc.monash.edu.au/hg/Underworld', 'Underworld' ], \
+ ['https://www.mcc.monash.edu.au/hg/Experimental', 'Experimental' ] ]
+
+
+# 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:
+ os.chdir(cwd)
+ try:
+ print dep[0], '-->', 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
+
+ # and heres some more hackyness to get hg to switch branches
+ # I couldn't find any functionality to do this in the python bindings.
+ # JS - 12/11/2008
+ os.chdir(dep[1])
+ try:
+ os.system("hg up -C "+branch)
+ except:
+ print "fail"
+
+# Tell this root repository that its has forest
+os.chdir(cwd)
+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', os.getcwd() + '/.hg/forest/forest.py' )
+c.write( open( '.hg/hgrc', 'w' ) )
+
diff -r f498e50e628b -r 1d0be4083c7d identify-all.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/identify-all.sh Fri Nov 27 13:17:01 2009 +1100
@@ -0,0 +1,18 @@
+#!/bin/bash
+#Run mercurial identify on all repos
+#Usage: ./identify-all.sh
+
+#Process current dir and first level of subdirs excluding .hg
+wd=`pwd`
+for f in `find . -maxdepth 1 -type d \( ! -iname ".hg" \) | sort -f`
+do
+ #skip if no .hg folder
+ ls $f/.hg &> /dev/null
+ if [ "${?}" -ne "0" ]; then
+ continue
+ fi
+
+ cd $f
+ echo "`hg identify` $f"
+ cd $wd
+done
diff -r f498e50e628b -r 1d0be4083c7d makefile
--- a/makefile Thu Nov 26 12:40:35 2009 +1100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-# obtain defaults for required variables according to system and project location, and then run the build.
-override PROJ_ROOT = .
-include ${PROJ_ROOT}/Makefile.system
-
-subproj = StGermain StgDomain StgFEM PICellerator gLucifer Underworld
-
-include ${PROJ_ROOT}/Makefile.vmake
diff -r f498e50e628b -r 1d0be4083c7d pull+update-all.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pull+update-all.sh Fri Nov 27 13:17:01 2009 +1100
@@ -0,0 +1,63 @@
+#!/bin/bash
+#Run mercurial pull and update in all directories
+#Usage: ./pull+update-all.sh [username]
+#Prompts for password
+
+check-errs()
+{
+ # Function. Parameter 1 is the return code
+ # Para. 2 is text to display on failure.
+ if [ "${1}" -ne "0" ]; then
+ echo "ERROR # ${1} : ${2}"
+ exit ${1}
+ fi
+}
+
+#check for username provided in hg paths url (look for @ symbol)
+#if present don't rewrite repository urls with username/pass
+expr match "`hg paths`" '.*\(@\).*' &> /dev/null
+if [ "${?}" -ne "0" ]; then
+ #get username from command line argument, defaults to current user
+ if [ $# -ne 1 ]
+ then
+ echo "Using currently logged in user name: `whoami`"
+ user=`whoami`
+ else
+ user=$1
+ fi
+
+ #get password
+ echo -n "Enter password for $user: "
+ stty -echo
+ read password
+ stty echo
+ echo ""
+
+ #setup username and password
+ login="https://$user:$password@"
+else
+ login="https://"
+fi
+
+#Process current dir and first level of subdirs excluding .hg
+wd=`pwd`
+for f in `find . -maxdepth 1 -type d \( ! -iname ".hg" \)`
+do
+ #skip if no .hg folder
+ ls $f/.hg &> /dev/null
+ if [ "${?}" -ne "0" ]; then
+ continue
+ fi
+
+ cd $f
+ echo "-------- Processing [ $f ] ---------------------------------------"
+
+ #strip start of hg paths output to get repository name
+ paths=`hg paths | sed 's/default = https:\/\///'`
+
+ hg pull $login$paths
+ check-errs $? "hg pull failed"
+ hg update
+ check-errs $? "hg update failed"
+ cd $wd
+done
diff -r f498e50e628b -r 1d0be4083c7d updateRepos.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/updateRepos.py Fri Nov 27 13:17:01 2009 +1100
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+"""
+This scipt will update Underworld repositories to a specific branch.
+The one argument this script uses is the branch name, eg.
+ ./updateRepos.py v1.3.x
+
+"""
+
+from mercurial import hg, ui, util
+import urllib2
+import ConfigParser
+import os, errno
+import sys
+
+deps = [
+ 'gLucifer', 'PICellerator', 'StgDomain' , 'StGermain' , 'StgFEM' , 'Underworld' , 'Experimental' \
+ ] #, 'Experimental/PDERework/config', 'Experimental/Magma/config' ]
+
+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()
+
+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]
+
More information about the CIG-COMMITS
mailing list