From 4f2dc9683c8ecb462f8dc67669b49fa21d2ec5b4 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 14 Sep 2018 21:08:30 +0800 Subject: [PATCH] 1 --- gitlab/githelper.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gitlab/githelper.py b/gitlab/githelper.py index 44f0dbb..ccd232b 100644 --- a/gitlab/githelper.py +++ b/gitlab/githelper.py @@ -1,3 +1,4 @@ +import os import json import urllib.request @@ -14,4 +15,11 @@ projects = httpGet('http://git.kingsome.cn/api/v4/projects?', 'per_page': 1000 }) for proj in projects: - print(proj['path_with_namespace']) + http_url_to_repo = proj['http_url_to_repo'] + name = proj['name'] + path = proj['namespace']['path'] + if not os.path.exists('repository/' + path): + os.mkdir('repository/' + path) + if not os.path.exists('repository/' + path + '/' + name): + os.system('cd repository/' + path + ' && git clone ' + http_url_to_repo) + os.system('cd repository/' + path + ' && git pull')