refactor: update remote tag fetching behaviour so it uses api instead of shallow clone

This commit is contained in:
Jonathan Teran Carballo
2026-09-21 09:15:48 -03:00
parent eabef5eb33
commit 22ba8f5e5f
7 changed files with 89 additions and 14 deletions
+16
View File
@@ -77,5 +77,21 @@ class BitbucketRemoteAPI(RemoteAPI):
return commits
def list_tags(self, suffix: str = "") -> list[str]:
names: list[str] = []
url: str | None = self.get_endpoint("refs/tags")
params: dict[str, int|str] | None = {"pagelen": 100}
if suffix:
params["q"] = f'name ~ "{suffix}"'
while url:
page = self.get_json(url, params).json()
names += [t["name"] for t in page["values"]]
url = page.get("next")
params = None # "next" ya incluye la query
return names
def get_endpoint(self, resource: str) -> str:
return f"{BitbucketRemoteAPI.API_ENDPOINT}/{self.repository}/{resource}"