From d47a9c2c461c68efc4943c9fdf48998ae5564a63 Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Thu, 22 Jun 2023 05:14:35 +0000 Subject: [PATCH] Revert "Allow patching multiple directories if shared URL" This reverts commit 8559499c4c24ed0fd7765db72b6bbbcdd3077809. Reason for revert: breaks internal presubmits https://crbug.com/1457050 Original change's description: > Allow patching multiple directories if shared URL > > If there are more than one DEPS entry that can be patched (e.g. two DEPS > entries with the same URL, but different path, ie. src-internal and > src/internal), then gclient should patch all of them and not just the > first one it seees. > > R=gavinmak@google.com > > Change-Id: I617b1771062a718421d8ed17941bc3eef3288005 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4630529 > Commit-Queue: Josip Sokcevic > Reviewed-by: Gavin Mak Bug: 1457050 Change-Id: I76fd217917a569bc3cc7220c2d2090675996dcdc No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4635526 Commit-Queue: Josip Sokcevic Bot-Commit: Rubber Stamper --- gclient.py | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/gclient.py b/gclient.py index 2b5bedb0a..60346178f 100755 --- a/gclient.py +++ b/gclient.py @@ -985,7 +985,6 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): patch_refs, # type: Mapping[str, str] target_branches, # type: Mapping[str, str] skip_sync_revisions, # type: Mapping[str, str] - applied_patches=None, # type: Set[str] ): # type: () -> None """Runs |command| then parse the DEPS file.""" @@ -1029,11 +1028,9 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): if isinstance(self, GitDependency) and command == 'update': patch_repo = self.url.split('@')[0] - fuzzy_match = self.FuzzyMatchUrl(patch_refs) - patch_ref = patch_refs[fuzzy_match] if fuzzy_match else None - target_branch = target_branches[fuzzy_match] if fuzzy_match else None - if fuzzy_match and applied_patches is not None: - applied_patches.add(fuzzy_match) + patch_ref = patch_refs.pop(self.FuzzyMatchUrl(patch_refs), None) + target_branch = target_branches.pop( + self.FuzzyMatchUrl(target_branches), None) if patch_ref: latest_commit = self._used_scm.apply_patch_ref( patch_repo, patch_ref, target_branch, options, file_list) @@ -2003,7 +2000,6 @@ it or fix the checkout. patch_refs = {} target_branches = {} skip_sync_revisions = {} - applied_patches = set() # It's unnecessary to check for revision overrides for 'recurse'. # Save a few seconds by not calling _EnforceRevisions() in that case. if command not in ('diff', 'recurse', 'runhooks', 'status', 'revert', @@ -2048,14 +2044,13 @@ it or fix the checkout. options=self._options, patch_refs=patch_refs, target_branches=target_branches, - skip_sync_revisions=skip_sync_revisions, - applied_patches=applied_patches) + skip_sync_revisions=skip_sync_revisions) if revision_overrides: print('Please fix your script, having invalid --revision flags will soon ' 'be considered an error.', file=sys.stderr) - if patch_refs.keys() != applied_patches: + if patch_refs: raise gclient_utils.Error( 'The following --patch-ref flags were not used. Please fix it:\n%s' % ('\n'.join( @@ -2253,16 +2248,8 @@ class CipdDependency(Dependency): self._package_version = version #override - def run(self, - revision_overrides, - command, - args, - work_queue, - options, - patch_refs, - target_branches, - skip_sync_revisions, - applied_patches=None): + def run(self, revision_overrides, command, args, work_queue, options, + patch_refs, target_branches, skip_sync_revisions): """Runs |command| then parse the DEPS file.""" logging.info('CipdDependency(%s).run()' % self.name) if not self.should_process: