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

Side by Side Diff: git_cl.py

Issue 1777043002: Don't use 'git remote get-url', which is a new-ish feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 4 years, 9 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 | Annotate | Revision Log
« 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 from distutils.version import LooseVersion 10 from distutils.version import LooseVersion
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 def GetRelativeRoot(): 624 def GetRelativeRoot():
625 return RunGit(['rev-parse', '--show-cdup']).strip() 625 return RunGit(['rev-parse', '--show-cdup']).strip()
626 626
627 def GetRoot(self): 627 def GetRoot(self):
628 if self.root is None: 628 if self.root is None:
629 self.root = os.path.abspath(self.GetRelativeRoot()) 629 self.root = os.path.abspath(self.GetRelativeRoot())
630 return self.root 630 return self.root
631 631
632 def GetGitMirror(self, remote='origin'): 632 def GetGitMirror(self, remote='origin'):
633 """If this checkout is from a local git mirror, return a Mirror object.""" 633 """If this checkout is from a local git mirror, return a Mirror object."""
634 local_url = RunGit(['remote', 'get-url', remote]).strip() 634 local_url = RunGit(['config', '--get', 'remote.%s.url' % remote]).strip()
635 if not os.path.isdir(local_url): 635 if not os.path.isdir(local_url):
636 return None 636 return None
637 git_cache.Mirror.SetCachePath(os.path.dirname(local_url)) 637 git_cache.Mirror.SetCachePath(os.path.dirname(local_url))
638 remote_url = git_cache.Mirror.CacheDirToUrl(local_url) 638 remote_url = git_cache.Mirror.CacheDirToUrl(local_url)
639 # Use the /dev/null print_func to avoid terminal spew in WaitForRealCommit. 639 # Use the /dev/null print_func to avoid terminal spew in WaitForRealCommit.
640 mirror = git_cache.Mirror(remote_url, print_func = lambda *args: None) 640 mirror = git_cache.Mirror(remote_url, print_func = lambda *args: None)
641 if mirror.exists(): 641 if mirror.exists():
642 return mirror 642 return mirror
643 return None 643 return None
644 644
(...skipping 3338 matching lines...) Expand 10 before | Expand all | Expand 10 after
3983 if __name__ == '__main__': 3983 if __name__ == '__main__':
3984 # These affect sys.stdout so do it outside of main() to simplify mocks in 3984 # These affect sys.stdout so do it outside of main() to simplify mocks in
3985 # unit testing. 3985 # unit testing.
3986 fix_encoding.fix_encoding() 3986 fix_encoding.fix_encoding()
3987 colorama.init() 3987 colorama.init()
3988 try: 3988 try:
3989 sys.exit(main(sys.argv[1:])) 3989 sys.exit(main(sys.argv[1:]))
3990 except KeyboardInterrupt: 3990 except KeyboardInterrupt:
3991 sys.stderr.write('interrupted\n') 3991 sys.stderr.write('interrupted\n')
3992 sys.exit(1) 3992 sys.exit(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