Index: jhbuild/modtypes/autotools.py
===================================================================
--- jhbuild/modtypes/autotools.py	(revision 2459)
+++ jhbuild/modtypes/autotools.py	(working copy)
@@ -335,7 +335,7 @@
     extra_env = config.module_extra_env.get(id)
 
     dependencies, after, suggests = get_dependencies(node)
-    branch = get_branch(node, repositories, default_repo)
+    branch = get_branch(node, repositories, default_repo, config)
     if config.module_checkout_mode.get(id):
         branch.checkout_mode = config.module_checkout_mode[id]
 
Index: jhbuild/modtypes/waf.py
===================================================================
--- jhbuild/modtypes/waf.py	(revision 2459)
+++ jhbuild/modtypes/waf.py	(working copy)
@@ -185,7 +185,7 @@
 
     # override revision tag if requested.
     dependencies, after, suggests = get_dependencies(node)
-    branch = get_branch(node, repositories, default_repo)
+    branch = get_branch(node, repositories, default_repo, config)
     if config.module_checkout_mode.get(module_id):
         branch.checkout_mode = config.module_checkout_mode[module_id]
 
Index: jhbuild/modtypes/__init__.py
===================================================================
--- jhbuild/modtypes/__init__.py	(revision 2459)
+++ jhbuild/modtypes/__init__.py	(working copy)
@@ -82,7 +82,7 @@
 
     return dependencies, after, suggests
 
-def get_branch(node, repositories, default_repo):
+def get_branch(node, repositories, default_repo, config):
     """Scan for a <branch> element and create a corresponding Branch object."""
     name = node.getAttribute('id')
     for childnode in node.childNodes:
@@ -106,6 +106,13 @@
             raise FatalError(_('Default Repository=%s not found for module id=%s. Possible repositories are %s')
                              % (default_repo, name, repositories))
 
+    if repo.mirrors:
+        mirror_type = config.mirror_policy
+        if name in config.module_mirror_policy:
+            mirror_type = config.module_mirror_policy[name]
+        if mirror_type in repo.mirrors:
+            repo = repo.mirrors[mirror_type]
+
     return repo.branch_from_xml(name, childnode, repositories, default_repo)
 
 
Index: jhbuild/modtypes/linux.py
===================================================================
--- jhbuild/modtypes/linux.py	(revision 2459)
+++ jhbuild/modtypes/linux.py	(working copy)
@@ -239,7 +239,7 @@
 
     dependencies, after, suggests = get_dependencies(node)
     extra_env = config.module_extra_env.get(id)
-    branch = get_branch(node, repositories, default_repo)
+    branch = get_branch(node, repositories, default_repo, config)
     if config.module_checkout_mode.get(id):
         branch.checkout_mode = config.module_checkout_mode[id]
     kconfigs = get_kconfigs(node, repositories, default_repo)
Index: jhbuild/modtypes/cmake.py
===================================================================
--- jhbuild/modtypes/cmake.py	(revision 2459)
+++ jhbuild/modtypes/cmake.py	(working copy)
@@ -131,7 +131,7 @@
     id = node.getAttribute('id')
     dependencies, after, suggests = get_dependencies(node)
     extra_env = config.module_extra_env.get(id)
-    branch = get_branch(node, repositories, default_repo)
+    branch = get_branch(node, repositories, default_repo, config)
 
     if config.module_checkout_mode.get(id):
         branch.checkout_mode = config.module_checkout_mode[id]
Index: jhbuild/modtypes/perl.py
===================================================================
--- jhbuild/modtypes/perl.py	(revision 2459)
+++ jhbuild/modtypes/perl.py	(working copy)
@@ -118,7 +118,7 @@
     
     dependencies, after, suggests = get_dependencies(node)
     extra_env = config.module_extra_env.get(id)
-    branch = get_branch(node, repositories, default_repo)
+    branch = get_branch(node, repositories, default_repo, config)
     if config.module_checkout_mode.get(id):
         branch.checkout_mode = config.module_checkout_mode[id]
 
Index: jhbuild/modtypes/distutils.py
===================================================================
--- jhbuild/modtypes/distutils.py	(revision 2459)
+++ jhbuild/modtypes/distutils.py	(working copy)
@@ -119,7 +119,7 @@
             (node.getAttribute('supports-non-srcdir-builds') != 'no')
     dependencies, after, suggests = get_dependencies(node)
     extra_env = config.module_extra_env.get(id)
-    branch = get_branch(node, repositories, default_repo)
+    branch = get_branch(node, repositories, default_repo, config)
     if config.module_checkout_mode.get(id):
         branch.checkout_mode = config.module_checkout_mode[id]
 
