现在我正在使用 git svn 克隆 repos,当我想获取他们的所有提交并将 whem 存储到数据库时。
为了获取我使用的所有提交pygit2.Repository
,但我看到我只收到来自“/trunk/”分支的提交。
如果我git branch -a
在终端中使用,我可以看到所有分支:
* master
remotes/origin/test-1
remotes/origin/test-1@468
remotes/origin/trunk
当我这样做时,我会git log remotes/origin/test-1
看到正确提交的结果。
但是,当我尝试使用从 repo 接收所有提交时,pygit2.Repository
我只从主干接收提交,而不是从其他分支接收提交 - 你能告诉我一种从分支获取提交的方法吗?也许我不应该使用 pygit2 而是使用其他一些 python 模块?
使用 repo.listall_branches(2) 我看到 pygit2 看到这个分支:
['origin/test-1', 'origin/trunk', 'origin/test-1@468']
但是当我尝试做repo.lookup_branch('origin/test-1')
或者repo.lookup_branch('remote/origin/test-1')
我收到 None 而不是pygit2.Branch
objects
当我这样做的时候
head = repo.lookup_branch('master').get_object()
for native_commit in repo.walk(head.hex):
print(i)
我只收到来自trunk
. 请告诉我一个正确的方法来接收来自所有分支的所有提交,而不仅仅是来自trunk
.