--- a/client.py
+++ b/client.py
@@ -1,31 +1,40 @@
#!/usr/bin/env python
-# LDAP
-LDAPCSDK_CO_TAG = 'LDAPCSDK_6_0_6D_MOZILLA_RTM'
-LDAPCSDK_DIRS = ('directory/c-sdk',)
+# Repo Defaults
+# 'REV' controls the default rev for All the various repo's
+# Define x_REV to override. Where x can be one of:
+# "COMM", "MOZILLA", "CHATZILLA", "INSPECTOR" or "VENKMAN"
+DEFAULTS = {
+ # Global Default Revision
+ 'REV': "default",
-# URL of the default hg repository to clone for ChatZilla.
-DEFAULT_CHATZILLA_REPO = 'http://hg.mozilla.org/chatzilla/'
-DEFAULT_CHATZILLA_REV = "default"
+ # LDAP
+ 'LDAPCSDK_CO_TAG': 'LDAPCSDK_6_0_6D_MOZILLA_RTM',
+ 'LDAPCSDK_DIRS': ('directory/c-sdk',),
+
+ # URL of the default hg repository to clone for ChatZilla.
+ 'CHATZILLA_REPO': 'http://hg.mozilla.org/chatzilla/',
-# URL of the default hg repository to clone for DOM Inspector.
-DEFAULT_INSPECTOR_REPO = 'http://hg.mozilla.org/dom-inspector/'
-DEFAULT_INSPECTOR_REV = "default"
+ # URL of the default hg repository to clone for DOM Inspector.
+ 'INSPECTOR_REPO': 'http://hg.mozilla.org/dom-inspector/',
+
+ # URL of the default hg repository to clone for Venkman.
+ 'VENKMAN_REPO': 'http://hg.mozilla.org/venkman/',
-# URL of the default hg repository to clone for Venkman.
-DEFAULT_VENKMAN_REPO = 'http://hg.mozilla.org/venkman/'
-DEFAULT_VENKMAN_REV = "default"
+ # URL of the default hg repository to clone for Mozilla.
+ 'MOZILLA_REPO': 'http://hg.mozilla.org/mozilla-central/',
+}
-DEFAULT_COMM_REV = "default"
+# Populate initial defaults
+for index in ['CHATZILLA_REV', 'INSPECTOR_REV', 'VENKMAN_REV', 'COMM_REV', 'MOZILLA_REV']:
+ if index not in DEFAULTS:
+ DEFAULTS[index] = DEFAULTS['REV']
-# URL of the default hg repository to clone for Mozilla.
-DEFAULT_MOZILLA_REPO = 'http://hg.mozilla.org/mozilla-central/'
-DEFAULT_MOZILLA_REV = "default"
# The set of defaults below relate to the current switching mechanism between
# trunk or branches and back again if it is required.
# The current version expected in the .treestate file for nothing to happen.
# This reflects the "[treestate] src_update_version = ..." value.
#
# src_update_version values:
@@ -36,17 +45,17 @@ CURRENT_TREESTATE_VERSION = '2'
# REGEX to match against, $1 should refer to protocol scheme
SWITCH_MOZILLA_REPO_REGEXP = '(ssh|http|https):\/\/hg\.mozilla\.org\/releases/mozilla-1.9.1\/?$'
# The location to back-up the existing mozilla repo to, e.g. ".mozilla-trunk"
# or ".mozilla-1.9.1".
SWITCH_MOZILLA_REPO_BACKUP_LOCATION = ".mozilla-1.9.1"
# This is the potential location for a repository from the last time we
# switched. Can be blank for no effect.
SWITCH_MOZILLA_REPO_OLD_REPO_LOCATION = ".mozilla-trunk"
-# This should be the same as DEFAULT_MOZILLA_REPO but using %s instead of http
+# This should be the same as DEFAULTS['MOZILLA_REPO'] but using %s instead of http
# for the scheme.
SWITCH_MOZILLA_REPO_REPLACE = '%s://hg.mozilla.org/mozilla-central/'
SWITCH_MOZILLA_BASE_REV = "GECKO_1_9_1_BASE"
import sys
# Test Python Version. 2.4 required for `import subprocess`
pyver = sys.version_info
if pyver[0] <= 1 or (pyver[0] == 2 and pyver[1] < 4):
@@ -320,62 +329,62 @@ def check_retries_option(option, opt_str
o = OptionParser(usage="%prog [options] checkout")
o.add_option("-m", "--comm-repo", dest="comm_repo",
default=None,
help="URL of comm (Calendar/Mail/Suite) repository to pull from (default: use hg default in .hg/hgrc)")
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=DEFAULT_COMM_REV,
- help="Revision of comm (Calendar/Mail/Suite) repository to update to. Default: \"" + DEFAULT_COMM_REV + "\"")
+ default=DEFAULTS['COMM_REV'],
+ help="Revision of comm (Calendar/Mail/Suite) repository to update to. Default: \"" + DEFAULTS['COMM_REV'] + "\"")
o.add_option("-z", "--mozilla-repo", dest="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 \"" + DEFAULT_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",
- default=DEFAULT_MOZILLA_REV,
- help="Revision of Mozilla repository to update to. Default: \"" + DEFAULT_MOZILLA_REV + "\"")
+ default=DEFAULTS['MOZILLA_REV'],
+ help="Revision of Mozilla repository to update to. Default: \"" + DEFAULTS['MOZILLA_REV'] + "\"")
o.add_option("--inspector-repo", dest="inspector_repo",
default=None,
- help="URL of DOM Inspector repository to pull from (default: use hg default in mozilla/extensions/inspector/.hg/hgrc; or if that file doesn't exist, use \"" + DEFAULT_INSPECTOR_REPO + "\".)")
+ help="URL of DOM Inspector repository to pull from (default: use hg default in mozilla/extensions/inspector/.hg/hgrc; or if that file doesn't exist, use \"" + DEFAULTS['INSPECTOR_REPO'] + "\".)")
o.add_option("--skip-inspector", dest="skip_inspector",
action="store_true", default=False,
help="Skip pulling the DOM Inspector repository.")
o.add_option("--inspector-rev", dest="inspector_rev",
- default=DEFAULT_INSPECTOR_REV,
- help="Revision of DOM Inspector repository to update to. Default: \"" + DEFAULT_INSPECTOR_REV + "\"")
+ default=DEFAULTS['INSPECTOR_REV'],
+ help="Revision of DOM Inspector repository to update to. Default: \"" + DEFAULTS['INSPECTOR_REV'] + "\"")
o.add_option("--skip-ldap", dest="skip_ldap",
action="store_true", default=False,
help="Skip pulling LDAP from the Mozilla CVS repository.")
o.add_option("--chatzilla-repo", dest = "chatzilla_repo",
default = None,
- help = "URL of ChatZilla repository to pull from (default: use hg default in mozilla/extensions/irc/.hg/hgrc; or if that file doesn't exist, use \"" + DEFAULT_CHATZILLA_REPO + "\".)")
+ help = "URL of ChatZilla repository to pull from (default: use hg default in mozilla/extensions/irc/.hg/hgrc; or if that file doesn't exist, use \"" + DEFAULTS['CHATZILLA_REPO'] + "\".)")
o.add_option("--skip-chatzilla", dest="skip_chatzilla",
action="store_true", default=False,
help="Skip pulling the ChatZilla repository.")
o.add_option("--chatzilla-rev", dest = "chatzilla_rev",
- default = DEFAULT_CHATZILLA_REV,
- help = "Revision of ChatZilla repository to update to. Default: \"" + DEFAULT_CHATZILLA_REV + "\"")
+ default = DEFAULTS['CHATZILLA_REV'],
+ help = "Revision of ChatZilla repository to update to. Default: \"" + DEFAULTS['CHATZILLA_REV'] + "\"")
o.add_option("--venkman-repo", dest = "venkman_repo",
default = None,
- help = "URL of Venkman repository to pull from (default: use hg default in mozilla/extensions/venkman/.hg/hgrc; or if that file doesn't exist, use \"" + DEFAULT_VENKMAN_REPO + "\".)")
+ help = "URL of Venkman repository to pull from (default: use hg default in mozilla/extensions/venkman/.hg/hgrc; or if that file doesn't exist, use \"" + DEFAULTS['VENKMAN_REPO'] + "\".)")
o.add_option("--skip-venkman", dest="skip_venkman",
action="store_true", default=False,
help="Skip pulling the Venkman repository.")
o.add_option("--venkman-rev", dest = "venkman_rev",
- default = DEFAULT_VENKMAN_REV,
- help = "Revision of Venkman repository to update to. Default: \"" + DEFAULT_VENKMAN_REV + "\"")
+ default = DEFAULTS['VENKMAN_REV'],
+ help = "Revision of Venkman repository to update to. Default: \"" + DEFAULTS['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("--hg-options", dest="hgopts",
help="Pass arbitrary options to hg commands (i.e. --debug, --time)")
@@ -410,57 +419,57 @@ def fixup_comm_repo_options(options):
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 = DEFAULT_MOZILLA_REPO
+ options.mozilla_repo = DEFAULTS['MOZILLA_REPO']
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.
"""
extensionPath = os.path.join(topsrcdir, 'mozilla', 'extensions', 'irc')
backup_cvs_extension('Chatzilla', 'irc', extensionPath)
if options.chatzilla_repo is None and not os.path.exists(extensionPath):
- options.chatzilla_repo = DEFAULT_CHATZILLA_REPO
+ options.chatzilla_repo = DEFAULTS['CHATZILLA_REPO']
def fixup_inspector_repo_options(options):
"""Handle special case: initial checkout of DOM Inspector.
See fixup_comm_repo_options().
"""
# No cvs backup needed as DOM Inspector was part (and removed from)
# Mozilla hg repository.
if options.inspector_repo is None and \
not os.path.exists(os.path.join(topsrcdir, 'mozilla', 'extensions', 'inspector')):
- options.inspector_repo = DEFAULT_INSPECTOR_REPO
+ options.inspector_repo = DEFAULTS['INSPECTOR_REPO']
def fixup_venkman_repo_options(options):
"""Handle special case: initial hg checkout of Venkman.
See fixup_comm_repo_options().
backup_cvs_extension() is also called.
"""
extensionPath = os.path.join(topsrcdir, 'mozilla', 'extensions', 'venkman')
backup_cvs_extension('Venkman', 'venkman', extensionPath)
if options.venkman_repo is None and not os.path.exists(extensionPath):
- options.venkman_repo = DEFAULT_VENKMAN_REPO
+ options.venkman_repo = DEFAULTS['VENKMAN_REPO']
try:
(options, (action,)) = o.parse_args()
except ValueError:
o.print_help()
sys.exit(2)
if action in ('checkout', 'co'):
@@ -487,16 +496,16 @@ if action in ('checkout', 'co'):
fixup_chatzilla_repo_options(options)
do_hg_pull(os.path.join('mozilla', 'extensions', 'irc'), options.chatzilla_repo, options.hg, options.chatzilla_rev)
if not options.skip_inspector:
fixup_inspector_repo_options(options)
do_hg_pull(os.path.join('mozilla', 'extensions', 'inspector'), options.inspector_repo, options.hg, options.inspector_rev)
if not options.skip_ldap:
- do_cvs_checkout(LDAPCSDK_DIRS, LDAPCSDK_CO_TAG, options.cvsroot, options.cvs, '')
+ do_cvs_checkout(DEFAULTS['LDAPCSDK_DIRS'], DEFAULTS['LDAPCSDK_CO_TAG'], options.cvsroot, options.cvs, '')
if not options.skip_venkman:
fixup_venkman_repo_options(options)
do_hg_pull(os.path.join('mozilla', 'extensions', 'venkman'), options.venkman_repo, options.hg, options.venkman_rev)
else:
o.print_help()
sys.exit(2)