git_interface.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:marvin-django 作者: programa-stic 项目源码 文件源码
def crear_repo(package_name):
    md5hash_pn = md5(package_name).hexdigest()
    first_pref = md5hash_pn[0:2]
    second_pref = md5hash_pn[2:4]
    workingdir = root_git_dir+"/"+first_pref+"/"+second_pref+"/" + package_name
    if not(os.access(root_git_dir+"/"+first_pref, os.F_OK)):
        os.mkdir(root_git_dir+"/"+first_pref)
        os.mkdir(root_git_dir+"/"+first_pref+"/"+second_pref)
    elif not(os.access(root_git_dir+"/"+first_pref+"/"+second_pref, os.F_OK)):
        os.mkdir(root_git_dir+"/"+first_pref+"/"+second_pref)
    repo = pygit2.init_repository(workingdir)
    dashed_package_name=package_name.replace('.','-').lower()
    myRemote = repo.remotes.create(package_name, gitlab_url+'/marvin/'+dashed_package_name+'.git')
    gl = Gitlab (gitlab_url, gitlab_token)
    gl.auth()
    p = gl.Project({'name': package_name, 'public':True})
    p.save()
    return repo
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号