Bug 688856 - teach comm-central client.mk to use hgtool.py r=Standard8,jhopkins
authorPhilippe M. Chiasson <gozer@mozilla.com>
Thu, 06 Oct 2011 13:41:58 -0400
changeset 9454 658151bc236d4dfeb1b44a6d2edf48c0e35beaca
parent 9453 95f3a33acb64878a649f2ffcca5208b04b906f08
child 9455 7767f7386c9da43460ef2c209548011268a1ca08
push idunknown
push userunknown
push dateunknown
reviewersStandard8, jhopkins
Bug 688856 - teach comm-central client.mk to use hgtool.py r=Standard8,jhopkins
--- a/client.py
+++ b/client.py
@@ -297,31 +297,34 @@ def backup_cvs_extension(extensionName, 
     print "Moving %s to %s-cvs..." % (extensionDir, extensionDir)
         os.rename(extensionPath, extensionBackupPath)
         # Print the exception without its traceback.
         sys.excepthook(sys.exc_info()[0], sys.exc_info()[1], None)
         sys.exit("Error: %s directory renaming failed!" % extensionName)
-def do_hg_pull(dir, repository, hg, rev):
+def do_hg_pull(dir, repository, hg, rev, hgtool=None):
     """Clone if the dir doesn't exist, pull if it does.
     fulldir = os.path.join(topsrcdir, dir)
     hgcloneopts = []
     if options.hgcloneopts:
         hgcloneopts = options.hgcloneopts.split()
     hgopts = []
     if options.hgopts:
         hgopts = options.hgopts.split()
-    if not os.path.exists(fulldir):
+    if hgtool:
+        hgtoolcmd = hgtool.split()
+        check_call_noisy(['python'] + hgtoolcmd + [repository, fulldir], retryMax=options.retries)
+    elif not os.path.exists(fulldir):
         fulldir = os.path.join(topsrcdir, dir)
         check_call_noisy([hg, 'clone'] + hgcloneopts + hgopts + [repository, fulldir],
         cmd = [hg, 'pull', '-R', fulldir] + hgopts
         if repository is not None:
         check_call_noisy(cmd, retryMax=options.retries)
@@ -390,17 +393,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",
              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=None,
+             default=DEFAULTS['MOZILLA_REPO'],
              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",
              help="Revision of Mozilla repository to update to. Default: \"" + get_DEFAULT_tag('MOZILLA_REV') + "\"")
 o.add_option("--known-good", dest="known_good",
@@ -447,16 +450,19 @@ o.add_option("--venkman-rev", dest = "ve
              default = None,
              help = "Revision of Venkman repository to update to. Default: \"" + get_DEFAULT_tag('VENKMAN_REV') + "\"")
 o.add_option("--hg", dest="hg", default=os.environ.get('HG', 'hg'),
              help="The location of the hg binary")
 o.add_option("-v", "--verbose", dest="verbose",
              action="store_true", default=False,
              help="Enable verbose output on hg updates")
+o.add_option("--hgtool", dest="hgtool",
+             default=None,
+             help="Path to hgtool, if wanted")
 o.add_option("--hg-options", dest="hgopts",
              help="Pass arbitrary options to hg commands (i.e. --debug, --time)")
 o.add_option("--hg-clone-options", dest="hgcloneopts",
              help="Pass arbitrary options to hg clone commands (i.e. --uncompressed)")
 o.add_option("--retries", dest="retries", type="int", metavar="NUM",
              default=1, help="Number of times to retry a failed command before giving up. (default: 1)",
              action="callback", callback=check_retries_option)
@@ -604,17 +610,17 @@ if action in ('checkout', 'co'):
     if not options.skip_mozilla:
         if options.known_good and options.mozilla_rev is None:
             print "Fetching last known good mozilla revision" 
             options.mozilla_rev = get_last_known_good_mozilla_rev()
             print "Setting mozilla_rev to '%s'" % options.mozilla_rev
-        do_hg_pull('mozilla', options.mozilla_repo, options.hg, options.mozilla_rev)
+        do_hg_pull('mozilla', options.mozilla_repo, options.hg, options.mozilla_rev, options.hgtool)
     # Check whether destination directory exists for these extensions.
     if (not options.skip_chatzilla or not options.skip_inspector or \
                 not options.skip_venkman) and \
             not os.path.exists(os.path.join(topsrcdir, 'mozilla', 'extensions')):
         # Don't create the directory: Mozilla repository should provide it...
         sys.exit("Error: mozilla/extensions directory does not exist;" + \
                  " ChatZilla, DOM Inspector and/or Venkman cannot be checked out!")