Bug 508955 - Add to client.py --hg-clone-options r=kairo
authorPhilippe M. Chiasson <gozer@mozillamessaging.com>
Fri, 05 Feb 2010 11:08:45 -0500
changeset 4839 bb438fe036d2b3903c11b0989c462ec98a1a3a88
parent 4838 127cfce2f2e8eca49609b247d63e30160a6a3122
child 4840 72fadb79f4e7a76913f232e3f4bd4906ff007f51
push idunknown
push userunknown
push dateunknown
reviewerskairo
bugs508955
Bug 508955 - Add to client.py --hg-clone-options r=kairo
client.py
--- a/client.py
+++ b/client.py
@@ -163,16 +163,20 @@ def switch_mozilla_repo():
       if match:
         config.set('paths', 'default-push',
                    SWITCH_MOZILLA_REPO_REPLACE % match.group(1) )
 
     hgopts = []
     if options.hgopts:
         hgopts = options.hgopts.split()
 
+    hgcloneopts = []
+    if options.hgcloneopts:
+        hgcloneopts = options.hgcloneopts.split()
+
     backup_mozilla_path = os.path.join(topsrcdir, SWITCH_MOZILLA_REPO_BACKUP_LOCATION)
     print "Moving mozilla to " + SWITCH_MOZILLA_REPO_BACKUP_LOCATION + "..."
     try:
         os.rename(mozilla_path, backup_mozilla_path)
     except:
         # Print the exception without its traceback.
         sys.excepthook(sys.exc_info()[0], sys.exc_info()[1], None)
         sys.exit("Error: Mozilla directory renaming failed!")
@@ -222,19 +226,24 @@ def backup_cvs_extension(extensionName, 
         sys.exit("Error: %s directory renaming failed!" % extensionName)
 
 def do_hg_pull(dir, repository, hg, rev):
     fulldir = os.path.join(topsrcdir, dir)
     # clone if the dir doesn't exist, pull if it does
     hgopts = []
     if options.hgopts:
         hgopts = options.hgopts.split()
+    
+    hgcloneopts = []
+    if options.hgcloneopts:
+        hgcloneopts = options.hgcloneopts.split()
+
     if not os.path.exists(fulldir):
         fulldir = os.path.join(topsrcdir, dir)
-        check_call_noisy([hg, 'clone'] + hgopts + [repository, fulldir])
+        check_call_noisy([hg, 'clone'] + hgcloneopts + hgopts + [repository, fulldir])
     else:
         cmd = [hg, 'pull', '-R', fulldir] + hgopts
         if repository is not None:
             cmd.append(repository)
         check_call_noisy(cmd)
     # update to specific revision
     if options.verbose:
         cmd = [hg, 'update', '-v', '-r', rev, '-R', fulldir ] + hgopts
@@ -326,16 +335,18 @@ o.add_option("--cvs", dest="cvs", defaul
 o.add_option("--cvsroot", dest="cvsroot",
              default=os.environ.get('CVSROOT', ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot'),
              help="The CVSROOT (default: :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot")
 o.add_option("-v", "--verbose", dest="verbose",
              action="store_true", default=False,
              help="Enable verbose output on hg updates")
 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. --debug, --time)")
 
 def fixup_comm_repo_options(options):
     """Check options.comm_repo value.
 
     options.comm_repo is normally None.
     This is fine -- our "hg pull" command will omit the repo URL.
     The exception is the initial checkout, which does an "hg clone".
     That command requires a repository URL.