From 79245bf5530ea212573862d1b1a263b0c9894765 Mon Sep 17 00:00:00 2001 From: "ferringb@google.com" Date: Thu, 14 Jun 2012 21:22:01 +0000 Subject: [PATCH] Upgrade repo script to v1.17. This is backwards compatible, and should be done prior to upgrading repo's internals to 1.9.4. BUG=chromium-os:31841 TEST=manual validation Review URL: https://chromiumcodereview.appspot.com/10541155 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@142238 0039d316-1c4b-4281-b951-d872f2087c98 --- repo | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/repo b/repo index 458fa1d83..46f8ba528 100755 --- a/repo +++ b/repo @@ -28,7 +28,7 @@ if __name__ == '__main__': del magic # increment this whenever we make important changes to this script -VERSION = (1, 13) +VERSION = (1, 17) # increment this if the MAINTAINER_KEYS block is modified KEYRING_VERSION = (1,0) @@ -125,6 +125,15 @@ group.add_option('--reference', group.add_option('--depth', type='int', default=None, dest='depth', help='create a shallow clone with given depth; see git clone') +group.add_option('-g', '--groups', + dest='groups', default='default', + help='restrict manifest projects to ones with a specified group', + metavar='GROUP') +group.add_option('-p', '--platform', + dest='platform', default="auto", + help='restrict manifest projects to ones with a specified' + 'platform group [auto|all|none|linux|darwin|...]', + metavar='PLATFORM') # Tool @@ -139,6 +148,11 @@ group.add_option('--no-repo-verify', dest='no_repo_verify', action='store_true', help='do not verify repo source code') +# Other +group = init_optparse.add_option_group('Other options') +group.add_option('--config-name', + dest='config_name', action="store_true", default=False, + help='Always prompt for name/e-mail') class CloneFailure(Exception): """Indicate the remote clone of repo itself failed. @@ -149,7 +163,7 @@ def _Init(args): """Installs repo by cloning it over the network. """ opt, args = init_optparse.parse_args(args) - if args or not opt.manifest_url: + if args: init_optparse.print_usage() sys.exit(1) @@ -206,7 +220,17 @@ def _Init(args): def _CheckGitVersion(): cmd = [GIT, '--version'] - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) + try: + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) + except OSError, e: + print >>sys.stderr + print >>sys.stderr, "fatal: '%s' is not available" % GIT + print >>sys.stderr, 'fatal: %s' % e + print >>sys.stderr + print >>sys.stderr, 'Please make sure %s is installed'\ + ' and in your path.' % GIT + raise CloneFailure() + ver_str = proc.stdout.read().strip() proc.stdout.close() proc.wait() @@ -306,11 +330,12 @@ def _InitHttp(): n = netrc.netrc() for host in n.hosts: p = n.hosts[host] - mgr.add_password(None, 'http://%s/' % host, p[0], p[2]) - mgr.add_password(None, 'https://%s/' % host, p[0], p[2]) + mgr.add_password(p[1], 'http://%s/' % host, p[0], p[2]) + mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2]) except: pass handlers.append(urllib2.HTTPBasicAuthHandler(mgr)) + handlers.append(urllib2.HTTPDigestAuthHandler(mgr)) if 'http_proxy' in os.environ: url = os.environ['http_proxy']