]> git.leopard-lacewing.eu Git - tex_tools.git/commitdiff
[py] init & git shell
authorPeter Schaefer <schaeferpm@gmail.com>
Wed, 2 Jan 2019 18:47:05 +0000 (19:47 +0100)
committerPeter Schaefer <schaeferpm@gmail.com>
Wed, 2 Jan 2019 18:47:05 +0000 (19:47 +0100)
git-log-to-tikz.py [new file with mode: 0644]

diff --git a/git-log-to-tikz.py b/git-log-to-tikz.py
new file mode 100644 (file)
index 0000000..e056b15
--- /dev/null
@@ -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"))