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

Unified Diff: recipe_modules/gclient/api.py

Issue 1927403003: Avoid computing patch_root in get_files_affected_by_patch. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 8 months 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
« no previous file with comments | « recipe_modules/gclient/__init__.py ('k') | recipe_modules/gclient/example.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/gclient/api.py
diff --git a/recipe_modules/gclient/api.py b/recipe_modules/gclient/api.py
index 6b44dab1d2bce72726b22b6552ef11de1abea020..f858b0231c33a28660779d5a9d621890ec1c3798 100644
--- a/recipe_modules/gclient/api.py
+++ b/recipe_modules/gclient/api.py
@@ -376,3 +376,23 @@ class GclientApi(recipe_api.RecipeApi):
path, revision = cfg.patch_projects.get(patch_project, (None, None))
if path and revision and path not in cfg.revisions:
cfg.revisions[path] = revision
+
+ def get_files_affected_by_patch(self, patch_project, gclient_config=None):
+ """Returns list of paths to files affected by the patch."""
+ patch_root = self.calculate_patch_root(patch_project, gclient_config)
Michael Achenbach 2016/04/29 14:11:53 Maybe patch_root should be a parameter to this met
tandrii(chromium) 2016/04/29 15:09:41 Good idea. Will do that.
+ step_result = self.m.git('diff', '--cached', '--name-only',
+ cwd=self.m.path['root'].join(patch_root),
+ name='git diff to analyze patch',
+ stdout=self.m.raw_io.output(),
+ step_test_data=lambda:
+ self.m.raw_io.test_api.stream_output('foo.cc'))
+ paths = step_result.stdout.split()
+ if patch_root:
+ paths = [self.m.path.join(patch_root, path) for path in paths]
+ if self.m.platform.is_win:
+ # Looks like "analyze" wants POSIX slashes even on Windows (since git
+ # uses that format even on Windows).
+ paths = [path.replace('\\', '/') for path in paths]
+
+ step_result.presentation.logs['files'] = paths
+ return paths
« no previous file with comments | « recipe_modules/gclient/__init__.py ('k') | recipe_modules/gclient/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698