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

Side by Side Diff: scripts/slave/recipe_modules/findit/api.py

Issue 1416763007: Add a recipe to identify culprits for chromium compile failures. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from recipe_engine import recipe_api
6
7
8 class FinditApi(recipe_api.RecipeApi):
9
10 def get_files_affected_by_revision(self, revision, repo_dir=''):
11 """Returns the files changed by the given revision.
12
13 Args:
14 revision (str): the git hash of a commit.
15 repo_dir (str): the relative path to the checkout directory.
16 """
17 if repo_dir:
18 cwd = self.m.path['checkout']
19 else:
20 cwd = self.m.path['checkout'].join(repo_dir)
iannucci 2015/11/18 03:57:53 is this if/else backwards? Does it make sense to
stgao 2015/11/19 22:06:33 Changed input parameter to "solution_name" and der
21
22 previous_revision = '%s~1' % revision
23 step_result = self.m.git('diff', previous_revision, revision, '--name-only',
iannucci 2015/11/18 03:57:54 I think revision+"~1" is possibly clearer and
stgao 2015/11/19 22:06:33 Done.
24 name='git diff to analyze commit',
25 stdout=self.m.raw_io.output(),
26 cwd=cwd,
27 step_test_data=lambda:
28 self.m.raw_io.test_api.stream_output('foo.cc'))
29
30 paths = step_result.stdout.split()
31 if repo_dir:
32 paths = [self.m.path.join(repo_dir, path) for path in paths]
33 if self.m.platform.is_win:
34 # Looks like "analyze" wants POSIX slashes even on Windows (since git
35 # uses that format even on Windows).
36 paths = [path.replace('\\', '/') for path in paths]
37
38 step_result.presentation.logs['files'] = paths
39 return paths
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698