From: Peter Schaefer Date: Wed, 2 Jan 2019 22:13:41 +0000 (+0100) Subject: [py]minor bugfix X-Git-Tag: v1.0~9^2 X-Git-Url: https://git.leopard-lacewing.eu/?a=commitdiff_plain;h=69be133cfab4e2b51d58c5051335a42817b4a9eb;p=tex_tools.git [py]minor bugfix --- diff --git a/git-log-to-tikz.py b/git-log-to-tikz.py index b8a5da2..3d63a12 100755 --- a/git-log-to-tikz.py +++ b/git-log-to-tikz.py @@ -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")) diff --git a/git1.tex b/git1.tex index 37d960c..6cced47 100644 --- 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} diff --git a/text-output.pdf b/text-output.pdf index f3cf990..58280c8 100644 Binary files a/text-output.pdf and b/text-output.pdf differ