]> git.leopard-lacewing.eu Git - tex_tools.git/commitdiff
! fix for messages
authorPeter Schaefer <schaeferpm@gmail.com>
Sun, 17 Feb 2019 08:32:09 +0000 (09:32 +0100)
committerPeter Schaefer <schaeferpm@gmail.com>
Sun, 17 Feb 2019 08:32:09 +0000 (09:32 +0100)
git1.tex
gitLog2tikz.py
text-output.pdf

index c397cefeee4cb85ade85473c3e1fac33b9a988d1..07736036c8c55613d0ed6e21b97d97927d0946f3 100644 (file)
--- a/git1.tex
+++ b/git1.tex
@@ -17,7 +17,7 @@
 \node[commit, black, fill=black] (da268ea) at (0.0,3.0) {};
 \node[right,xshift=10] (labelda268ea) at (da268ea.east) {\verb!da268ea: [py] Export copy finished!};
 \node[commit, black, fill=black] (1af283b) at (0.0,3.5) {};
-\node[right,xshift=10] (label1af283b) at (1af283b.east) {\verb!1af283b: [py] some! comments!};
+\node[right,xshift=10] (label1af283b) at (1af283b.east) {\verb!1af283b: [py] some. comments!};
 \node[commit, blue, fill=blue] (69be133) at (0.5,4.0) {};
 \node[right,xshift=10] (label69be133) at (69be133.east) {\verb!69be133: [py]minor bugfix!};
 \node[commit, black, fill=black] (7ac7de4) at (0.0,4.5) {};
@@ -62,6 +62,9 @@
 \node[right,xshift=10] (labelcc9a3ca) at (cc9a3ca.east) {\verb!cc9a3ca: parsing for repo works!};
 \node[commit, black, fill=black] (769f9d1) at (0.0,14.5) {};
 \node[right,xshift=10] (label769f9d1) at (769f9d1.east) {\verb!769f9d1: new Hashing, resolve Parents works!};
+\node[commit, black, fill=black] (a53824c) at (0.0,15.0) {};
+\node[right,xshift=10] (labela53824c) at (a53824c.east) {\verb!a53824c: fixed some issues!};
+\path[black] (769f9d1) to[out=90,in=-90] (a53824c);
 \path[black] (cc9a3ca) to[out=90,in=-90] (769f9d1);
 \path[black] (52b6561) to[out=90,in=-90] (cc9a3ca);
 \path[black] (7c94d50) to[out=90,in=-90] (52b6561);
@@ -93,5 +96,5 @@
 \path[black] (e5c3cd5) to[out=90,in=-90] (9ebee64);
 \path[black] (d78896f) to[out=90,in=-90] (e5c3cd5);
 \path[black] (a6f6d74) to[out=90,in=-90] (d78896f);
-\node[branch,right,xshift=10] (feature/python2) at (label769f9d1.east) {\lstinline{feature/python2}};
+\node[branch,right,xshift=10] (feature/python2) at (labela53824c.east) {\lstinline{feature/python2}};
 \end{tikzpicture}
index 35368f8c195b638248c1b5dcb7b7ce7758b078f9..1606098e7b8f414b6558f63342cea5747dd940e3 100644 (file)
@@ -44,80 +44,8 @@ class Hash:
     def __eq__(self,other):
         return self.hash() == other.hash()
 
