Bug 458215. Add --hg-options to client.py to pass arbitrary options to hg. r=Callek
authorPhilippe M. Chiasson <gozer@mozillamessaging.com>
Thu, 02 Oct 2008 13:19:48 -0400
changeset 484 525ea0a20b19b8302a9d49da4e919fb282e2b452
parent 483 d622a1f964c4205435eeb8544b8013342de4465d
child 485 b23500b3399c20f0d6d26648f6debdf172035e67
push idunknown
push userunknown
push dateunknown
Bug 458215. Add --hg-options to client.py to pass arbitrary options to hg. r=Callek
--- a/client.py
+++ b/client.py
@@ -44,29 +44,32 @@ except ImportError:
 def check_call_noisy(cmd, *args, **kwargs):
     print "Executing command:", cmd
     check_call(cmd, *args, **kwargs)
 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()
     if not os.path.exists(fulldir):
         fulldir = os.path.join(topsrcdir, dir)
-        check_call_noisy([hg, 'clone', repository, fulldir])
+        check_call_noisy([hg, 'clone'] + hgopts + [repository, fulldir])
-        cmd = [hg, 'pull', '-R', fulldir]
+        cmd = [hg, 'pull', '-R', fulldir ] + hgopts
         if repository is not None:
     # update to specific revision
     if options.verbose:
-        cmd = [hg, 'update', '-v', '-r', rev, '-R', fulldir]
+        cmd = [hg, 'update', '-v', '-r', rev, '-R', fulldir ] + hgopts
-        cmd = [hg, 'update', '-r', rev, '-R', fulldir]
+        cmd = [hg, 'update', '-r', rev, '-R', fulldir ] + hgopts
     check_call([hg, 'parent', '-R', fulldir,
                 '--template=Updated to revision {node}.\n'])
 def do_cvs_checkout(modules, tag, cvsroot, cvs, checkoutdir):
     """Check out a CVS directory into the mozilla/ subdirectory.
     modules is a list of directories to check out, e.g. ['extensions/irc']
@@ -134,17 +137,18 @@ o.add_option("--hg", dest="hg", default=
 o.add_option("--cvs", dest="cvs", default=os.environ.get('CVS', 'cvs'),
              help="The location of the cvs binary")
 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)")
 def fixup_repo_options(options):
     """ Check options.comm_repo and options.mozilla_repo values;
     populate mozilla_repo if needed.
     options.comm_repo and options.mozilla_repo are normally None.
     This is fine-- our "hg pull" commands will omit the repo URL.
     The exception is the initial checkout, which does an "hg clone"