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

Unified Diff: gclient_scm.py

Issue 2018803002: Improve diagnostic message for wrong gclient config (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Fix parens Created 4 years, 7 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 | « gclient.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 9a6f5123419cef246e638dc28ae3caf0679cd4ee..5cf839f0079aa4608cdab28824e2e9d3481d804f 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -173,19 +173,24 @@ class SCMWrapper(object):
# Get the second token of the first line of the log.
return log.splitlines()[0].split(' ', 1)[1]
+ def GetCacheMirror(self):
+ if (getattr(self, 'cache_dir', None)):
+ url, _ = gclient_utils.SplitUrlRevision(self.url)
+ return git_cache.Mirror(url)
+ return None
+
def GetActualRemoteURL(self, options):
"""Attempt to determine the remote URL for this SCMWrapper."""
# Git
if os.path.exists(os.path.join(self.checkout_path, '.git')):
actual_remote_url = self._get_first_remote_url(self.checkout_path)
- # If a cache_dir is used, obtain the actual remote URL from the cache.
- if getattr(self, 'cache_dir', None):
- url, _ = gclient_utils.SplitUrlRevision(self.url)
- mirror = git_cache.Mirror(url)
- if (mirror.exists() and mirror.mirror_path.replace('\\', '/') ==
- actual_remote_url.replace('\\', '/')):
- actual_remote_url = self._get_first_remote_url(mirror.mirror_path)
+ mirror = self.GetCacheMirror()
+ # If the cache is used, obtain the actual remote URL from there.
+ if (mirror and mirror.exists() and
+ mirror.mirror_path.replace('\\', '/') ==
+ actual_remote_url.replace('\\', '/')):
+ actual_remote_url = self._get_first_remote_url(mirror.mirror_path)
return actual_remote_url
# Svn
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698