2016-08-05 3 views
2

저는 파이썬을 사용하여 큰 저장소를 복제 할 수 있기를 원합니다. 라이브러리를 사용하고 있지만, 중요한 것은 복제가 진행되는 과정을 볼 수 있기를 바랍니다. 나는 pygit2와 GitPython을 시도했지만 진행 상황을 보여주지 못했다. 다른 방법이 있습니까?어떻게 파이썬으로 저장소를 복제하고 복제 프로세스의 진행을 얻을 수 있습니까?

+0

을 어떻게 진행 상황을 보여주고 싶어 여기에 원유 예입니다? GUI 또는 stdout에서? –

+0

http://stackoverflow.com/questions/23155452/read-git-clones-output-in-real-time – DavidN

+0

@ Robᵩ, CLI git 명령이 진행 상황을 보여주는 정상적인 방법이라고 생각했습니다. 잡는 물건 11/27 ... – Jono

답변

2

RemoteProgressGitPython에서 사용할 수 있습니다.

import git 

class Progress(git.remote.RemoteProgress): 
    def update(self, op_code, cur_count, max_count=None, message=''): 
     print 'update(%s, %s, %s, %s)'%(op_code, cur_count, max_count, message) 

repo = git.Repo.clone_from(
    'https://github.com/gitpython-developers/GitPython', 
    './git-python', 
    progress=Progress()) 

또는 약간 더 정제 된 메시지 형식이 update() 기능을 사용 :

def update(self, op_code, cur_count, max_count=None, message=''): 
     print self._cur_line 
관련 문제