-class Commit:
-    def __init__(self,line):
-        self._line = None
-        self._hash: Hash = None
-        self._children = {}
-        self._parents = {}
-        self._message= None
-        self._message_pos = None
-        self._node_pos = None
-        self._node_color = None
-      
-        self._line = line
-        pos = 0
-        for word in line.split(" "):
-            if self._message:
-                self._message += " " + word
-            elif Hash.hashpat7.match(word):
-                if not self._hash:
-                    self._hash = word
-                else:
-                    self._parents[word] = NotImplemented
-            elif word == '*' and not self._message:
-                self._node_pos = pos
-            elif linepat.match(word):
-                self._message = word
-                self._message_pos = pos
-
-            pos = pos + 1
-        if self._hash:
-            self._message = self._message.replace("!","")
-
-    def __init__(self,hashes,node_pos,message_pos):
-        self._children = {}
-        self._parents = {}
-        self._message= None
-        self._node_color = None
-        self._author = None
-        self._date = None
-        self._hash = Hash(hashes[0])
-        self._node_pos = node_pos
-        self._message_pos = message_pos
-        for parent in hashes[1:]:
-            self._parents[Hash(parent).hash()] = NotImplemented
-    
-    def hash(self):
-        return self._hash.hash()
-
-    def AddInfo(self,line):
-        line = line[self._message_pos:]
-        info = line.split(':')
-        if info[0] == 'Author':
-            self._author = ':'.join(info[1:]).strip()
-        elif info[0] == 'Date':
-            tmp = ':'.join(info[1:]).strip().split(' ')
-            self._date = tmp[2] + ' ' + tmp[1] + ' ' + tmp[4]
-        elif line[0:4] == '    ':
-            if(self._message):
-                self._message = self._message + "\n" + line[4:]
-            else:
-                self._message = line[4:]
-        return
-
-    def update_parent (self, child):
-        self._parents[child.hash()] = child
-        child._children[self.hash()] = self
-
-    def export_to_tikz(self, ypos):
-        print("\\node[commit, " + color(self._node_pos) + ", fill=" +  color(self._node_pos) + "] (" + 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.replace("\n"," ") + "!};")
-        #for child in self._children.itervalues():
-        #    print("\\path[" + "blue" +"] (" + self.hash() + ") to[out=90,in=-90] (" + child.hash() + ");") 
-    
-    def __eq__(self,other):
-        return self.hash() == other.hash()
+def VerbClean(message):
+    return message.replace('\n',' ').replace("!",'.')
 
 class Branch:
     def __init__(self, line):
@@ -134,7 +62,7 @@ class Branch:
     def to_s_long(self):
         print("Name  : " + self._name)
         print("Hash  : " + self._hash)
-        print("Commit: " + self._commit)
+        print("Commit: " + VerbClean(self._commit))
 
     def to_s(self):
         print(" ".join({self._name, self._hash, self._commit}))
@@ -171,7 +99,7 @@ class Repo:
                 if node_pos >= 0: #new commit
                     com = line[message_pos:].split(' ')
                     if com[0] == 'commit':
-                        comm = Commit(com[1:],node_pos*.5,message_pos)
+                        comm = Repo.Commit(com[1:],node_pos*.5,message_pos)
                         self.add_commit(comm)
                     else:
                         raise ValueError('looks like a new commit but isn\'t: ' + line)
@@ -209,6 +137,47 @@ class Repo:
             print("\\node[branch,right,xshift=10] (" + branch._name + ") at (label" + branch.hash() + ".east) {\\lstinline{" + branch._name +"}};")
         print("\\end{tikzpicture}")
 
+    class Commit:
+        def __init__(self,hashes,node_pos,message_pos):
+            self._children = {}
+            self._parents = {}
+            self._message= None
+            self._node_color = None
+            self._author = None
+            self._date = None
+            self._hash = Hash(hashes[0])
+            self._node_pos = node_pos
+            self._message_pos = message_pos
+            for parent in hashes[1:]:
+                self._parents[Hash(parent).hash()] = NotImplemented
+        
+        def hash(self):
+            return self._hash.hash()
+
+        def AddInfo(self,line):
+            line = line[self._message_pos:]
+            info = line.split(':')
+            if info[0] == 'Author':
+                self._author = ':'.join(info[1:]).strip()
+            elif info[0] == 'Date':
+                tmp = ':'.join(info[1:]).strip().split(' ')
+                self._date = tmp[2] + ' ' + tmp[1] + ' ' + tmp[4]
+            elif line[0:4] == '    ':
+                if(self._message):
+                    self._message = self._message + "\n" + line[4:]
+                else:
+                    self._message = line[4:]
+
+        def update_parent (self, child):
+            self._parents[child.hash()] = child
+            child._children[self.hash()] = self
+
+        def export_to_tikz(self, ypos):
+            print("\\node[commit, " + color(self._node_pos) + ", fill=" +  color(self._node_pos) + "] (" + 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() + ": " + VerbClean(self._message) + "!};")
+       
+        def __eq__(self,other):
+            return self.hash() == other.hash()
 
 #parser = ArgumentParser()
 #parser.add_argument("-h", help="show this message", dest="help", default=True)
index f0ae02f9a88bc491b6823e70e87dfd19b7b0a16b..5e113863bc3581f23b7ce274e42b723289c674c9 100644 (file)
Binary files a/text-output.pdf and b/text-output.pdf differ