df89
10.10.21 c4d692c98f3e06d39cf80bf8fa2035c2e398646b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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