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

Unified Diff: git_cl.py

Issue 271703010: use canonical base URL for projects (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: keep using base-url Created 6 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 | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 06594f0404ed534b938239da25437cac45089f70..e18b3d3592e2dcaf95b65ce8d361b42b1a01a645 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -635,12 +635,17 @@ or verify this branch is set up to track another (via the --track argument to
return True
def GetGitBaseUrlFromConfig(self):
- """Return the configured base URL from branch.<branchname>.baseurl.
+ """Return the configured base URL from branch.<branchname>.canonical-url.
Returns None if it is not set.
"""
- return RunGit(['config', 'branch.%s.base-url' % self.GetBranch()],
+ branch = self.GetBranch()
+ url = RunGit(['config', 'branch.%s.canonical-url' % branch],
+ error_ok=True).strip()
Sergey Berezin 2014/05/13 22:51:07 nit: It looks like the 'error_ok' argument is not
sheyang 2014/05/13 23:38:59 Done.
+ if not url:
+ url = RunGit(['config', 'branch.%s.base-url' % branch],
error_ok=True).strip()
Sergey Berezin 2014/05/13 22:51:07 Same as above.
Sergey Berezin 2014/05/13 22:51:07 Same as above.
sheyang 2014/05/13 23:38:59 Done.
+ return url
def GetRemoteUrl(self):
"""Return the configured remote URL, e.g. 'git://example.org/foo.git/'.
@@ -1074,6 +1079,13 @@ def LoadCodereviewSettingsFromFile(fileobj):
RunGit(['config', keyvals['PUSH_URL_CONFIG'],
keyvals['ORIGIN_URL_CONFIG']])
+ if 'CANONICAL_URL' in keyvals:
+ branchref = RunGit(['symbolic-ref', 'HEAD']).strip()
+ branch = ShortBranchName(branchref)
+ RunGit(['config', 'branch.%s.canonical-url' % branch,
+ keyvals['CANONICAL_URL']],
+ error_ok=False)
+
def urlretrieve(source, destination):
"""urllib is broken for SSL connections via a proxy therefore we
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698