--- a/client.py
+++ b/client.py
@@ -308,30 +308,34 @@ def backup_cvs_extension(extensionName,
print "Moving %s to %s-cvs..." % (extensionDir, extensionDir)
try:
os.rename(extensionPath, extensionBackupPath)
except:
# 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, hgtool=None):
+def do_hg_pull(dir, repository, hg, rev, hgtool=None, hgtool1=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 hgtool or hgtool1:
+ if not os.path.exists(hgtool):
+ hgtool = hgtool1
+
if hgtool:
hgtoolcmd = hgtool.split()
# We need to strip the trailing slash from the repository url so that the hg tool gets a
# url that's consistent with the rest of the build automation.
check_call_noisy(['python'] + hgtoolcmd + [repository.rstrip('/'), 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],
@@ -365,23 +369,23 @@ def do_hg_pull(dir, repository, hg, rev,
def check_retries_option(option, opt_str, value, parser):
if value < 0:
raise OptionValueError("%s option value needs to be positive (not '%d')" % (opt_str, value))
setattr(parser.values, option.dest, value)
def do_apply_patch(hg, patch, repo):
- check_call_noisy([hg,
- 'import',
+ check_call_noisy([hg,
+ 'import',
'-R', repo,
'-m', "local patch from %s" % patch,
'--no-commit', '--force',
patch,
- ],
+ ],
retryMax=0)
return
import glob
def do_apply_patches(topsrcdir, hg):
prefix_map = {
'mozilla': 'mozilla',
'chatzilla': os.path.join('mozilla', 'extensions', 'irc'),
@@ -466,16 +470,19 @@ o.add_option("--venkman-rev", dest = "ve
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("--hgtool1", dest="hgtool1",
+ default=None,
+ help="Alternative 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)
@@ -643,22 +650,22 @@ if action in ('checkout', 'co'):
repo_config()
if not options.skip_comm:
fixup_comm_repo_options(options)
do_hg_pull('.', options.comm_repo, options.hg, options.comm_rev)
if not options.skip_mozilla:
if options.known_good and options.mozilla_rev is None:
- print "Fetching last known good mozilla revision"
+ 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
-
+
fixup_mozilla_repo_options(options)
- do_hg_pull('mozilla', options.mozilla_repo, options.hg, options.mozilla_rev, options.hgtool)
+ do_hg_pull('mozilla', options.mozilla_repo, options.hg, options.mozilla_rev, options.hgtool, options.hgtool1)
# 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!")
@@ -673,15 +680,15 @@ if action in ('checkout', 'co'):
if not options.skip_ldap:
fixup_ldap_repo_options(options)
do_hg_pull(os.path.join('ldap', 'sdks'), options.ldap_repo, options.hg, options.ldap_rev)
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)
-
+
if options.apply_patches:
do_apply_patches(topsrcdir, options.hg)
else:
o.print_help()
sys.exit(2)