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._scm.exists(virtual_root_expected_baseline_path): |
318 self._files_to_delete.append(virtual_root_expected_baseline_path) | 318 _log.debug(" Deleting (SCM): " + virtual_root_expected_baseline_p
ath) |
| 319 if self._skip_scm_commands: |
| 320 self._files_to_delete.append(virtual_root_expected_baseline_path
) |
| 321 else: |
| 322 self._scm.delete(virtual_root_expected_baseline_path) |
319 else: | 323 else: |
320 self._scm.delete(virtual_root_expected_baseline_path) | 324 _log.debug(" Deleting (file system): " + virtual_root_expected_ba
seline_path) |
| 325 self._filesystem.remove(virtual_root_expected_baseline_path) |
321 | 326 |
322 def optimize(self, baseline_name): | 327 def optimize(self, baseline_name): |
323 # The virtual fallback path is the same as the non-virtual one tacked on
to the bottom of the non-virtual path. | 328 # The virtual fallback path is the same as the non-virtual one tacked on
to the bottom of the non-virtual path. |
324 # See https://docs.google.com/a/chromium.org/drawings/d/1eGdsIKzJ2dxDDBb
UaIABrN4aMLD1bqJTfyxNGZsTdmg/edit for | 329 # See https://docs.google.com/a/chromium.org/drawings/d/1eGdsIKzJ2dxDDBb
UaIABrN4aMLD1bqJTfyxNGZsTdmg/edit for |
325 # a visual representation of this. | 330 # a visual representation of this. |
326 # | 331 # |
327 # So, we can optimize the virtual path, then the virtual root and then t
he regular path. | 332 # So, we can optimize the virtual path, then the virtual root and then t
he regular path. |
328 | 333 |
329 _log.debug("Optimizing regular fallback path.") | 334 _log.debug("Optimizing regular fallback path.") |
330 result = self._optimize_subtree(baseline_name) | 335 result = self._optimize_subtree(baseline_name) |
331 non_virtual_baseline_name = self._port_factory.get().lookup_virtual_test
_base(baseline_name) | 336 non_virtual_baseline_name = self._port_factory.get().lookup_virtual_test
_base(baseline_name) |
332 if not non_virtual_baseline_name: | 337 if not non_virtual_baseline_name: |
333 return result, self._files_to_delete, self._files_to_add | 338 return result, self._files_to_delete, self._files_to_add |
334 | 339 |
335 self._optimize_virtual_root(baseline_name, non_virtual_baseline_name) | 340 self._optimize_virtual_root(baseline_name, non_virtual_baseline_name) |
336 | 341 |
337 _log.debug("Optimizing non-virtual fallback path.") | 342 _log.debug("Optimizing non-virtual fallback path.") |
338 result |= self._optimize_subtree(non_virtual_baseline_name) | 343 result |= self._optimize_subtree(non_virtual_baseline_name) |
339 return result, self._files_to_delete, self._files_to_add | 344 return result, self._files_to_delete, self._files_to_add |
OLD | NEW |