OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2014 Google Inc. | 2 # Copyright 2014 Google Inc. |
3 # | 3 # |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 | 7 |
8 """Parse a DEPS file and git checkout all of the dependencies. | 8 """Parse a DEPS file and git checkout all of the dependencies. |
9 | 9 |
10 Args: | 10 Args: |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 [git, 'checkout', '--quiet', checkoutable], cwd=directory): | 137 [git, 'checkout', '--quiet', checkoutable], cwd=directory): |
138 # if this succeeds, skip slow `git fetch`. | 138 # if this succeeds, skip slow `git fetch`. |
139 if verbose: | 139 if verbose: |
140 sys.stdout.write('%s\n @ %s\n' % (directory, checkoutable)) | 140 sys.stdout.write('%s\n @ %s\n' % (directory, checkoutable)) |
141 return | 141 return |
142 | 142 |
143 subprocess.check_call([git, 'fetch', '--quiet'], cwd=directory) | 143 subprocess.check_call([git, 'fetch', '--quiet'], cwd=directory) |
144 | 144 |
145 if 0 != subprocess.call( | 145 if 0 != subprocess.call( |
146 [git, 'checkout', '--quiet', checkoutable], cwd=directory): | 146 [git, 'checkout', '--quiet', checkoutable], cwd=directory): |
147 subprocess.check_call([git, 'remote', 'set-url', repo], cwd=directory) | 147 subprocess.check_call( |
| 148 [git, 'remote', 'set-url', 'origin', repo], cwd=directory) |
148 subprocess.check_call([git, 'fetch', '--quiet'], cwd=directory) | 149 subprocess.check_call([git, 'fetch', '--quiet'], cwd=directory) |
149 subprocess.check_call([git, 'checkout', '--quiet'], cwd=directory) | 150 subprocess.check_call([git, 'checkout', '--quiet'], cwd=directory) |
150 | 151 |
151 if verbose: | 152 if verbose: |
152 sys.stdout.write('%s\n @ %s\n' % (directory, checkoutable)) # Success. | 153 sys.stdout.write('%s\n @ %s\n' % (directory, checkoutable)) # Success. |
153 | 154 |
154 | 155 |
155 def parse_file_to_dict(path): | 156 def parse_file_to_dict(path): |
156 dictionary = {} | 157 dictionary = {} |
157 execfile(path, dictionary) | 158 execfile(path, dictionary) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 if '--help' in argv or '-h' in argv: | 221 if '--help' in argv or '-h' in argv: |
221 usage(deps_file_path) | 222 usage(deps_file_path) |
222 return 1 | 223 return 1 |
223 | 224 |
224 git_sync_deps(deps_file_path, argv, verbose) | 225 git_sync_deps(deps_file_path, argv, verbose) |
225 return 0 | 226 return 0 |
226 | 227 |
227 | 228 |
228 if __name__ == '__main__': | 229 if __name__ == '__main__': |
229 exit(main(sys.argv[1:])) | 230 exit(main(sys.argv[1:])) |
OLD | NEW |