From 11b07527e636120061aebb6a8fbca266e99093d5 Mon Sep 17 00:00:00 2001 From: Joanna Wang Date: Wed, 9 Aug 2023 23:29:03 +0000 Subject: [PATCH] Sync gitlinks to DEPS so commits from applied patches are used. Bug: 1471685 Change-Id: If9ec3178b7e265dd7da8b8bc672131d33ccd36a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4764134 Reviewed-by: Josip Sokcevic Commit-Queue: Joanna Wang --- gclient.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gclient.py b/gclient.py index ba188c337..ce1a48971 100755 --- a/gclient.py +++ b/gclient.py @@ -881,10 +881,21 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): deps = local_scope.get('deps', {}) - # If dependencies are configured within git submodules, add them to DEPS. + # If dependencies are configured within git submodules, add them to deps. if self.git_dependencies_state in (gclient_eval.SUBMODULES, gclient_eval.SYNC): - deps.update(self.ParseGitSubmodules()) + gitsubmodules = self.ParseGitSubmodules() + # TODO(crbug.com/1471685): Temporary hack. In case of applied patches + # where the changes are staged but not committed, any gitlinks from + # the patch are not returned in ParseGitSubmodules. In these cases, + # DEPS does have the commits from the patch, so we use those commits + # instead. + if self.git_dependencies_state == gclient_eval.SYNC: + for sub in gitsubmodules: + if sub not in deps: + deps[sub] = gitsubmodules[sub] + elif self.git_dependencies_state == gclient_eval.SUBMODULES: + deps.update(gitsubmodules) deps_to_add = self._deps_to_objects( self._postprocess_deps(deps, rel_prefix), self._use_relative_paths)