From 8cf7a391003eaf597247641472013c5a9a65685c Mon Sep 17 00:00:00 2001 From: "iposva@chromium.org" Date: Wed, 7 Apr 2010 17:20:26 +0000 Subject: [PATCH] Provide a way to name a solution as part of the config command. Review URL: http://codereview.chromium.org/1611009 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@43847 0039d316-1c4b-4281-b951-d872f2087c98 --- gclient.py | 15 +++++++++++---- tests/gclient_test.py | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gclient.py b/gclient.py index 3d16aef5c..deb6d8d29 100644 --- a/gclient.py +++ b/gclient.py @@ -153,11 +153,13 @@ specifies the configuration for further commands. After update/sync, top-level DEPS files in each module are read to determine dependent modules to operate on as well. If optional [url] parameter is provided, then configuration is read from a specified Subversion server -URL. Otherwise, a --spec option must be provided. +URL. Otherwise, a --spec option must be provided. A --name option overrides +the default name for the solutions. usage: config [option | url] [safesync url] Valid options: + --name path : alternate relative path for the solution --spec=GCLIENT_SPEC : contents of .gclient are read from string parameter. *Note that due to Cygwin/Python brokenness, it probably can't contain any newlines.* @@ -165,6 +167,7 @@ Valid options: Examples: gclient config https://gclient.googlecode.com/svn/trunk/gclient configure a new client to check out gclient.py tool sources + gclient config --name tools https://gclient.googlecode.com/svn/trunk/gclient gclient config --spec='solutions=[{"name":"gclient",""" '"url":"https://gclient.googlecode.com/svn/trunk/gclient",' '"custom_deps":{}}]', @@ -959,10 +962,12 @@ def DoConfig(options, args): if options.spec: client.SetConfig(options.spec) else: - # TODO(darin): it would be nice to be able to specify an alternate relpath - # for the given URL. base_url = args[0].rstrip('/') - name = base_url.split("/")[-1] + if not options.name: + name = base_url.split("/")[-1] + else: + # specify an alternate relpath for the given URL. + name = options.name safesync_url = "" if len(args) > 1: safesync_url = args[1] @@ -1204,6 +1209,8 @@ def Main(argv): option_parser.add_option("", "--snapshot", action="store_true", default=False, help=("(revinfo only), create a snapshot file " "of the current version of all repositories")) + option_parser.add_option("", "--name", + help="specify alternate relative solution path") option_parser.add_option("", "--gclientfile", default=None, metavar="FILENAME", help=("specify an alternate .gclient file")) diff --git a/tests/gclient_test.py b/tests/gclient_test.py index 13e24ab09..df8c3ff0a 100755 --- a/tests/gclient_test.py +++ b/tests/gclient_test.py @@ -58,6 +58,7 @@ class GclientTestCase(GClientBaseTestCase): deps_file='a_deps_file_name', force=False, nohooks=False): self.verbose = verbose self.spec = spec + self.name = None self.config_filename = config_filename self.entries_filename = entries_filename self.deps_file = deps_file