import os.path
|
|
from rawcommit import RawCommit
|
from commit import Commit
|
|
def getCommitList(repo):
|
"""returns a list of commits from a repository log"""
|
try:
|
stream = os.popen("git -C {} log --format=%B--SEP--%H--SEP--%d--END--".format(repo)) # formatted log
|
except:
|
raise ValueError("Not a valid git-repository!")
|
else:
|
gitLog = stream.read()
|
commitList = gitLog.split("--END--") # separation of individual commits
|
del commitList[-1] # deletes empty last element
|
|
rawCommitList = []
|
for commit in commitList: # convert every commit into Commit via RawCommit
|
rawCommitList.append(Commit(RawCommit(commit)))
|
return commitList
|