Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py

Issue 2590693002: Only add unstaged baseline changes to the git index when rebaselining. (Closed)
Patch Set: rebaseline-cl: Abort if there are unstaged baseline changes. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2010 Google Inc. All rights reserved. 1 # Copyright (c) 2010 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 12 matching lines...) Expand all
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR/ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR/ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 from __future__ import print_function 29 from __future__ import print_function
30 import json 30 import json
31 import logging 31 import logging
32 import optparse 32 import optparse
33 import re
33 import sys 34 import sys
34 import traceback 35 import traceback
35 36
36 from webkitpy.common.memoized import memoized 37 from webkitpy.common.memoized import memoized
37 from webkitpy.common.net.buildbot import Build 38 from webkitpy.common.net.buildbot import Build
38 from webkitpy.common.system.executive import ScriptError 39 from webkitpy.common.system.executive import ScriptError
39 from webkitpy.layout_tests.models.testharness_results import is_all_pass_testhar ness_result 40 from webkitpy.layout_tests.models.testharness_results import is_all_pass_testhar ness_result
40 from webkitpy.layout_tests.models.test_expectations import TestExpectations, BAS ELINE_SUFFIX_LIST, SKIP 41 from webkitpy.layout_tests.models.test_expectations import TestExpectations, BAS ELINE_SUFFIX_LIST, SKIP
41 from webkitpy.layout_tests.port import factory 42 from webkitpy.layout_tests.port import factory
42 from webkitpy.tool.commands.command import Command 43 from webkitpy.tool.commands.command import Command
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 self._update_expectations_files(lines_to_remove) 517 self._update_expectations_files(lines_to_remove)
517 518
518 if options.optimize: 519 if options.optimize:
519 # TODO(wkorman): Consider changing temporary branch to base off of H EAD rather than 520 # TODO(wkorman): Consider changing temporary branch to base off of H EAD rather than
520 # origin/master to ensure we run baseline optimization processes wit h the same code as 521 # origin/master to ensure we run baseline optimization processes wit h the same code as
521 # auto-rebaseline itself. 522 # auto-rebaseline itself.
522 self._run_in_parallel(self._optimize_baselines(test_prefix_list, opt ions.verbose)) 523 self._run_in_parallel(self._optimize_baselines(test_prefix_list, opt ions.verbose))
523 524
524 self._remove_all_pass_testharness_baselines(test_prefix_list) 525 self._remove_all_pass_testharness_baselines(test_prefix_list)
525 526
526 self._tool.scm().add_all(pathspec=self._layout_tests_dir()) 527 self._tool.scm().add_list(self.unstaged_baselines())
528
529 def unstaged_baselines(self):
530 """Returns absolute paths for unstaged (including untracked) baselines." ""
531 baseline_re = re.compile(r'.*[\\/]LayoutTests[\\/].*-expected\.(txt|png| wav)$')
532 unstaged_changes = self._tool.scm().unstaged_changes()
533 return sorted(self._tool.scm().absolute_path(path) for path in unstaged_ changes if re.match(baseline_re, path))
527 534
528 def _remove_all_pass_testharness_baselines(self, test_prefix_list): 535 def _remove_all_pass_testharness_baselines(self, test_prefix_list):
529 """Removes all of the all-PASS baselines for the given builders and test s. 536 """Removes all of the all-PASS baselines for the given builders and test s.
530 537
531 In general, for testharness.js tests, the absence of a baseline 538 In general, for testharness.js tests, the absence of a baseline
532 indicates that the test is expected to pass. When rebaselining, 539 indicates that the test is expected to pass. When rebaselining,
533 new all-PASS baselines may be downloaded, but they should not be kept. 540 new all-PASS baselines may be downloaded, but they should not be kept.
534 """ 541 """
535 filesystem = self._tool.filesystem 542 filesystem = self._tool.filesystem
536 baseline_paths = self._all_baseline_paths(test_prefix_list) 543 baseline_paths = self._all_baseline_paths(test_prefix_list)
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 for test in args: 717 for test in args:
711 if test not in test_prefix_list: 718 if test not in test_prefix_list:
712 test_prefix_list[test] = {} 719 test_prefix_list[test] = {}
713 build = Build(builder) 720 build = Build(builder)
714 test_prefix_list[test][build] = suffixes_to_update 721 test_prefix_list[test][build] = suffixes_to_update
715 722
716 if options.verbose: 723 if options.verbose:
717 _log.debug("rebaseline-json: " + str(test_prefix_list)) 724 _log.debug("rebaseline-json: " + str(test_prefix_list))
718 725
719 self.rebaseline(options, test_prefix_list) 726 self.rebaseline(options, test_prefix_list)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698