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

Side by Side Diff: git_cl.py

Issue 335723002: Correct remote URL when uploading from a repo cloned from a git_cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 6 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 | no next file » | 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 """ 651 """
652 return RunGit(['config', 'branch.%s.base-url' % self.GetBranch()], 652 return RunGit(['config', 'branch.%s.base-url' % self.GetBranch()],
653 error_ok=True).strip() 653 error_ok=True).strip()
654 654
655 def GetRemoteUrl(self): 655 def GetRemoteUrl(self):
656 """Return the configured remote URL, e.g. 'git://example.org/foo.git/'. 656 """Return the configured remote URL, e.g. 'git://example.org/foo.git/'.
657 657
658 Returns None if there is no remote. 658 Returns None if there is no remote.
659 """ 659 """
660 remote, _ = self.GetRemoteBranch() 660 remote, _ = self.GetRemoteBranch()
661 return RunGit(['config', 'remote.%s.url' % remote], error_ok=True).strip() 661 url = RunGit(['config', 'remote.%s.url' % remote], error_ok=True).strip()
662
663 # If URL is pointing to a local directory, it is probably a git cache.
664 if os.path.isdir(url):
665 url = RunGit(['config', 'remote.%s.url' % remote],
666 error_ok=True,
667 cwd=url).strip()
668 return url
662 669
663 def GetIssue(self): 670 def GetIssue(self):
664 """Returns the issue number as a int or None if not set.""" 671 """Returns the issue number as a int or None if not set."""
665 if self.issue is None and not self.lookedup_issue: 672 if self.issue is None and not self.lookedup_issue:
666 issue = RunGit(['config', self._IssueSetting()], error_ok=True).strip() 673 issue = RunGit(['config', self._IssueSetting()], error_ok=True).strip()
667 self.issue = int(issue) or None if issue else None 674 self.issue = int(issue) or None if issue else None
668 self.lookedup_issue = True 675 self.lookedup_issue = True
669 return self.issue 676 return self.issue
670 677
671 def GetRietveldServer(self): 678 def GetRietveldServer(self):
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after
2618 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2625 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2619 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2626 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2620 2627
2621 2628
2622 if __name__ == '__main__': 2629 if __name__ == '__main__':
2623 # These affect sys.stdout so do it outside of main() to simplify mocks in 2630 # These affect sys.stdout so do it outside of main() to simplify mocks in
2624 # unit testing. 2631 # unit testing.
2625 fix_encoding.fix_encoding() 2632 fix_encoding.fix_encoding()
2626 colorama.init() 2633 colorama.init()
2627 sys.exit(main(sys.argv[1:])) 2634 sys.exit(main(sys.argv[1:]))
OLDNEW
« 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