[no-sync] Add a skip_sync_revisions and process it before running deps.

Bug: 1339472
Change-Id: I429489f7deea035c47e27e32ada858fb8a827643
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3735487
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
diff --git a/gclient_utils.py b/gclient_utils.py
index bbf273d..af085fa 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -95,6 +95,27 @@
   _WARNINGS.append(msg)
 
 
+def FuzzyMatchRepo(repo, candidates):
+  # type: (str, Union[Collection[str], Mapping[str, Any]]) -> Optional[str]
+  """Attempts to find a representation of repo in the candidates.
+
+  Args:
+    repo: a string representation of a repo in the form of a url or the
+      name and path of the solution it represents.
+    candidates: The candidates to look through which may contain `repo` in
+      in any of the forms mentioned above.
+  Returns:
+    The matching string, if any, which may be in a different form from `repo`.
+  """
+  if repo in candidates:
+    return repo
+  if repo.endswith('.git') and repo[:-len('.git')] in candidates:
+    return repo[:-len('.git')]
+  if repo + '.git' in candidates:
+    return repo + '.git'
+  return None
+
+
 def SplitUrlRevision(url):
   """Splits url and returns a two-tuple: url, rev"""
   if url.startswith('ssh:'):