From d993e78d3b873d5fa7538ea49724f7b44b8fc81d Mon Sep 17 00:00:00 2001 From: "jochen@chromium.org" Date: Thu, 11 Apr 2013 20:03:13 +0000 Subject: [PATCH] Add the --nosvn property to the chromium solution. This allows non-committers to use fetch to checkout chromium or blink using $ fetch chromium --nosvn=true BUG=230357 R=dpranke@chromium.org Review URL: https://codereview.chromium.org/13910005 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@193713 0039d316-1c4b-4281-b951-d872f2087c98 --- fetch.py | 40 +++++++++++++++++++++++++--------------- recipes/chromium.py | 8 ++++++-- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/fetch.py b/fetch.py index 80dcce9a2..1e5d688f0 100755 --- a/fetch.py +++ b/fetch.py @@ -83,33 +83,20 @@ class SvnCheckout(Checkout): return subprocess.check_call(('svn',) + cmd, **kwargs) -class GclientGitSvnCheckout(GclientCheckout, GitCheckout, SvnCheckout): +class GclientGitCheckout(GclientCheckout, GitCheckout): def __init__(self, dryrun, spec, root): - super(GclientGitSvnCheckout, self).__init__(dryrun, spec, root) + super(GclientGitCheckout, self).__init__(dryrun, spec, root) assert 'solutions' in self.spec keys = ['solutions', 'target_os', 'target_os_only'] gclient_spec = '\n'.join('%s = %s' % (key, self.spec[key]) for key in self.spec if key in keys) self.spec['gclient_spec'] = gclient_spec - assert 'svn_url' in self.spec - assert 'svn_branch' in self.spec - assert 'svn_ref' in self.spec def exists(self): return os.path.exists(os.path.join(os.getcwd(), self.root)) def init(self): - # Ensure we are authenticated with subversion for all submodules. - git_svn_dirs = json.loads(self.spec.get('submodule_git_svn_spec', '{}')) - git_svn_dirs.update({self.root: self.spec}) - for _, svn_spec in git_svn_dirs.iteritems(): - try: - self.run_svn('ls', '--non-interactive', svn_spec['svn_url']) - except subprocess.CalledProcessError: - print 'Please run `svn ls %s`' % svn_spec['svn_url'] - return 1 - # TODO(dpranke): Work around issues w/ delta compression on big repos. self.run_git('config', '--global', 'core.deltaBaseCacheLimit', '1G') @@ -127,6 +114,28 @@ class GclientGitSvnCheckout(GclientCheckout, GitCheckout, SvnCheckout): cwd=wd) self.run_git('config', 'diff.ignoreSubmodules', 'all', cwd=wd) + +class GclientGitSvnCheckout(GclientGitCheckout, SvnCheckout): + + def __init__(self, dryrun, spec, root): + super(GclientGitSvnCheckout, self).__init__(dryrun, spec, root) + assert 'svn_url' in self.spec + assert 'svn_branch' in self.spec + assert 'svn_ref' in self.spec + + def init(self): + # Ensure we are authenticated with subversion for all submodules. + git_svn_dirs = json.loads(self.spec.get('submodule_git_svn_spec', '{}')) + git_svn_dirs.update({self.root: self.spec}) + for _, svn_spec in git_svn_dirs.iteritems(): + try: + self.run_svn('ls', '--non-interactive', svn_spec['svn_url']) + except subprocess.CalledProcessError: + print 'Please run `svn ls %s`' % svn_spec['svn_url'] + return 1 + + super(GclientGitSvnCheckout, self).init() + # Configure git-svn. for path, svn_spec in git_svn_dirs.iteritems(): real_path = os.path.join(*path.split('/')) @@ -146,6 +155,7 @@ class GclientGitSvnCheckout(GclientCheckout, GitCheckout, SvnCheckout): CHECKOUT_TYPE_MAP = { 'gclient': GclientCheckout, + 'gclient_git': GclientGitCheckout, 'gclient_git_svn': GclientGitSvnCheckout, 'git': GitCheckout, } diff --git a/recipes/chromium.py b/recipes/chromium.py index 3933d5be1..b9156ed92 100644 --- a/recipes/chromium.py +++ b/recipes/chromium.py @@ -30,9 +30,13 @@ class Chromium(recipe_util.Recipe): } if props.get('submodule_git_svn_spec'): spec['submodule_git_svn_spec'] = props['submodule_git_svn_spec'] + checkout_type = 'gclient_git_svn' + if props.get('nosvn'): + checkout_type = 'gclient_git' + spec_type = '%s_spec' % checkout_type return { - 'type': 'gclient_git_svn', - 'gclient_git_svn_spec': spec + 'type': checkout_type, + spec_type: spec } @staticmethod