Commit 27726869 authored by phajdan.jr's avatar phajdan.jr Committed by Commit bot

tryserver: make it possible to override cwd for get_files_affected_by_patch

BUG=584079, 593999

Review-Url: https://codereview.chromium.org/2144473003
parent 00c2cdbf
...@@ -149,7 +149,7 @@ class TryserverApi(recipe_api.RecipeApi): ...@@ -149,7 +149,7 @@ class TryserverApi(recipe_api.RecipeApi):
# Since this method is "maybe", we don't raise an Exception. # Since this method is "maybe", we don't raise an Exception.
pass pass
def get_files_affected_by_patch(self, patch_root=None): def get_files_affected_by_patch(self, patch_root=None, **kwargs):
"""Returns list of paths to files affected by the patch. """Returns list of paths to files affected by the patch.
Argument: Argument:
...@@ -166,12 +166,14 @@ class TryserverApi(recipe_api.RecipeApi): ...@@ -166,12 +166,14 @@ class TryserverApi(recipe_api.RecipeApi):
# removed. # removed.
if patch_root is None: if patch_root is None:
return self._old_get_files_affected_by_patch() return self._old_get_files_affected_by_patch()
if not kwargs.get('cwd'):
kwargs['cwd'] = self.m.path['slave_build'].join(patch_root)
step_result = self.m.git('diff', '--cached', '--name-only', step_result = self.m.git('diff', '--cached', '--name-only',
cwd=self.m.path['slave_build'].join(patch_root),
name='git diff to analyze patch', name='git diff to analyze patch',
stdout=self.m.raw_io.output(), stdout=self.m.raw_io.output(),
step_test_data=lambda: step_test_data=lambda:
self.m.raw_io.test_api.stream_output('foo.cc')) self.m.raw_io.test_api.stream_output('foo.cc'),
**kwargs)
paths = [self.m.path.join(patch_root, p) for p in paths = [self.m.path.join(patch_root, p) for p in
step_result.stdout.split()] step_result.stdout.split()]
if self.m.platform.is_win: if self.m.platform.is_win:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment