]> git.leopard-lacewing.eu Git - tex_tools.git/commitdiff
[py]minor bugfix
authorPeter Schaefer <schaeferpm@gmail.com>
Wed, 2 Jan 2019 22:13:41 +0000 (23:13 +0100)
committerPeter Schaefer <schaeferpm@gmail.com>
Wed, 2 Jan 2019 22:13:41 +0000 (23:13 +0100)
git-log-to-tikz.py
git1.tex
text-output.pdf

index b8a5da2476de30c763974349d4dcdb0930f82704..3d63a12e38929a85e8b8a2baac228f6d4e077dc4 100755 (executable)
@@ -43,8 +43,10 @@ class Commit:
     def export_to_tikz(self, ypos):
         print("\\node[commit, " + "blue" + ", fill=" + "blue" + "] (" + self._hash + ") at (" + str(.5 * self._node_pos) + "," + str(ypos) + ") {};")
         print("\\node[right,xshift=10] (label_" + self._hash + ") at (" + self._hash + ".east) {\\verb!" + self._hash + ": " + self._message + "!};")
-        for child in self._children.itervalues():
-            print("\\path[" + "blue" +"] (" + self._hash + ") to[out=90,in=-90] (" + child._hash + ");") 
+        #for child in self._children.itervalues():
+        #    print("\\path[" + "blue" +"] (" + self._hash + ") to[out=90,in=-90] (" + child._hash + ");") 
+
+
 class Branch:
     def __init__(self, line):
         self._hash=""
@@ -73,8 +75,8 @@ class Repo:
             self._commits[commit._hash] = commit
 
     def resolve_parents(self):
-        for key_c, commit in self._commits.iteritems():
-            for key_p, parent in commit._parents.iteritems():
+        for commit in self._commits.values():
+            for key_p in commit._parents.keys():
                 commit.update_parent(self._commits[key_p])
 
     def add_branch(self, branch):
@@ -89,9 +91,13 @@ class Repo:
         print("\\tikzstyle{branch}=[draw,rectangle,rounded corners=3,fill=white,inner sep=2pt,minimum size=5pt]")
         ypos = 0
         ystep = -.5
-        for key_c,commit in self._commits.iteritems():
+        for commit in self._commits.values():
             commit.export_to_tikz(ypos)
             ypos = ypos + ystep
+        
+        for commit in self._commits.values():
+            for child in commit._children.values():
+                print("\\path[" + "blue" +"] (" + commit._hash + ") to[out=90,in=-90] (" + child._hash + ");") 
 
         for branch in self._branches:
             print("\\node[branch,right,xshift=10] (" + branch._name + ") at (label_" + branch._hash + ".east) {\\lstinline{" + branch._name +"}};")
@@ -103,7 +109,7 @@ class Repo:
 r = Repo()
 
 # extract Commits
-cmd = "git log --graph --oneline --parents"
+cmd = "git log --branches --graph --oneline --parents"
 
 return_output = check_output(cmd, shell=True)
 #print(return_output.split("\n"))
index 37d960ce07cf68890da09075df188446b813919f..6cced47d37800b37698746b31a7c2f26e2ca56ac 100644 (file)
--- a/git1.tex
+++ b/git1.tex
@@ -2,23 +2,26 @@
 \tikzstyle{commit}=[draw,circle,fill=white,inner sep=0pt,minimum size=5pt]
 \tikzstyle{every path}=[draw]
 \tikzstyle{branch}=[draw,rectangle,rounded corners=3,fill=white,inner sep=2pt,minimum size=5pt]
-\node[commit, blue, fill=blue] (3dbbd41) at (0.0,0) {};
+\node[commit, blue, fill=blue] (da268ea) at (0.0,0) {};
+\node[right,xshift=10] (label_da268ea) at (da268ea.east) {\verb!da268ea: [py] Export copy finished!};
+\node[commit, blue, fill=blue] (3dbbd41) at (0.0,-0.5) {};
 \node[right,xshift=10] (label_3dbbd41) at (3dbbd41.east) {\verb!3dbbd41: [py] commit & branch läuft!};
-\node[commit, blue, fill=blue] (afd6f5a) at (0.0,-0.5) {};
+\node[commit, blue, fill=blue] (afd6f5a) at (0.0,-1.0) {};
 \node[right,xshift=10] (label_afd6f5a) at (afd6f5a.east) {\verb!afd6f5a: [py] Commit funktioniert!};
-\path[blue] (afd6f5a) to[out=90,in=-90] (3dbbd41);
-\node[commit, blue, fill=blue] (9ebee64) at (0.0,-1.0) {};
+\node[commit, blue, fill=blue] (9ebee64) at (0.0,-1.5) {};
 \node[right,xshift=10] (label_9ebee64) at (9ebee64.east) {\verb!9ebee64: [py] init & git shell!};
-\path[blue] (9ebee64) to[out=90,in=-90] (afd6f5a);
-\node[commit, blue, fill=blue] (d78896f) at (0.0,-1.5) {};
+\node[commit, blue, fill=blue] (d78896f) at (0.0,-2.0) {};
 \node[right,xshift=10] (label_d78896f) at (d78896f.east) {\verb!d78896f: [doc] kleine änderrung!};
-\path[blue] (d78896f) to[out=90,in=-90] (e5c3cd5);
-\node[commit, blue, fill=blue] (e5c3cd5) at (0.0,-2.0) {};
-\node[right,xshift=10] (label_e5c3cd5) at (e5c3cd5.east) {\verb!e5c3cd5: added Ruby Skript!};
-\path[blue] (e5c3cd5) to[out=90,in=-90] (9ebee64);
 \node[commit, blue, fill=blue] (a6f6d74) at (0.0,-2.5) {};
 \node[right,xshift=10] (label_a6f6d74) at (a6f6d74.east) {\verb!a6f6d74: Grober Latex Test!};
+\node[commit, blue, fill=blue] (e5c3cd5) at (0.0,-3.0) {};
+\node[right,xshift=10] (label_e5c3cd5) at (e5c3cd5.east) {\verb!e5c3cd5: added Ruby Skript!};
+\path[blue] (3dbbd41) to[out=90,in=-90] (da268ea);
+\path[blue] (afd6f5a) to[out=90,in=-90] (3dbbd41);
+\path[blue] (9ebee64) to[out=90,in=-90] (afd6f5a);
+\path[blue] (d78896f) to[out=90,in=-90] (e5c3cd5);
 \path[blue] (a6f6d74) to[out=90,in=-90] (d78896f);
-\node[branch,right,xshift=10] (feature/python) at (label_3dbbd41.east) {\lstinline{feature/python}};
-\node[branch,right,xshift=10] (master) at (label_e5c3cd5.east) {\lstinline{master}};
+\path[blue] (e5c3cd5) to[out=90,in=-90] (9ebee64);
+\node[branch,right,xshift=10] (feature/python) at (label_da268ea.east) {\lstinline{feature/python}};
+\node[branch,right,xshift=10] (master) at (label_da268ea.east) {\lstinline{master}};
 \end{tikzpicture}
index f3cf990d5430b20722170163fe6cbb5e4adbb9f0..58280c809fcdecbe04a397219817dec82e0bf5d1 100644 (file)
Binary files a/text-output.pdf and b/text-output.pdf differ