Bug 758914 - client.py always pulls from http://hg.mozilla.org/mozilla-central/ - restore the previous functionality that allows pulling from local clones. r=gozer
authorMark Banner <bugzilla@standard8.plus.com>
Fri, 15 Jun 2012 11:19:25 +0100
changeset 10438 72a1699e3ad5b636e408ff5cee7dd03c3f820b9b
parent 10437 9c0bd48911673eb51b4bf6245c42b42b1f85cdea
child 10439 4cf03f36c629576503dc27f1b19b63686b7e28bf
push id7894
push userbugzilla@standard8.plus.com
push dateFri, 15 Jun 2012 10:19:45 +0000
treeherdercomm-central@72a1699e3ad5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgozer
bugs758914
Bug 758914 - client.py always pulls from http://hg.mozilla.org/mozilla-central/ - restore the previous functionality that allows pulling from local clones. r=gozer
client.py
--- a/client.py
+++ b/client.py
@@ -399,17 +399,17 @@ o.add_option("-m", "--comm-repo", dest="
 o.add_option("--skip-comm", dest="skip_comm",
              action="store_true", default=False,
              help="Skip pulling the comm (Calendar/Mail/Suite) repository.")
 o.add_option("--comm-rev", dest="comm_rev",
              default=None,
              help="Revision of comm (Calendar/Mail/Suite) repository to update to. Default: \"" + get_DEFAULT_tag('COMM_REV') + "\"")
 
 o.add_option("-z", "--mozilla-repo", dest="mozilla_repo",
-             default=DEFAULTS['MOZILLA_REPO'],
+             default=None,
              help="URL of Mozilla repository to pull from (default: use hg default in mozilla/.hg/hgrc; or if that file doesn't exist, use \"" + DEFAULTS['MOZILLA_REPO'] + "\".)")
 o.add_option("--skip-mozilla", dest="skip_mozilla",
              action="store_true", default=False,
              help="Skip pulling the Mozilla repository.")
 o.add_option("--mozilla-rev", dest="mozilla_rev",
              default=None,
              help="Revision of Mozilla repository to update to. Default: \"" + get_DEFAULT_tag('MOZILLA_REV') + "\"")
 o.add_option("--known-good", dest="known_good",
@@ -504,20 +504,30 @@ def fixup_comm_repo_options(options):
     if options.comm_rev is None:
         options.comm_rev = get_DEFAULT_tag("COMM_REV")
 
 def fixup_mozilla_repo_options(options):
     """Handle special case: initial checkout of Mozilla.
 
     See fixup_comm_repo_options().
     """
-    if options.mozilla_repo is None and \
-            not os.path.exists(os.path.join(topsrcdir, 'mozilla')):
-        options.mozilla_repo = DEFAULTS['MOZILLA_REPO']
-    
+    if options.mozilla_repo is None:
+        if not os.path.exists(os.path.join(topsrcdir, 'mozilla')):
+            options.mozilla_repo = DEFAULTS['MOZILLA_REPO']
+        else:
+            # Fallback to using .hgrc as hgtool/share needs the repo
+            import ConfigParser, re
+            config = ConfigParser.ConfigParser()
+            config.read([os.path.join('mozilla', '.hg', 'hgrc')])
+            if not config.has_option('paths', 'default'):
+                # Abort, not to get into a possibly inconsistent state.
+                sys.exit("Error: default path in mozilla/.hg/hgrc is undefined!")
+
+            options.mozilla_repo = config.get('paths', 'default')
+
     if options.mozilla_rev is None:
         options.mozilla_rev = get_DEFAULT_tag("MOZILLA_REV")
 
 def fixup_chatzilla_repo_options(options):
     """Handle special case: initial hg checkout of Chatzilla.
 
     See fixup_comm_repo_options().
     backup_cvs_extension() is also called.