Index: jhbuild/modtypes/mesa.py
===================================================================
--- jhbuild/modtypes/mesa.py	(revision 2459)
+++ jhbuild/modtypes/mesa.py	(working copy)
@@ -142,7 +142,7 @@
 
     dependencies, after, suggests = get_dependencies(node)
     extra_env = config.module_extra_env.get(id)
-    branch = get_branch(node, repositories, default_repo)
+    branch = get_branch(node, repositories, default_repo, config)
     if config.module_checkout_mode.get(id):
         branch.checkout_mode = config.module_checkout_mode[id]
 
Index: jhbuild/modtypes/testmodule.py
===================================================================
--- jhbuild/modtypes/testmodule.py	(revision 2459)
+++ jhbuild/modtypes/testmodule.py	(working copy)
@@ -353,7 +353,7 @@
         pass
 
     dependencies, after, suggests = get_dependencies(node)
-    branch = get_branch(node, repositories, default_repo)
+    branch = get_branch(node, repositories, default_repo, config)
     if config.module_checkout_mode.get(id):
         branch.checkout_mode = config.module_checkout_mode[id]
     tested_pkgs = get_tested_packages(node)
Index: jhbuild/versioncontrol/bzr.py
===================================================================
--- jhbuild/versioncontrol/bzr.py	(revision 2459)
+++ jhbuild/versioncontrol/bzr.py	(working copy)
@@ -46,12 +46,13 @@
     It can be a parent of a number of Bzr repositories or branches.
     """
 
-    init_xml_attrs = ['href']
+    init_xml_attrs = ['href', 'trunk-path']
 
-    def __init__(self, config, name, href):
+    def __init__(self, config, name, href, trunk_path=''):
         Repository.__init__(self, config, name)
         # allow user to adjust location of branch.
         self.href = config.repos.get(name, href)
+        self.trunk_path = trunk_path
 
     branch_xml_attrs = ['module', 'checkoutdir']
 
@@ -62,7 +63,10 @@
                 raise FatalError(_('branch for %s has wrong override, check your .jhbuildrc') % name)
         else:
             if module is None:
-                module = name
+                if self.trunk_path:
+                    module = name + "/" + self.trunk_path
+                else:
+                    module = name
             module = urlparse.urljoin(self.href, module)
 
         if checkoutdir is None:
Index: jhbuild/moduleset.py
===================================================================
--- jhbuild/moduleset.py	(revision 2459)
+++ jhbuild/moduleset.py	(working copy)
@@ -322,6 +322,17 @@
                     kws[attr.replace('-', '_')] = node.getAttribute(attr)
             repositories[name] = repo_class(config, name, **kws)
             repositories[name].moduleset_uri = uri
+            mirrors = {}
+            for mirror in _child_elements_matching(node, ['mirror']):
+                mirror_type = mirror.getAttribute('type')
+                mirror_class = get_repo_type(mirror_type)
+                kws = {}
+                for attr in mirror_class.init_xml_attrs:
+                    if mirror.hasAttribute(attr):
+                        kws[attr.replace('-','_')] = mirror.getAttribute(attr)
+                mirrors[mirror_type] = mirror_class(config, name, **kws)
+                #mirrors[mirror_type].moduleset_uri = uri
+            setattr(repositories[name], "mirrors", mirrors)
         if node.nodeName == 'cvsroot':
             cvsroot = node.getAttribute('root')
             if node.hasAttribute('password'):
Index: jhbuild/config.py
===================================================================
--- jhbuild/config.py	(revision 2459)
+++ jhbuild/config.py	(working copy)
@@ -47,6 +47,7 @@
                 'jhbuildbot_master', 'jhbuildbot_slavename', 'jhbuildbot_password',
                 'jhbuildbot_svn_commits_box',
                 'use_local_modulesets',
+                'mirror_policy', 'module_mirror_policy',
                 ]
 
 env_prepends = {}
Index: jhbuild/defaults.jhbuildrc
===================================================================
--- jhbuild/defaults.jhbuildrc	(revision 2459)
+++ jhbuild/defaults.jhbuildrc	(working copy)
@@ -115,6 +115,10 @@
 # program to use for cvs
 cvs_program = 'cvs'
 
+# try and use mirrors?
+mirror_policy = ""
+module_mirror_policy = {}
+
 # whether not to emit notifications through the notification daemon
 nonotify = False
 
Index: modulesets/gtk.modules
===================================================================
--- modulesets/gtk.modules	(revision 2459)
+++ modulesets/gtk.modules	(working copy)
@@ -6,8 +6,10 @@
       password=""/>
   <repository type="svn" name="svn.gnome.org" default="yes"
       developer-href-example="svn+ssh://USER@svn.gnome.org/svn/"
-      href="http://svn.gnome.org/svn/"
-  />
+      href="http://svn.gnome.org/svn/">
+      <mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
+      <mirror type="git" href="http://git-mirror.gnome.org/git/" />
+  </repository>
   <repository type="cvs" name="mime.freedesktop.org"
       cvsroot=":pserver:anoncvs@cvs.freedesktop.org:/cvs/mime"
       password=""/>
Index: modulesets/gnome-2.16.modules
===================================================================
--- modulesets/gnome-2.16.modules	(revision 2459)
+++ modulesets/gnome-2.16.modules	(working copy)
@@ -4,7 +4,10 @@
 <!-- vim:set ts=2 expandtab: -->
 <moduleset>
   <repository type="svn" name="svn.gnome.org" default="yes"
-      href="http://svn.gnome.org/svn/"/>
+      href="http://svn.gnome.org/svn/">
+      <mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
+      <mirror type="git" href="http://git-mirror.gnome.org/git/" />
+  </repository>
   <repository type="cvs" name="cairo.freedesktop.org"
       cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/cairo"
       password=""/>
Index: modulesets/gnome-2.18.modules
===================================================================
--- modulesets/gnome-2.18.modules	(revision 2459)
+++ modulesets/gnome-2.18.modules	(working copy)
@@ -4,7 +4,10 @@
 <!-- vim:set ts=2 expandtab: -->
 <moduleset>
   <repository type="svn" name="svn.gnome.org" default="yes"
-      href="http://svn.gnome.org/svn/"/>
+      href="http://svn.gnome.org/svn/">
+      <mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
+      <mirror type="git" href="http://git-mirror.gnome.org/git/" />
+  </repository>
   <repository type="svn" name="svn.gnomemm"
       href="http://svn.gnome.org/svn/gnomemm/"/>
   <repository type="cvs" name="cairo.freedesktop.org"
Index: modulesets/online-desktop.modules
===================================================================
--- modulesets/online-desktop.modules	(revision 2459)
+++ modulesets/online-desktop.modules	(working copy)
@@ -4,7 +4,10 @@
 <!-- vim:set ts=2 expandtab: -->
 <moduleset>
   <repository type="svn" name="svn.gnome.org" default="yes"
-      href="http://svn.gnome.org/svn/"/>
+      href="http://svn.gnome.org/svn/">
+      <mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
+      <mirror type="git" href="http://git-mirror.gnome.org/git/" />
+  </repository>
   <repository type="svn" name="svn.mugshot.org"
       href="http://svn.mugshot.org/"/>
   <repository type="git" name="git.freedesktop.org"
Index: modulesets/gnome-suites-2.20.modules
===================================================================
--- modulesets/gnome-suites-2.20.modules	(revision 2459)
+++ modulesets/gnome-suites-2.20.modules	(working copy)
@@ -3,9 +3,11 @@
 <?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
 <!-- vim:set ts=2 expandtab: -->
 <moduleset>
-
   <repository type="svn" name="svn.gnome.org" default="yes"
-      href="http://svn.gnome.org/svn/"/>
+      href="http://svn.gnome.org/svn/">
+      <mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
+      <mirror type="git" href="http://git-mirror.gnome.org/git/" />
+  </repository>
   <repository type="svn" name="svn.gnomemm"
       href="http://svn.gnome.org/svn/gnomemm/"/>
   <repository type="cvs" name="gstreamer.freedesktop.org"
Index: modulesets/gnome-suites-2.22.modules
===================================================================
--- modulesets/gnome-suites-2.22.modules	(revision 2459)
+++ modulesets/gnome-suites-2.22.modules	(working copy)
@@ -3,9 +3,11 @@
 <?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
 <!-- vim:set ts=2 expandtab: -->
 <moduleset>
-
   <repository type="svn" name="svn.gnome.org" default="yes"
-      href="http://svn.gnome.org/svn/"/>
+      href="http://svn.gnome.org/svn/">
+      <mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
+      <mirror type="git" href="http://git-mirror.gnome.org/git/" />
+  </repository>
   <repository type="svn" name="svn.gnomemm"
       href="http://svn.gnome.org/svn/gnomemm/"/>
   <repository type="cvs" name="gstreamer.freedesktop.org"
Index: modulesets/gnome-suites-2.24.modules
===================================================================
--- modulesets/gnome-suites-2.24.modules	(revision 2459)
+++ modulesets/gnome-suites-2.24.modules	(working copy)
@@ -3,9 +3,11 @@
 <?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
 <!-- vim:set ts=2 expandtab: -->
 <moduleset>
-
   <repository type="svn" name="svn.gnome.org" default="yes"
-      href="http://svn.gnome.org/svn/"/>
+      href="http://svn.gnome.org/svn/">
+      <mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
+      <mirror type="git" href="http://git-mirror.gnome.org/git/" />
+  </repository>
   <repository type="svn" name="svn.gnomemm"
       href="http://svn.gnome.org/svn/gnomemm/"/>
   <repository type="cvs" name="gstreamer.freedesktop.org"
Index: modulesets/gnome-suites-2.26.modules
===================================================================
--- modulesets/gnome-suites-2.26.modules	(revision 2459)
+++ modulesets/gnome-suites-2.26.modules	(working copy)
@@ -3,9 +3,11 @@
 <?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
 <!-- vim:set ts=2 expandtab: -->
 <moduleset>
-
   <repository type="svn" name="svn.gnome.org" default="yes"
-      href="http://svn.gnome.org/svn/"/>
+      href="http://svn.gnome.org/svn/">
+      <mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
+      <mirror type="git" href="http://git-mirror.gnome.org/git/" />
+  </repository>
   <repository type="svn" name="svn.gnomemm"
       href="http://svn.gnome.org/svn/gnomemm/"/>
   <repository type="cvs" name="gstreamer.freedesktop.org"
Index: modulesets/gnome-2.20.modules
===================================================================
--- modulesets/gnome-2.20.modules	(revision 2459)
+++ modulesets/gnome-2.20.modules	(working copy)
@@ -4,7 +4,10 @@
 <!-- vim:set ts=2 expandtab: -->
 <moduleset>
   <repository type="svn" name="svn.gnome.org" default="yes"
-      href="http://svn.gnome.org/svn/"/>
+      href="http://svn.gnome.org/svn/">
+      <mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
+      <mirror type="git" href="http://git-mirror.gnome.org/git/" />
+  </repository>
   <repository type="svn" name="svn.gnomemm"
       href="http://svn.gnome.org/svn/gnomemm/"/>
   <repository type="cvs" name="cairo.freedesktop.org"
Index: modulesets/gnome-2.22.modules
===================================================================
--- modulesets/gnome-2.22.modules	(revision 2459)
+++ modulesets/gnome-2.22.modules	(working copy)
@@ -4,7 +4,10 @@
 <!-- vim:set ts=2 expandtab: -->
 <moduleset>
   <repository type="svn" name="svn.gnome.org" default="yes"
-      href="http://svn.gnome.org/svn/"/>
+      href="http://svn.gnome.org/svn/">
+      <mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
+      <mirror type="git" href="http://git-mirror.gnome.org/git/" />
+  </repository>
   <repository type="svn" name="svn.gnomemm"
       href="http://svn.gnome.org/svn/gnomemm/"/>
   <repository type="cvs" name="cairo.freedesktop.org"
Index: modulesets/gnome-2.24.modules
===================================================================
--- modulesets/gnome-2.24.modules	(revision 2459)
+++ modulesets/gnome-2.24.modules	(working copy)
@@ -4,7 +4,10 @@
 <!-- vim:set ts=2 expandtab: -->
 <moduleset>
   <repository type="svn" name="svn.gnome.org" default="yes"
-      href="http://svn.gnome.org/svn/"/>
+      href="http://svn.gnome.org/svn/">
+      <mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
+      <mirror type="git" href="http://git-mirror.gnome.org/git/" />
+  </repository>
   <repository type="svn" name="svn.gnomemm"
       href="http://svn.gnome.org/svn/gnomemm/"/>
   <repository type="cvs" name="cvs.cairographics.org"
Index: modulesets/gnome-2.26.modules
===================================================================
--- modulesets/gnome-2.26.modules	(revision 2459)
+++ modulesets/gnome-2.26.modules	(working copy)
@@ -4,7 +4,10 @@
 <!-- vim:set ts=2 expandtab: -->
 <moduleset>
   <repository type="svn" name="svn.gnome.org" default="yes"
-      href="http://svn.gnome.org/svn/"/>
+      href="http://svn.gnome.org/svn/">
+      <mirror type="bzr" href="http://bzr-mirror.gnome.org/bzr/" trunk-path="trunk" />
+      <mirror type="git" href="http://git-mirror.gnome.org/git/" />
+  </repository>
   <repository type="svn" name="svn.gnomemm"
       href="http://svn.gnome.org/svn/gnomemm/"/>
   <repository type="cvs" name="cvs.cairographics.org"
