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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
index 6acc7224e2ec5a56cea686a4c2c59070ff690199..a74fa6502e6f905d79ca2e51bf982b9a9fb2da63 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
@@ -30,6 +30,7 @@ from __future__ import print_function
import json
import logging
import optparse
+import re
import sys
import traceback
@@ -523,7 +524,13 @@ class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand):
self._remove_all_pass_testharness_baselines(test_prefix_list)
- self._tool.scm().add_all(pathspec=self._layout_tests_dir())
+ self._tool.scm().add_list(self.unstaged_baselines())
+
+ def unstaged_baselines(self):
+ """Returns absolute paths for unstaged (including untracked) baselines."""
+ baseline_re = re.compile(r'.*[\\/]LayoutTests[\\/].*-expected\.(txt|png|wav)$')
+ unstaged_changes = self._tool.scm().unstaged_changes()
+ return sorted(self._tool.scm().absolute_path(path) for path in unstaged_changes if re.match(baseline_re, path))
def _remove_all_pass_testharness_baselines(self, test_prefix_list):
"""Removes all of the all-PASS baselines for the given builders and tests.

Powered by Google App Engine
This is Rietveld 408576698