From c4d692c98f3e06d39cf80bf8fa2035c2e398646b Mon Sep 17 00:00:00 2001 From: df89 <df89@me.com> Date: Sun, 10 Oct 2021 18:24:20 +0200 Subject: [PATCH] refactor: separated script into different files --- functions.py | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/functions.py b/functions.py new file mode 100644 index 0000000..ec0bb4a --- /dev/null +++ b/functions.py @@ -0,0 +1,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 \ No newline at end of file -- Gitblit v1.9.1