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

Side by Side Diff: gclient.py

Issue 9443025: Remove a check that would break with pinned revision using ssh protocol with a user name in the url (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Meta checkout manager supporting both Subversion and GIT. 6 """Meta checkout manager supporting both Subversion and GIT.
7 7
8 Files 8 Files
9 .gclient : Current client configuration, written by 'config' command. 9 .gclient : Current client configuration, written by 'config' command.
10 Format is a Python script defining 'solutions', a list whose 10 Format is a Python script defining 'solutions', a list whose
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 def GetPath(self): 115 def GetPath(self):
116 return os.path.split(self.file_location)[0] 116 return os.path.split(self.file_location)[0]
117 117
118 def GetFilename(self): 118 def GetFilename(self):
119 rev_tokens = self.file_location.split('@') 119 rev_tokens = self.file_location.split('@')
120 return os.path.split(rev_tokens[0])[1] 120 return os.path.split(rev_tokens[0])[1]
121 121
122 def GetRevision(self): 122 def GetRevision(self):
123 rev_tokens = self.file_location.split('@') 123 rev_tokens = self.file_location.split('@')
124 if len(rev_tokens) > 1: 124 if len(rev_tokens) > 1:
125 return rev_tokens[1] 125 return rev_tokens[1]
Peter Mayo 2012/02/23 20:32:56 Is this check correct if we remove the restriction
M-A Ruel 2012/02/23 20:50:07 In theory, yes, in practice, it's not a problem be
126 return None 126 return None
127 127
128 class VarImpl(object): 128 class VarImpl(object):
129 def __init__(self, custom_vars, local_scope): 129 def __init__(self, custom_vars, local_scope):
130 self._custom_vars = custom_vars 130 self._custom_vars = custom_vars
131 self._local_scope = local_scope 131 self._local_scope = local_scope
132 132
133 def Lookup(self, var_name): 133 def Lookup(self, var_name):
134 """Implements the Var syntax.""" 134 """Implements the Var syntax."""
135 if var_name in self._custom_vars: 135 if var_name in self._custom_vars:
(...skipping 25 matching lines...) Expand all
161 self._should_process = should_process 161 self._should_process = should_process
162 162
163 # These are only set in .gclient and not in DEPS files. 163 # These are only set in .gclient and not in DEPS files.
164 self._custom_vars = custom_vars or {} 164 self._custom_vars = custom_vars or {}
165 self._custom_deps = custom_deps or {} 165 self._custom_deps = custom_deps or {}
166 166
167 # Post process the url to remove trailing slashes. 167 # Post process the url to remove trailing slashes.
168 if isinstance(self._url, basestring): 168 if isinstance(self._url, basestring):
169 # urls are sometime incorrectly written as proto://host/path/@rev. Replace 169 # urls are sometime incorrectly written as proto://host/path/@rev. Replace
170 # it to proto://host/path@rev. 170 # it to proto://host/path@rev.
171 if self._url.count('@') > 1:
172 raise gclient_utils.Error('Invalid url "%s"' % self._url)
173 self._url = self._url.replace('/@', '@') 171 self._url = self._url.replace('/@', '@')
Peter Mayo 2012/02/23 20:32:56 I think the RFC precludes using slashes in the use
Peter Mayo 2012/02/23 20:49:57 1738 section 3.1 requires encoding of the @ and /
M-A Ruel 2012/02/23 20:50:07 As long as we make sure it doesn't work, it's fine
M-A Ruel 2012/02/23 20:51:04 The important part is that it'll fail to sync. Whi
174 elif not isinstance(self._url, 172 elif not isinstance(self._url,
175 (self.FromImpl, self.FileImpl, None.__class__)): 173 (self.FromImpl, self.FileImpl, None.__class__)):
176 raise gclient_utils.Error( 174 raise gclient_utils.Error(
177 ('dependency url must be either a string, None, ' 175 ('dependency url must be either a string, None, '
178 'File() or From() instead of %s') % self._url.__class__.__name__) 176 'File() or From() instead of %s') % self._url.__class__.__name__)
179 if '/' in self._deps_file or '\\' in self._deps_file: 177 if '/' in self._deps_file or '\\' in self._deps_file:
180 raise gclient_utils.Error('deps_file name must not be a path, just a ' 178 raise gclient_utils.Error('deps_file name must not be a path, just a '
181 'filename. %s' % self._deps_file) 179 'filename. %s' % self._deps_file)
182 180
183 @property 181 @property
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 1538 except (gclient_utils.Error, subprocess2.CalledProcessError), e:
1541 print >> sys.stderr, 'Error: %s' % str(e) 1539 print >> sys.stderr, 'Error: %s' % str(e)
1542 return 1 1540 return 1
1543 1541
1544 1542
1545 if '__main__' == __name__: 1543 if '__main__' == __name__:
1546 fix_encoding.fix_encoding() 1544 fix_encoding.fix_encoding()
1547 sys.exit(Main(sys.argv[1:])) 1545 sys.exit(Main(sys.argv[1:]))
1548 1546
1549 # vim: ts=2:sw=2:tw=80:et: 1547 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698