Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from recipe_engine import recipe_api | 5 from recipe_engine import recipe_api |
| 6 | 6 |
| 7 | 7 |
| 8 class RevisionResolver(object): | 8 class RevisionResolver(object): |
| 9 """Resolves the revision based on build properties.""" | 9 """Resolves the revision based on build properties.""" |
| 10 | 10 |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 """Updates config revision corresponding to patch_project. | 369 """Updates config revision corresponding to patch_project. |
| 370 | 370 |
| 371 Useful for bot_update only, as this is the only consumer of gclient's config | 371 Useful for bot_update only, as this is the only consumer of gclient's config |
| 372 revision map. This doesn't overwrite the revision if it was already set. | 372 revision map. This doesn't overwrite the revision if it was already set. |
| 373 """ | 373 """ |
| 374 assert patch_project is None or isinstance(patch_project, basestring) | 374 assert patch_project is None or isinstance(patch_project, basestring) |
| 375 cfg = gclient_config or self.c | 375 cfg = gclient_config or self.c |
| 376 path, revision = cfg.patch_projects.get(patch_project, (None, None)) | 376 path, revision = cfg.patch_projects.get(patch_project, (None, None)) |
| 377 if path and revision and path not in cfg.revisions: | 377 if path and revision and path not in cfg.revisions: |
| 378 cfg.revisions[path] = revision | 378 cfg.revisions[path] = revision |
| 379 | |
| 380 def get_files_affected_by_patch(self, patch_project, gclient_config=None): | |
| 381 """Returns list of paths to files affected by the patch.""" | |
| 382 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.
| |
| 383 step_result = self.m.git('diff', '--cached', '--name-only', | |
| 384 cwd=self.m.path['root'].join(patch_root), | |
| 385 name='git diff to analyze patch', | |
| 386 stdout=self.m.raw_io.output(), | |
| 387 step_test_data=lambda: | |
| 388 self.m.raw_io.test_api.stream_output('foo.cc')) | |
| 389 paths = step_result.stdout.split() | |
| 390 if patch_root: | |
| 391 paths = [self.m.path.join(patch_root, path) for path in paths] | |
| 392 if self.m.platform.is_win: | |
| 393 # Looks like "analyze" wants POSIX slashes even on Windows (since git | |
| 394 # uses that format even on Windows). | |
| 395 paths = [path.replace('\\', '/') for path in paths] | |
| 396 | |
| 397 step_result.presentation.logs['files'] = paths | |
| 398 return paths | |
| OLD | NEW |