python dulwich 라이브러리에서 git pull
과 같은 작업을 수행하는 방법.덜 리치를 사용하여 리모컨을 당기는 방법은 무엇입니까?
5
A
답변
5
것은 내가 dulwich를 사용하지 않은,하지만 these doc's에서, 아마도 뭔가 같은 :이 시점에서
from dulwich.repo import Repo
from dulwich.client import HttpGitClient
local = Repo.init("local", mkdir=True)
client = HttpGitClient('http://github.com/adammorris/')
remote_refs = client.fetch("history.js.git",local)
local["HEAD"] = remote_refs["refs/heads/master"]
, 그것은 파일을로드하지 못했지만, 나는 로컬 경로에서 "자식 체크 아웃"할 수있는 , 그리고 파일을 업데이트했습니다.
1
전체 예 :
또한, 이러한 보았다. Bitbucket
와 작동합니다.
from dulwich import index
from dulwich.client import HttpGitClient
from dulwich.repo import Repo
local_repo = Repo.init(LOCAL_FOLDER, mkdir=True)
remote_repo = HttpGitClient(REMOTE_URL, username=USERNAME, password=PASSWORD)
remote_refs = remote_repo.fetch(REMOTE_URL, local_repo)
local_repo[b"HEAD"] = remote_refs[b"refs/heads/master"]
index_file = local_repo.index_path()
tree = local_repo[b"HEAD"].tree
index.build_index_from_tree(local_repo.path, index_file, local_repo.object_store, tree)
LOCAL_FOLDER, REMOTE_URL, USERNAME, PASSWORD를 데이터로 바꿉니다.
예, fetch 함수는'.git' 디렉토리 아래의 팩 파일을 가져옵니다. 그리고 나는 그것을 master 브랜치에 병합하는 방법을 모른다. – Determinant
fetch()는 repo와 동일한 분기로 팩을 가져와야하는 것처럼 들립니다. do_commit()을 사용하여 마스터 분기에 병합 할 수 있습니까? http://stackoverflow.com/questions/6904734/in-dulwich-how-do-i-commit-to-a-branch-instead-of-to-head –
나는 두려워하지 않는다 ... – Determinant