aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2024-04-04 23:05:16 +0000
committerDan Albert <danalbert@google.com>2024-04-05 17:46:16 +0000
commit37f55303be7fd75eeeccbbf7e82a79cf69a37013 (patch)
treebe3355f693bc4d644ab32b5236735093836751bd
parentba199da594c37c3c73fedea1e99bc43cb2ee284d (diff)
downloadexternal_updater-37f55303be7fd75eeeccbbf7e82a79cf69a37013.tar.gz
Remove dead code.
This variable stopped being used in https://r.android.com/2982667. Stop doing work to set it. Bug: None Test: make Change-Id: I1c4b55a1b984ff927f50aaa2caf257ae7cc88517
-rw-r--r--git_updater.py41
1 files changed, 0 insertions, 41 deletions
diff --git a/git_updater.py b/git_updater.py
index 2035201..f32e735 100644
--- a/git_updater.py
+++ b/git_updater.py
@@ -28,54 +28,13 @@ class GitUpdater(base_updater.Updater):
def is_supported_url(self) -> bool:
return git_utils.is_valid_url(self._proj_path, self._old_identifier.value)
- @staticmethod
- def _is_likely_android_remote(url: str) -> bool:
- """Returns True if the URL is likely to be the project's Android remote."""
- # There isn't a strict rule for finding the correct remote for
- # upstream-master/main, so we have to guess. Be careful to filter out
- # things that look almost right but aren't. Here's an example of a
- # project that has a lot of false positives:
- #
- # aosp /usr/local/google/home/danalbert/src/mirrors/android/refs/aosp/toolchain/rr.git (fetch)
- # aosp persistent-https://android.git.corp.google.com/toolchain/rr (push)
- # origin https://github.com/DanAlbert/rr.git (fetch)
- # origin https://github.com/DanAlbert/rr.git (push)
- # unmirrored persistent-https://android.git.corp.google.com/toolchain/rr (fetch)
- # unmirrored persistent-https://android.git.corp.google.com/toolchain/rr (push)
- # update_origin https://github.com/rr-debugger/rr (fetch)
- # update_origin https://github.com/rr-debugger/rr (push)
- # upstream https://github.com/rr-debugger/rr.git (fetch)
- # upstream https://github.com/rr-debugger/rr.git (push)
- #
- # unmirrored is the correct remote here. It's not a local path,
- # and contains either /platform/external/ or /toolchain/ (the two
- # common roots for third- party Android imports).
- if '://' not in url:
- # Skip anything that's likely a local GoB mirror.
- return False
- if '/platform/external/' in url:
- return True
- if '/toolchain/' in url:
- return True
- return False
-
def setup_remote(self) -> None:
remotes = git_utils.list_remotes(self._proj_path)
current_remote_url = None
- android_remote_name: str | None = None
for name, url in remotes.items():
if name == self.UPSTREAM_REMOTE_NAME:
current_remote_url = url
- if self._is_likely_android_remote(url):
- android_remote_name = name
-
- if android_remote_name is None:
- remotes_formatted = "\n".join(f"{k} {v}" for k, v in remotes.items())
- raise RuntimeError(
- f"Could not determine android remote for {self._proj_path}. Tried:\n"
- f"{remotes_formatted}")
-
if current_remote_url is not None and current_remote_url != self._old_identifier.value:
git_utils.remove_remote(self._proj_path, self.UPSTREAM_REMOTE_NAME)
current_remote_url = None