Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: fetch.py

Issue 656623003: Update fetch to support more flexible refspecs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: fetch.py
diff --git a/fetch.py b/fetch.py
index f5640cc95a2ea0a70df6788732842f8fa76b328b..e579f916ed4c32411bcc8eefd9e1d96aeaff3166 100755
--- a/fetch.py
+++ b/fetch.py
@@ -139,20 +139,18 @@ class GclientGitSvnCheckout(GclientGitCheckout, SvnCheckout):
def __init__(self, options, spec, root):
super(GclientGitSvnCheckout, self).__init__(options, 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
+ if svn_spec.get('svn_url'):
+ 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()
@@ -164,12 +162,17 @@ class GclientGitSvnCheckout(GclientGitCheckout, SvnCheckout):
wd = os.path.join(self.base, real_path)
if self.options.dry_run:
print 'cd %s' % wd
- prefix = svn_spec.get('svn_prefix', 'origin/')
- self.run_git('svn', 'init', '--prefix=' + prefix, '-T',
- svn_spec['svn_branch'], svn_spec['svn_url'], cwd=wd)
- self.run_git('config', '--replace', 'svn-remote.svn.fetch',
- svn_spec['svn_branch'] + ':refs/remotes/' + prefix +
- svn_spec['svn_ref'], cwd=wd)
+ if svn_spec.get('auto'):
+ self.run_git('auto-svn', cwd=wd)
+ continue
+ self.run_git('svn', 'init', svn_spec['svn_url'], cwd=wd)
+ self.run_git('config', '--unset-all', 'svn-remote.svn.fetch', cwd=wd)
+ for svn_branch, git_ref in svn_spec.get('git_svn_fetch', {}).items():
+ self.run_git('config', '--add', 'svn-remote.svn.fetch',
+ '%s:%s' % (svn_branch, git_ref), cwd=wd)
+ for svn_branch, git_ref in svn_spec.get('git_svn_branches', {}).items():
+ self.run_git('config', '--add', 'svn-remote.svn.branches',
+ '%s:%s' % (svn_branch, git_ref), cwd=wd)
self.run_git('svn', 'fetch', cwd=wd)

Powered by Google App Engine
This is Rietveld 408576698