| OLD | NEW |
| 1 # Copyright (C) 2011, Google Inc. All rights reserved. | 1 # Copyright (C) 2011, Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 for port_name in self._port_names: | 307 for port_name in self._port_names: |
| 308 directories = self._relative_baseline_search_paths(port_name, non_vi
rtual_baseline_name) | 308 directories = self._relative_baseline_search_paths(port_name, non_vi
rtual_baseline_name) |
| 309 for directory in directories: | 309 for directory in directories: |
| 310 if directory not in results_by_directory: | 310 if directory not in results_by_directory: |
| 311 continue | 311 continue |
| 312 if results_by_directory[directory] != root_sha1: | 312 if results_by_directory[directory] != root_sha1: |
| 313 return | 313 return |
| 314 break | 314 break |
| 315 | 315 |
| 316 _log.debug("Deleting redundant virtual root expected result.") | 316 _log.debug("Deleting redundant virtual root expected result.") |
| 317 if self._skip_scm_commands: | 317 if self._skip_scm_commands and virtual_root_expected_baseline_path in se
lf._files_to_add: |
| 318 self._files_to_add.remove(virtual_root_expected_baseline_path) | 318 self._files_to_add.remove(virtual_root_expected_baseline_path) |
| 319 if self._scm.exists(virtual_root_expected_baseline_path): | 319 if self._scm.exists(virtual_root_expected_baseline_path): |
| 320 _log.debug(" Deleting (SCM): " + virtual_root_expected_baseline_p
ath) | 320 _log.debug(" Deleting (SCM): " + virtual_root_expected_baseline_p
ath) |
| 321 if self._skip_scm_commands: | 321 if self._skip_scm_commands: |
| 322 self._files_to_delete.append(virtual_root_expected_baseline_path
) | 322 self._files_to_delete.append(virtual_root_expected_baseline_path
) |
| 323 else: | 323 else: |
| 324 self._scm.delete(virtual_root_expected_baseline_path) | 324 self._scm.delete(virtual_root_expected_baseline_path) |
| 325 else: | 325 else: |
| 326 _log.debug(" Deleting (file system): " + virtual_root_expected_ba
seline_path) | 326 _log.debug(" Deleting (file system): " + virtual_root_expected_ba
seline_path) |
| 327 self._filesystem.remove(virtual_root_expected_baseline_path) | 327 self._filesystem.remove(virtual_root_expected_baseline_path) |
| 328 | 328 |
| 329 def optimize(self, baseline_name): | 329 def optimize(self, baseline_name): |
| 330 # The virtual fallback path is the same as the non-virtual one tacked on
to the bottom of the non-virtual path. | 330 # The virtual fallback path is the same as the non-virtual one tacked on
to the bottom of the non-virtual path. |
| 331 # See https://docs.google.com/a/chromium.org/drawings/d/1eGdsIKzJ2dxDDBb
UaIABrN4aMLD1bqJTfyxNGZsTdmg/edit for | 331 # See https://docs.google.com/a/chromium.org/drawings/d/1eGdsIKzJ2dxDDBb
UaIABrN4aMLD1bqJTfyxNGZsTdmg/edit for |
| 332 # a visual representation of this. | 332 # a visual representation of this. |
| 333 # | 333 # |
| 334 # So, we can optimize the virtual path, then the virtual root and then t
he regular path. | 334 # So, we can optimize the virtual path, then the virtual root and then t
he regular path. |
| 335 | 335 |
| 336 _log.debug("Optimizing regular fallback path.") | 336 _log.debug("Optimizing regular fallback path.") |
| 337 result = self._optimize_subtree(baseline_name) | 337 result = self._optimize_subtree(baseline_name) |
| 338 non_virtual_baseline_name = self._port_factory.get().lookup_virtual_test
_base(baseline_name) | 338 non_virtual_baseline_name = self._port_factory.get().lookup_virtual_test
_base(baseline_name) |
| 339 if not non_virtual_baseline_name: | 339 if not non_virtual_baseline_name: |
| 340 return result, self._files_to_delete, self._files_to_add | 340 return result, self._files_to_delete, self._files_to_add |
| 341 | 341 |
| 342 self._optimize_virtual_root(baseline_name, non_virtual_baseline_name) | 342 self._optimize_virtual_root(baseline_name, non_virtual_baseline_name) |
| 343 | 343 |
| 344 _log.debug("Optimizing non-virtual fallback path.") | 344 _log.debug("Optimizing non-virtual fallback path.") |
| 345 result |= self._optimize_subtree(non_virtual_baseline_name) | 345 result |= self._optimize_subtree(non_virtual_baseline_name) |
| 346 return result, self._files_to_delete, self._files_to_add | 346 return result, self._files_to_delete, self._files_to_add |
| OLD | NEW |