Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to GitLab API v4 / python-gitlab>=1.3.0. #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Command-line script to migrate Gitlab issues to Kanboard.

== Requirements

- Gitlab >= 8.13.8
- Gitlab >= 9.0.0
- Kanboard >= 1.0.42

[NOTE]
Expand Down
13 changes: 7 additions & 6 deletions kanboard_gitlab/importer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import re
from kanboard import Kanboard
from gitlab import Gitlab, requests
from gitlab import Gitlab
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from gettext import gettext as _

Expand Down Expand Up @@ -38,7 +39,7 @@ def connect(self):

def migrate(self, namespace, project):
_groups = [
g for g in self.gl.groups.search(namespace) if g.name == namespace]
g for g in self.gl.groups.list(search=namespace) if g.name == namespace]
if not _groups:
print(_('Error: namespace {} not found !').format(namespace))
return False
Expand All @@ -51,7 +52,7 @@ def migrate(self, namespace, project):
project, namespace))
return False

origin = _projects[0]
origin = self.gl.projects.get(_projects[0].id, lazy=True)

count = 0
self.target = self.kb.createProject(
Expand All @@ -63,10 +64,10 @@ def migrate(self, namespace, project):
self.users = self.kb.getAllUsers()
self.labels = origin.labels.list(all=True)
for issue in reversed(origin.issues.list(all=True)):
creator = self.get_user_id(issue.author.username)
creator = self.get_user_id(issue.author['username'])
owner = None
if issue.assignee:
owner = self.get_user_id(issue.assignee.username)
owner = self.get_user_id(issue.assignee['username'])
params = {
'title': issue.title,
'project_id': self.target,
Expand Down Expand Up @@ -102,7 +103,7 @@ def migrate(self, namespace, project):
body = body.replace('~{}'.format(l), self.get_label_by_id(l))

commenter_id = self.get_user_id(
comment.author.username) or self.users[0]['id']
comment.author['username']) or self.users[0]['id']
self.kb.createComment(
task_id=task,
user_id=commenter_id,
Expand Down
2 changes: 1 addition & 1 deletion requirements/_base.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
envparse==0.2.0
kanboard==1.0.1
python-gitlab==0.20
python-gitlab>=1.3.0