From 4e4a2b865b6f1dfdda767dd04b210cb0e43fb4c6 Mon Sep 17 00:00:00 2001 From: Garrett Beaty Date: Tue, 15 Feb 2022 00:17:45 +0000 Subject: [PATCH] Fix get_files_affected_by_patch to work with spaces in file names. Bug: 1288604 Change-Id: Ie116316062e50138668299538a5e0759a1dd3fa9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3459466 Auto-Submit: Garrett Beaty Reviewed-by: Josip Sokcevic Commit-Queue: Josip Sokcevic --- recipes/recipe_modules/tryserver/api.py | 2 +- .../tryserver/tests/get_files_affected_by_patch.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/recipes/recipe_modules/tryserver/api.py b/recipes/recipe_modules/tryserver/api.py index eb587ba41..79637c837 100644 --- a/recipes/recipe_modules/tryserver/api.py +++ b/recipes/recipe_modules/tryserver/api.py @@ -253,7 +253,7 @@ class TryserverApi(recipe_api.RecipeApi): self.m.raw_io.test_api.stream_output('foo.cc'), **kwargs) paths = [self.m.path.join(patch_root, p.decode('utf-8')) for p in - step_result.stdout.split()] + step_result.stdout.splitlines()] paths.sort() if self.m.platform.is_win: # Looks like "analyze" wants POSIX slashes even on Windows (since git diff --git a/recipes/recipe_modules/tryserver/tests/get_files_affected_by_patch.py b/recipes/recipe_modules/tryserver/tests/get_files_affected_by_patch.py index 02ffaec8e..00debc6a8 100644 --- a/recipes/recipe_modules/tryserver/tests/get_files_affected_by_patch.py +++ b/recipes/recipe_modules/tryserver/tests/get_files_affected_by_patch.py @@ -90,3 +90,14 @@ def GenTests(api): api.post_check(post_process.StatusSuccess), api.post_process(post_process.DropExpectation), ) + + yield api.test( + 'file-with-spaces', + api.tryserver.get_files_affected_by_patch(['file with spaces.txt']), + api.properties( + patch_root='', + expected_files=['file with spaces.txt'], + ), + api.post_check(post_process.StatusSuccess), + api.post_process(post_process.DropExpectation), + ) \ No newline at end of file