git - List all commits since last release when the tag points to a commit on other branch -


i need list commits made master branch since last release. have implement functionality using pygit2. situation bit different here.

the release made on master branch using tag on commit other branch. naive approach find sha of last tagged commit , move down history head till sha. tagged commit not made master branch in case, made other branch. interestingly, following gives correct output when run on master branch:

$ git log sometag..head --oneline 

here, sometag points commit made on other branch. so, want know how implement programmatically, if have list of commits made on master branch.

one solution coming mind find timestamp of tagged commit , filter commit list. how git log doing this, ideas?

i think you: first, use repository.walk() walker (commit iterator), , modify (walker.hide()) exclude commits reachable sometag:

from pygit2 import repository pygit2 import git_sort_time  repo = repository('.git') start = repo.revparse_single('refs/heads/master') release_tag = repo.revparse_single('refs/tags/sometag')  walker = repo.walk(start.id, git_sort_time) walker.hide(release_tag.id) commit in walker:     print commit.message 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -