Created
October 24, 2013 19:39
-
-
Save bavovna/7143639 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from subprocess import Popen, PIPE | |
def git_history(commit_from, commit_to): | |
cmd=["git", "log", "--pretty=oneline", "--grep", "'[[:digit:]]\{2,\}'", "--grep", "'issue\|feature\|bug'", "--max-parents=1", "{}...{}".format(commit_from, commit_to)] | |
cmd = " ".join(cmd) | |
p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True) | |
return p.communicate() | |
def commits(commit_from, commit_to): | |
out, err = git_history(commit_from, commit_to) | |
if len(err): | |
for l in err.split('\n'): | |
print l | |
sys.exit(1) | |
for commit in out.split('\n'): | |
yield commit | |
if __name__ == '__main__': | |
commit_from = sys.argv[1] | |
commit_to = sys.argv[2] | |
for commit in commits(commit_from, commit_to): | |
print commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment