| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """A git command for managing a local cache of git repositories.""" | 6 """A git command for managing a local cache of git repositories.""" |
| 7 | 7 |
| 8 from __future__ import print_function | 8 from __future__ import print_function |
| 9 import errno | 9 import errno |
| 10 import logging | 10 import logging |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 def i_am_locking(self): | 136 def i_am_locking(self): |
| 137 """Test if the file is locked by this process.""" | 137 """Test if the file is locked by this process.""" |
| 138 return self.is_locked() and self.pid == self._read_pid() | 138 return self.is_locked() and self.pid == self._read_pid() |
| 139 | 139 |
| 140 | 140 |
| 141 class Mirror(object): | 141 class Mirror(object): |
| 142 | 142 |
| 143 git_exe = 'git.bat' if sys.platform.startswith('win') else 'git' | 143 git_exe = 'git.bat' if sys.platform.startswith('win') else 'git' |
| 144 gsutil_exe = os.path.join( | 144 gsutil_exe = os.path.join( |
| 145 os.path.dirname(os.path.abspath(__file__)), | 145 os.path.dirname(os.path.abspath(__file__)), 'gsutil.py') |
| 146 'third_party', 'gsutil', 'gsutil') | |
| 147 cachepath_lock = threading.Lock() | 146 cachepath_lock = threading.Lock() |
| 148 | 147 |
| 149 def __init__(self, url, refs=None, print_func=None): | 148 def __init__(self, url, refs=None, print_func=None): |
| 150 self.url = url | 149 self.url = url |
| 151 self.refs = refs or [] | 150 self.refs = refs or [] |
| 152 self.basedir = self.UrlToCacheDir(url) | 151 self.basedir = self.UrlToCacheDir(url) |
| 153 self.mirror_path = os.path.join(self.GetCachePath(), self.basedir) | 152 self.mirror_path = os.path.join(self.GetCachePath(), self.basedir) |
| 154 self.print = print_func or print | 153 self.print = print_func or print |
| 155 | 154 |
| 156 @property | 155 @property |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 return options, args | 684 return options, args |
| 686 | 685 |
| 687 | 686 |
| 688 def main(argv): | 687 def main(argv): |
| 689 dispatcher = subcommand.CommandDispatcher(__name__) | 688 dispatcher = subcommand.CommandDispatcher(__name__) |
| 690 return dispatcher.execute(OptionParser(), argv) | 689 return dispatcher.execute(OptionParser(), argv) |
| 691 | 690 |
| 692 | 691 |
| 693 if __name__ == '__main__': | 692 if __name__ == '__main__': |
| 694 sys.exit(main(sys.argv[1:])) | 693 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |