现在我使用 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
对象时
当我这样做时
head = repo.lookup_branch('master').get_object()
for native_commit in repo.walk(head.hex):
print(i)
我只收到来自trunk
. 请告诉我一种从所有分支接收所有提交的正确方法,而不仅仅是来自trunk
.
根据http://www.pygit2.org/references.html#branches上的文档,repo.branches
应该为您提供所有分支,本地和远程分支。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句