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

Side by Side Diff: git_cl.py

Issue 375553002: Revert of Allow git cl also in repos with read-only git-svn. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 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 | tests/git_cl_test.py » ('j') | 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 # Copyright (C) 2008 Evan Martin <martine@danga.com> 6 # Copyright (C) 2008 Evan Martin <martine@danga.com>
7 7
8 """A git-command for integrating reviews on Rietveld.""" 8 """A git-command for integrating reviews on Rietveld."""
9 9
10 import datetime 10 import datetime
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 return RunGit(['rev-parse', '--show-cdup']).strip() 320 return RunGit(['rev-parse', '--show-cdup']).strip()
321 321
322 def GetRoot(self): 322 def GetRoot(self):
323 if self.root is None: 323 if self.root is None:
324 self.root = os.path.abspath(self.GetRelativeRoot()) 324 self.root = os.path.abspath(self.GetRelativeRoot())
325 return self.root 325 return self.root
326 326
327 def GetIsGitSvn(self): 327 def GetIsGitSvn(self):
328 """Return true if this repo looks like it's using git-svn.""" 328 """Return true if this repo looks like it's using git-svn."""
329 if self.is_git_svn is None: 329 if self.is_git_svn is None:
330 # The presence of a svn-remote using the svn:// (or file://) 330 # If you have any "svn-remote.*" config keys, we think you're using svn.
331 # protocol suggests that you're using svn. Remotes with the 331 self.is_git_svn = RunGitWithCode(
332 # http* protocols suggest read-only svn access and are ignored. 332 ['config', '--local', '--get-regexp', r'^svn-remote\.'])[0] == 0
333 code, result = RunGitWithCode(
334 ['config', '--local', '--get-regexp', r'^svn-remote\..*\.url'])
335 self.is_git_svn = (code == 0 and ("svn://" in result or
336 "file://" in result))
337 return self.is_git_svn 333 return self.is_git_svn
338 334
339 def GetSVNBranch(self): 335 def GetSVNBranch(self):
340 if self.svn_branch is None: 336 if self.svn_branch is None:
341 if not self.GetIsGitSvn(): 337 if not self.GetIsGitSvn():
342 DieWithError('Repo doesn\'t appear to be a git-svn repo.') 338 DieWithError('Repo doesn\'t appear to be a git-svn repo.')
343 339
344 # Try to figure out which remote branch we're based on. 340 # Try to figure out which remote branch we're based on.
345 # Strategy: 341 # Strategy:
346 # 1) iterate through our branch history and find the svn URL. 342 # 1) iterate through our branch history and find the svn URL.
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after
2654 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2650 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2655 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2651 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2656 2652
2657 2653
2658 if __name__ == '__main__': 2654 if __name__ == '__main__':
2659 # These affect sys.stdout so do it outside of main() to simplify mocks in 2655 # These affect sys.stdout so do it outside of main() to simplify mocks in
2660 # unit testing. 2656 # unit testing.
2661 fix_encoding.fix_encoding() 2657 fix_encoding.fix_encoding()
2662 colorama.init() 2658 colorama.init()
2663 sys.exit(main(sys.argv[1:])) 2659 sys.exit(main(sys.argv[1:]))
OLDNEW
« 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