Index: tools/auto_bisect/bisect_perf_regression_test.py |
diff --git a/tools/auto_bisect/bisect_perf_regression_test.py b/tools/auto_bisect/bisect_perf_regression_test.py |
index c10ed78a1fa3bc2d0ddeb75a86f66d0045476a7e..ff13cb0bb609e3c8f6d78a7275343ed6ef20b835 100644 |
--- a/tools/auto_bisect/bisect_perf_regression_test.py |
+++ b/tools/auto_bisect/bisect_perf_regression_test.py |
@@ -151,10 +151,12 @@ def _GenericDryRun(options, print_results=False): |
Returns: |
The results dictionary as returned by the bisect Run method. |
""" |
+ _AbortIfThereAreUncommittedChanges() |
# Disable rmtree to avoid deleting local trees. |
old_rmtree = shutil.rmtree |
+ shutil.rmtree = lambda path, on_error: None |
+ # git reset HEAD may be run during the dry run, which removes staged changes. |
try: |
- shutil.rmtree = lambda path, onerror: None |
bisect_instance = _GetBisectPerformanceMetricsInstance(options) |
results = bisect_instance.Run( |
bisect_instance.opts.command, bisect_instance.opts.bad_revision, |
@@ -168,6 +170,15 @@ def _GenericDryRun(options, print_results=False): |
shutil.rmtree = old_rmtree |
+def _AbortIfThereAreUncommittedChanges(): |
+ """Exits the test prematurely if there are staged changes.""" |
+ changes = bisect_utils.CheckRunGit(['status', '--short']) |
+ if changes.strip(): |
prasadv
2015/01/27 22:32:32
What does "CheckRunGit" returns when there is no c
qyearsley
2015/01/27 23:49:01
CheckRunGit returns an empty string when there are
|
+ print 'There are un-committed changes in the current branch.' |
+ print 'Aborting the tests to avoid destroying local changes.' |
+ sys.exit(1) |
+ |
+ |
class BisectPerfRegressionTest(unittest.TestCase): |
"""Test case for other functions and classes in bisect-perf-regression.py.""" |