diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-10-15 21:44:40 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-10-15 21:44:40 +0200 |
commit | b7aa78ba05d3882436145b672c0493fba0083c80 (patch) | |
tree | aa9427ef9eed2dc5f860ea6f6f9a4a102fccf5d9 /cgitize | |
parent | Makefile: add venv-update command (diff) | |
download | cgitize-b7aa78ba05d3882436145b672c0493fba0083c80.tar.gz cgitize-b7aa78ba05d3882436145b672c0493fba0083c80.zip |
bump dependencies
Unfortunately, atlassian-python-api doesn't follow the "same major
version = no breakage" principle, and happily broke a number of things
between 3.25.0 and 3.28.1. Oh well, let's fix the version at 3.28.X, I
guess.
Diffstat (limited to 'cgitize')
-rw-r--r-- | cgitize/bitbucket.py | 16 | ||||
-rw-r--r-- | cgitize/repo.py | 12 |
2 files changed, 13 insertions, 15 deletions
diff --git a/cgitize/bitbucket.py b/cgitize/bitbucket.py index 052d2c1..f2a449f 100644 --- a/cgitize/bitbucket.py +++ b/cgitize/bitbucket.py @@ -17,21 +17,19 @@ class Bitbucket: def get_repo(self, repo): try: - return self._impl.repositories.get(repo.id) + parts = repo.id.split('/') + if len(parts) != 2: + raise ValueError(f'repository ID must be in the USER/NAME format: {repo.id}') + user, name = parts + return self._impl.repositories.get(user, name) except HTTPError: logging.error("Couldn't fetch repository: %s", repo.id) raise def get_user_repos(self, user): try: - page = 1 - while True: - params = {'page': page} - response = self._impl.repositories.get(user.name, params=params) - yield from iter(response['values']) - if 'next' not in response: - break - page += 1 + workspace = self._impl.workspaces.get(user.name) + yield from workspace.repositories.each() except HTTPError: logging.error("Couldn't fetch user repositories: %s", user.name) raise diff --git a/cgitize/repo.py b/cgitize/repo.py index dd55b17..2c9398e 100644 --- a/cgitize/repo.py +++ b/cgitize/repo.py @@ -41,18 +41,18 @@ class Repo: @staticmethod def from_bitbucket(src, config, subdir=None): - name = src['name'] - desc = src['description'] - homepage = src['links']['html']['href'] - owner = src['owner']['display_name'] + name = src.name + desc = src.description + homepage = src.get_link('html') + owner = src.data['owner']['display_name'] - https_urls = [link for link in src['links']['clone'] if link['name'] == 'https'] + https_urls = [link for link in src.data['links']['clone'] if link['name'] == 'https'] if len(https_urls) != 1: raise RuntimeError(f"no https:// clone URL for repository '{name}'?!") # Bitbucket leaves the username in the URL... Sigh. https_url = url_remove_auth(https_urls[0]['href']) - ssh_urls = [link for link in src['links']['clone'] if link ['name'] == 'ssh'] + ssh_urls = [link for link in src.data['links']['clone'] if link ['name'] == 'ssh'] if len(ssh_urls) != 1: raise RuntimeError(f"no ssh:// clone URL for repository '{name}'?!") ssh_url = ssh_urls[0]['href'] |