aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--README.md2
-rw-r--r--cgitize/config.py8
-rw-r--r--cgitize/gitlab.py15
-rw-r--r--examples/cgitize.toml4
-rw-r--r--test/unit/test_gitlab.py2
6 files changed, 17 insertions, 16 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c20c4cf..a26fed8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -40,7 +40,7 @@ jobs:
# for testing Bitbucket).
#CGITIZE_BITBUCKET_USERNAME: egor-tensin
#CGITIZE_BITBUCKET_APP_PASSWORD: '${{ secrets.CGITIZE_BITBUCKET_APP_PASSWORD }}'
- # Same goes for Gitlab.
+ # Same goes for GitLab.
#CGITIZE_GITLAB_ACCESS_TOKEN: '${{ secrets.CGITIZE_GITLAB_ACCESS_TOKEN }}'
steps:
- name: Checkout
diff --git a/README.md b/README.md
index c24088e..9d667ca 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ Supports cloning all of your repositories from major hosting providers:
* GitHub,
* Bitbucket,
-* Gitlab.
+* GitLab.
Example output can be found at https://egort.name/git/.
diff --git a/cgitize/config.py b/cgitize/config.py
index 0e42357..821dd6d 100644
--- a/cgitize/config.py
+++ b/cgitize/config.py
@@ -9,7 +9,7 @@ import tomli
from cgitize.bitbucket import Bitbucket
from cgitize.github import GitHub
-from cgitize.gitlab import Gitlab
+from cgitize.gitlab import GitLab
from cgitize.repo import Repo
@@ -96,7 +96,7 @@ class BitbucketSection(Section):
return map(HostedRepo, self.repositories.enum_repositories())
-class GitlabSection(Section):
+class GitLabSection(Section):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.users = UsersSection(self.impl.get('users', {}))
@@ -170,7 +170,7 @@ class Config:
self.repositories = RepositoriesSection(self.impl.get('repositories', {}))
self.github = GitHubSection(self.impl.get('github', {}))
self.bitbucket = BitbucketSection(self.impl.get('bitbucket', {}))
- self.gitlab = GitlabSection(self.impl.get('gitlab', {}))
+ self.gitlab = GitLabSection(self.impl.get('gitlab', {}))
def _parse_explicit_repositories(self):
for r in self.repositories.enum_repositories():
@@ -197,7 +197,7 @@ class Config:
return self._parse_hosted_repositories(self.bitbucket, bitbucket)
def _parse_gitlab_repositories(self):
- gitlab = Gitlab(self.gitlab.access_token)
+ gitlab = GitLab(self.gitlab.access_token)
return self._parse_hosted_repositories(self.gitlab, gitlab)
def parse_repositories(self):
diff --git a/cgitize/gitlab.py b/cgitize/gitlab.py
index 77612cb..3589472 100644
--- a/cgitize/gitlab.py
+++ b/cgitize/gitlab.py
@@ -5,34 +5,35 @@
import logging
-import gitlab
+from gitlab import Gitlab
+from gitlab.exceptions import GitlabGetError
from cgitize.repo import Repo
-class Gitlab:
+class GitLab:
def __init__(self, access_token):
- self._impl = gitlab.Gitlab('https://gitlab.com', private_token=access_token)
+ self._impl = Gitlab('https://gitlab.com', private_token=access_token)
def get_repo(self, repo):
try:
return self._impl.projects.get(repo.id)
- except gitlab.exceptions.GitlabGetError:
+ except GitlabGetError:
logging.error("Couldn't fetch repository: %s", repo.id)
raise
def get_user_repos(self, user):
try:
- # Strictly speaking, Gitlab supports the /users/:username/projects
+ # Strictly speaking, GitLab supports the /users/:username/projects
# endpoint, which means you shouldn't need to fetch the user first,
# but I don't think python-gitlab 2.10.0 supports that?
users = self._impl.users.list(username=user.name)
if not users:
- raise RuntimeError(f"Couldn't find Gitlab user: {user.name}")
+ raise RuntimeError(f"Couldn't find GitLab user: {user.name}")
assert len(users) == 1
user = users[0]
return user.projects.list()
- except gitlab.exceptions.GitlabGetError:
+ except GitlabGetError:
logging.error("Couldn't fetch user repositories: %s", user.name)
raise
diff --git a/examples/cgitize.toml b/examples/cgitize.toml
index 4155532..3fdc952 100644
--- a/examples/cgitize.toml
+++ b/examples/cgitize.toml
@@ -63,10 +63,10 @@ dir = "chromiumembedded"
[bitbucket.repositories.upc-runtime]
id = "berkeleylab/upc-runtime"
-# Gitlab
+# GitLab
# ======
-# Gitlab settings are similar to those for GitHub.
+# GitLab settings are similar to those for GitHub.
[gitlab]
# The environment variable is CGITIZE_GITLAB_ACCESS_TOKEN.
diff --git a/test/unit/test_gitlab.py b/test/unit/test_gitlab.py
index 2c2f815..d37c06c 100644
--- a/test/unit/test_gitlab.py
+++ b/test/unit/test_gitlab.py
@@ -9,7 +9,7 @@ from gitlab import Gitlab
from gitlab.exceptions import GitlabGetError
-class GitlabTests(unittest.TestCase):
+class GitLabTests(unittest.TestCase):
def setUp(self):
self.gitlab = Gitlab('https://gitlab.com')