From 77603d8cb0898747bcf399806ca6c8a91abb0a22 Mon Sep 17 00:00:00 2001 From: Sam Gleske <sag47@drexel.edu> Date: Fri, 13 Sep 2013 18:15:10 -0400 Subject: [PATCH] Patched critical pagination bug in upstream lib --- CHANGELOG | 4 ++++ lib/manage_gitlab_project.py | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e4b474c..9bdb0d5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +gitlab-mirrors v0.2.5 +* Fixed a critical bug with pagination when user can view more projects than 20. + * Had to patch upstream python-gitlab library for this functionality. + gitlab-mirrors v0.2.4 * Fixing critical git svn mirror bug. diff --git a/lib/manage_gitlab_project.py b/lib/manage_gitlab_project.py index 5452e15..d59d282 100755 --- a/lib/manage_gitlab_project.py +++ b/lib/manage_gitlab_project.py @@ -52,9 +52,12 @@ def findgroup(gname): exit(1) def findproject(gname,pname): - for project in git.getProjects(): - if project['namespace']['name'] == gname and project['name'] == pname: - return project + page=1 + while len(git.getProjects(page=page)) > 0: + for project in git.getProjects(page=page): + if project['namespace']['name'] == gname and project['name'] == pname: + return project + page += 1 else: return False @@ -68,6 +71,7 @@ def createproject(pname): description=options.desc new_project=git.createProject(pname,description=description,issues_enabled=str(int(options.issues)),wall_enabled=str(int(options.wall)),merge_requests_enabled=str(int(options.merge)),wiki_enabled=str(int(options.wiki)),snippets_enabled=str(int(options.snippets)),public=str(int(options.public))) new_project=findproject(gitlab_user,pname) + print new_project new_project=git.moveProject(found_group['id'],new_project['id']) if findproject(gitlab_namespace,pname): return findproject(gitlab_namespace,pname) -- GitLab