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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 if 0 == subprocess.call( | 136 if 0 == subprocess.call( |
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 subprocess.check_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) |
| 148 subprocess.check_call([git, 'fetch', '--quiet'], cwd=directory) |
| 149 subprocess.check_call([git, 'checkout', '--quiet'], cwd=directory) |
147 | 150 |
148 if verbose: | 151 if verbose: |
149 sys.stdout.write('%s\n @ %s\n' % (directory, checkoutable)) # Success. | 152 sys.stdout.write('%s\n @ %s\n' % (directory, checkoutable)) # Success. |
150 | 153 |
151 | 154 |
152 def parse_file_to_dict(path): | 155 def parse_file_to_dict(path): |
153 dictionary = {} | 156 dictionary = {} |
154 execfile(path, dictionary) | 157 execfile(path, dictionary) |
155 return dictionary | 158 return dictionary |
156 | 159 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 if '--help' in argv or '-h' in argv: | 220 if '--help' in argv or '-h' in argv: |
218 usage(deps_file_path) | 221 usage(deps_file_path) |
219 return 1 | 222 return 1 |
220 | 223 |
221 git_sync_deps(deps_file_path, argv, verbose) | 224 git_sync_deps(deps_file_path, argv, verbose) |
222 return 0 | 225 return 0 |
223 | 226 |
224 | 227 |
225 if __name__ == '__main__': | 228 if __name__ == '__main__': |
226 exit(main(sys.argv[1:])) | 229 exit(main(sys.argv[1:])) |
OLD | NEW |