Now i'm using git svn for cloning repos, when i want to get all their commits and store whem to the db.
For getting all the commits i use pygit2.Repository
but i see that i receive only commits from '/trunk/' branch.
If i use git branch -a
in terminal i can see all branches:
* master
remotes/origin/test-1
remotes/origin/test-1@468
remotes/origin/trunk
And when i do git log remotes/origin/test-1
i see result with proper commits.
But when i try to receive all commits from repo using pygit2.Repository
i receive commits only from trunk, not from other branches - can you advise me a way to get commits from branches too? Maybe i should not use pygit2 but use some other python module?
using repo.listall_branches(2) i see what pygit2 see this branches:
['origin/test-1', 'origin/trunk', 'origin/test-1@468']
but when i try to do repo.lookup_branch('origin/test-1')
or repo.lookup_branch('remote/origin/test-1')
i receive None instead of pygit2.Branch
objects
and when i do
head = repo.lookup_branch('master').get_object()
for native_commit in repo.walk(head.hex):
print(i)
i receive only commits from trunk
.
Please, tell me a proper way to receive all commits from all branches not only commits from trunk
.
According to its documentation at http://www.pygit2.org/references.html#branches, repo.branches
should give you all branches, local and remote ones.