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

Side by Side Diff: gclient.py

Issue 3014027: Add comments to clarify the purpose of some member variables. (Closed)
Patch Set: Created 10 years, 5 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
« 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 # These 2 are only set in .gclient and not in DEPS files. 147 # These 2 are only set in .gclient and not in DEPS files.
148 self.safesync_url = safesync_url 148 self.safesync_url = safesync_url
149 self.custom_vars = custom_vars or {} 149 self.custom_vars = custom_vars or {}
150 self.custom_deps = custom_deps or {} 150 self.custom_deps = custom_deps or {}
151 self.deps_hooks = [] 151 self.deps_hooks = []
152 self.dependencies = [] 152 self.dependencies = []
153 self.deps_file = deps_file or self.DEPS_FILE 153 self.deps_file = deps_file or self.DEPS_FILE
154 # A cache of the files affected by the current operation, necessary for 154 # A cache of the files affected by the current operation, necessary for
155 # hooks. 155 # hooks.
156 self.file_list = [] 156 self.file_list = []
157 # If it is not set to True, the dependency wasn't processed for its child
158 # dependency, i.e. its DEPS wasn't read.
157 self.deps_parsed = False 159 self.deps_parsed = False
160 # A direct reference is dependency that is referenced by a deps, deps_os or
161 # solution. A indirect one is one that was loaded with From() or that
162 # exceeded recursion limit.
158 self.direct_reference = False 163 self.direct_reference = False
159 164
160 # Sanity checks 165 # Sanity checks
161 if not self.name and self.parent: 166 if not self.name and self.parent:
162 raise gclient_utils.Error('Dependency without name') 167 raise gclient_utils.Error('Dependency without name')
163 tree = dict((d.name, d) for d in self.tree(False)) 168 tree = dict((d.name, d) for d in self.tree(False))
164 if self.name in tree: 169 if self.name in tree:
165 raise gclient_utils.Error( 170 raise gclient_utils.Error(
166 'Dependency %s specified more than once:\n %s\nvs\n %s' % 171 'Dependency %s specified more than once:\n %s\nvs\n %s' %
167 (self.name, tree[self.name].hierarchy(), self.hierarchy())) 172 (self.name, tree[self.name].hierarchy(), self.hierarchy()))
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 # normpath is required to allow DEPS to use .. in their 289 # normpath is required to allow DEPS to use .. in their
285 # dependency local path. 290 # dependency local path.
286 rel_deps[os.path.normpath(os.path.join(self.name, d))] = url 291 rel_deps[os.path.normpath(os.path.join(self.name, d))] = url
287 deps = rel_deps 292 deps = rel_deps
288 293
289 # Convert the deps into real Dependency. 294 # Convert the deps into real Dependency.
290 for name, url in deps.iteritems(): 295 for name, url in deps.iteritems():
291 if name in [s.name for s in self.dependencies]: 296 if name in [s.name for s in self.dependencies]:
292 raise 297 raise
293 self.dependencies.append(Dependency(self, name, url)) 298 self.dependencies.append(Dependency(self, name, url))
299 # Note: do not sort by name, the dependencies must be specified in the
300 # logical order.
294 logging.info('Loaded: %s' % str(self)) 301 logging.info('Loaded: %s' % str(self))
295 302
296 def RunCommandRecursively(self, options, revision_overrides, 303 def RunCommandRecursively(self, options, revision_overrides,
297 command, args, pm): 304 command, args, pm):
298 """Runs 'command' before parsing the DEPS in case it's a initial checkout 305 """Runs 'command' before parsing the DEPS in case it's a initial checkout
299 or a revert.""" 306 or a revert."""
300 assert self.file_list == [] 307 assert self.file_list == []
301 # When running runhooks, there's no need to consult the SCM. 308 # When running runhooks, there's no need to consult the SCM.
302 # All known hooks are expected to run unconditionally regardless of working 309 # All known hooks are expected to run unconditionally regardless of working
303 # copy state, so skip the SCM status check. 310 # copy state, so skip the SCM status check.
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 return CMDhelp(parser, argv) 1150 return CMDhelp(parser, argv)
1144 except gclient_utils.Error, e: 1151 except gclient_utils.Error, e:
1145 print >> sys.stderr, 'Error: %s' % str(e) 1152 print >> sys.stderr, 'Error: %s' % str(e)
1146 return 1 1153 return 1
1147 1154
1148 1155
1149 if '__main__' == __name__: 1156 if '__main__' == __name__:
1150 sys.exit(Main(sys.argv[1:])) 1157 sys.exit(Main(sys.argv[1:]))
1151 1158
1152 # vim: ts=2:sw=2:tw=80:et: 1159 # 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