2017-09-29 2 views
0

두 개의 특정 커밋 사이에 체크인 된 커밋의 내용을 찾으려고합니다.git-python에서 hexsha로 Commit 객체 가져 오기

git에서 나는 git rev-list --ancestry-path <older_commit_sha>..<newer_commit_sha>을 할 것입니다.

git-python에서는 직접적인 방법이 없기 때문에 정확한 명령을 호출하기 위해 repo.git.execute()을 사용했습니다. 출력은 커밋 ID 문자열입니다 (16 진수 SHA).

이제 execute()으로 주어진 16 진수 SHA부터 유효한 Commit 개체를 생성하는 git-python의 방법이 있습니까?

답변

0

많이 파고 들었을 때, 그리고이 질문이 많은 견인력을 얻고 있지 않다면, 나는 .execute()을 사용했다. 는 특히 :

commits = repo.git.execute(['git', 'rev-list', '--ancestry-path', 
          '%s..%s' % (oldCommit.hexsha, newCommit.hexsha)]).split() 
물론

, oldCommitnewCommitgit.Commit 개체입니다.