Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright 2008 Google Inc. All Rights Reserved. | 3 # Copyright 2008 Google Inc. All Rights Reserved. |
| 4 # | 4 # |
| 5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
| 7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
| 8 # | 8 # |
| 9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 # | 10 # |
| (...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1318 for solution in solutions: | 1318 for solution in solutions: |
| 1319 name = solution["name"] | 1319 name = solution["name"] |
| 1320 if name in entries: | 1320 if name in entries: |
| 1321 raise Error("solution %s specified more than once" % name) | 1321 raise Error("solution %s specified more than once" % name) |
| 1322 url = solution["url"] | 1322 url = solution["url"] |
| 1323 entries[name] = url | 1323 entries[name] = url |
| 1324 if run_scm: | 1324 if run_scm: |
| 1325 self._options.revision = revision_overrides.get(name) | 1325 self._options.revision = revision_overrides.get(name) |
| 1326 scm = SCMWrapper(url, self._root_dir, name) | 1326 scm = SCMWrapper(url, self._root_dir, name) |
| 1327 scm.RunCommand(command, self._options, args, file_list) | 1327 scm.RunCommand(command, self._options, args, file_list) |
| 1328 file_list = [os.path.join(name, file.strip()) for file in file_list] | |
| 1328 self._options.revision = None | 1329 self._options.revision = None |
| 1329 try: | 1330 try: |
| 1330 deps_content = FileRead(os.path.join(self._root_dir, name, | 1331 deps_content = FileRead(os.path.join(self._root_dir, name, |
| 1331 self._options.deps_file)) | 1332 self._options.deps_file)) |
| 1332 except IOError, e: | 1333 except IOError, e: |
| 1333 if e.errno != errno.ENOENT: | 1334 if e.errno != errno.ENOENT: |
| 1334 raise | 1335 raise |
| 1335 deps_content = "" | 1336 deps_content = "" |
| 1336 entries_deps_content[name] = deps_content | 1337 entries_deps_content[name] = deps_content |
| 1337 | 1338 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1361 deps[d].module_name, | 1362 deps[d].module_name, |
| 1362 self._options.deps_file)), | 1363 self._options.deps_file)), |
| 1363 {}) | 1364 {}) |
| 1364 url = sub_deps[d] | 1365 url = sub_deps[d] |
| 1365 entries[d] = url | 1366 entries[d] = url |
| 1366 if run_scm: | 1367 if run_scm: |
| 1367 self._options.revision = revision_overrides.get(d) | 1368 self._options.revision = revision_overrides.get(d) |
| 1368 scm = SCMWrapper(url, self._root_dir, d) | 1369 scm = SCMWrapper(url, self._root_dir, d) |
| 1369 scm.RunCommand(command, self._options, args, file_list) | 1370 scm.RunCommand(command, self._options, args, file_list) |
| 1370 self._options.revision = None | 1371 self._options.revision = None |
| 1372 | |
| 1373 # Convert all absolute paths to relative. | |
| 1374 for i in range(len(file_list)): | |
| 1375 if not os.path.isabs(file_list[i]): | |
|
M-A Ruel
2009/08/06 22:53:29
That should be deterministic.
M-A Ruel
2009/08/10 15:58:12
Just add a #TODO(you): Make it deterministic to be
| |
| 1376 continue | |
| 1377 | |
| 1378 prefix = os.path.commonprefix([self._root_dir.lower(), | |
| 1379 file_list[i].lower()]) | |
| 1380 file_list[i] = file_list[i][len(prefix):] | |
| 1381 | |
| 1382 # Strip any leading path separators. | |
| 1383 while file_list[i].startswith('\\') or file_list[i].startswith('/'): | |
| 1384 file_list[i] = file_list[i][1:] | |
| 1371 | 1385 |
| 1372 is_using_git = IsUsingGit(self._root_dir, entries.keys()) | 1386 is_using_git = IsUsingGit(self._root_dir, entries.keys()) |
| 1373 self._RunHooks(command, file_list, is_using_git) | 1387 self._RunHooks(command, file_list, is_using_git) |
| 1374 | 1388 |
| 1375 if command == 'update': | 1389 if command == 'update': |
| 1376 # Notify the user if there is an orphaned entry in their working copy. | 1390 # Notify the user if there is an orphaned entry in their working copy. |
| 1377 # Only delete the directory if there are no changes in it, and | 1391 # Only delete the directory if there are no changes in it, and |
| 1378 # delete_unversioned_trees is set to true. | 1392 # delete_unversioned_trees is set to true. |
| 1379 prev_entries = self._ReadEntries() | 1393 prev_entries = self._ReadEntries() |
| 1380 for entry in prev_entries: | 1394 for entry in prev_entries: |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1795 | 1809 |
| 1796 if "__main__" == __name__: | 1810 if "__main__" == __name__: |
| 1797 try: | 1811 try: |
| 1798 result = Main(sys.argv) | 1812 result = Main(sys.argv) |
| 1799 except Error, e: | 1813 except Error, e: |
| 1800 print >> sys.stderr, "Error: %s" % str(e) | 1814 print >> sys.stderr, "Error: %s" % str(e) |
| 1801 result = 1 | 1815 result = 1 |
| 1802 sys.exit(result) | 1816 sys.exit(result) |
| 1803 | 1817 |
| 1804 # vim: ts=2:sw=2:tw=80:et: | 1818 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |