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

Unified Diff: gclient.py

Issue 8122005: Move more immutable members to DependencySettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: address review comment Created 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index 671250c7eae55dbf3e4db2537b79644b9ab29f99..6962c9e26d3725fd93602534d946d8fad031fcbc 100644
--- a/gclient.py
+++ b/gclient.py
@@ -179,22 +179,26 @@ class DependencySettings(GClientKeywords):
@property
def deps_file(self):
- """Immutable so no need to lock."""
return self._deps_file
@property
def managed(self):
- """Immutable so no need to lock."""
return self._managed
@property
def parent(self):
- """Immutable so no need to lock."""
return self._parent
@property
+ def root(self):
+ """Returns the root node, a GClient object."""
+ if not self.parent:
+ # This line is to signal pylint that it could be a GClient instance.
+ return self or GClient(None, None)
+ return self.parent.root
+
+ @property
def safesync_url(self):
- """Immutable so no need to lock."""
return self._safesync_url
@property
@@ -204,18 +208,28 @@ class DependencySettings(GClientKeywords):
@property
def custom_vars(self):
- """Immutable so no need to lock."""
return self._custom_vars.copy()
@property
def custom_deps(self):
- """Immutable so no need to lock."""
return self._custom_deps.copy()
@property
def url(self):
return self._url
+ @property
+ def recursion_limit(self):
+ """Returns > 0 if this dependency is not too recursed to be processed."""
+ return max(self.parent.recursion_limit - 1, 0)
+
+ def get_custom_deps(self, name, url):
+ """Returns a custom deps if applicable."""
+ if self.parent:
+ url = self.parent.get_custom_deps(name, url)
+ # None is a valid return value to disable a dependency.
+ return self.custom_deps.get(name, url)
+
class Dependency(gclient_utils.WorkItem, DependencySettings):
"""Object that represents a dependency checkout."""
@@ -619,21 +633,6 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
if j.should_process:
yield j
- def get_custom_deps(self, name, url):
- """Returns a custom deps if applicable."""
- if self.parent:
- url = self.parent.get_custom_deps(name, url)
- # None is a valid return value to disable a dependency.
- return self.custom_deps.get(name, url)
-
- @property
- def recursion_limit(self):
- """Returns > 0 if this dependency is not too recursed to be processed.
-
- Immutable so no need to lock.
- """
- return max(self.parent.recursion_limit - 1, 0)
-
@property
def dependencies(self):
return tuple(self._dependencies)
@@ -695,14 +694,6 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
i = i.parent
return out
- @property
- def root(self):
- """Returns the root node, a GClient object."""
- if not self.parent:
- # This line is to signal pylint that it could be a GClient instance.
- return self or GClient(None, None)
- return self.parent.root
-
class GClient(Dependency):
"""Object that represent a gclient checkout. A tree of Dependency(), one per
« 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