From 9ebee64bbf66fc98f30ca4c04d222314300af4c8 Mon Sep 17 00:00:00 2001 From: Peter Schaefer Date: Wed, 2 Jan 2019 19:47:05 +0100 Subject: [PATCH] [py] init & git shell --- git-log-to-tikz.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 git-log-to-tikz.py diff --git a/git-log-to-tikz.py b/git-log-to-tikz.py new file mode 100644 index 0000000..e056b15 --- /dev/null +++ b/git-log-to-tikz.py @@ -0,0 +1,43 @@ +from subprocess import Popen, check_output + + +class Commit: + _hash = None + _children = None + _parents = None + _message = None + _node_pos = None + _node_color = None + + def __init__(self): + self._children = hash.__new__() + self._parents = hash.__new__() + self._message = "" + self._node_pos = 0 + + +class Branch: + _name = "" + _hash = "" + _commit = "" + + def __init__(self, line): + words = line.split(" ") + self._name = words.pop(0) + self._hash = words.pop(0) + self._commit = " ".join(words) + + def to_s_long(self): + print("Name : " + self._name) + print("Hash : " + self._hash) + print("Commit: " + self._commit) + + def to_s(self): + print(" ".join({self._name, self._hash, self._commit})) + + +cmd = "git log --graph --oneline --parents" + +return_output = check_output(cmd, shell=True) + +print(return_output.split("\n")) -- 2.47.3