Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 # If you have any "svn-remote.*" config keys, we think you're using svn. | 330 # If you have any "svn-remote.*" config keys, we think you're using svn. |
|
iannucci
2014/06/30 18:08:11
can you update the comment too? Something like:
I
| |
| 331 self.is_git_svn = RunGitWithCode( | 331 code, result = RunGitWithCode( |
| 332 ['config', '--local', '--get-regexp', r'^svn-remote\.'])[0] == 0 | 332 ['config', '--local', '--get-regexp', r'^svn-remote\..*\.url']) |
| 333 self.is_git_svn = (code == 0 and "svn://" in result) | |
| 333 return self.is_git_svn | 334 return self.is_git_svn |
| 334 | 335 |
| 335 def GetSVNBranch(self): | 336 def GetSVNBranch(self): |
| 336 if self.svn_branch is None: | 337 if self.svn_branch is None: |
| 337 if not self.GetIsGitSvn(): | 338 if not self.GetIsGitSvn(): |
| 338 DieWithError('Repo doesn\'t appear to be a git-svn repo.') | 339 DieWithError('Repo doesn\'t appear to be a git-svn repo.') |
| 339 | 340 |
| 340 # Try to figure out which remote branch we're based on. | 341 # Try to figure out which remote branch we're based on. |
| 341 # Strategy: | 342 # Strategy: |
| 342 # 1) iterate through our branch history and find the svn URL. | 343 # 1) iterate through our branch history and find the svn URL. |
| (...skipping 2289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2632 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 2633 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 2633 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 2634 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
| 2634 | 2635 |
| 2635 | 2636 |
| 2636 if __name__ == '__main__': | 2637 if __name__ == '__main__': |
| 2637 # These affect sys.stdout so do it outside of main() to simplify mocks in | 2638 # These affect sys.stdout so do it outside of main() to simplify mocks in |
| 2638 # unit testing. | 2639 # unit testing. |
| 2639 fix_encoding.fix_encoding() | 2640 fix_encoding.fix_encoding() |
| 2640 colorama.init() | 2641 colorama.init() |
| 2641 sys.exit(main(sys.argv[1:])) | 2642 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |