From: Peter Schaefer Date: Sun, 17 Feb 2019 15:48:06 +0000 (+0100) Subject: [py] Time Information getting parsed -> sortable X-Git-Tag: v1.2~1 X-Git-Url: https://git.leopard-lacewing.eu/?a=commitdiff_plain;h=38c614ca1967b4f2ac23cefb9b8ab8cc3b59ef50;p=tex_tools.git [py] Time Information getting parsed -> sortable --- diff --git a/generic/git2.tex b/generic/git2.tex index ab5bc03..a067591 100644 --- a/generic/git2.tex +++ b/generic/git2.tex @@ -2,6 +2,8 @@ \arrayrulecolor{lightgray}\hline Date & Changes & Author\\ \arrayrulecolor{lightgray}\hline +17 Feb 2019&minor fixes&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ +\arrayrulecolor{lightgray}\hline 17 Feb 2019&[doc] new generic directory&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ \arrayrulecolor{lightgray}\hline 17 Feb 2019&started table output&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ @@ -10,26 +12,26 @@ Date & Changes & Author\\ \arrayrulecolor{lightgray}\hline 17 Feb 2019&fixed some issues&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ \arrayrulecolor{lightgray}\hline -3 Jan 2019&[doc] lsting Hooks&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ +03 Jan 2019&[doc] lsting Hooks&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ \arrayrulecolor{lightgray}\hline -3 Jan 2019&[doc] Hook2 test&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ +03 Jan 2019&[doc] Hook2 test&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ \arrayrulecolor{lightgray}\hline -3 Jan 2019&[doc] Hook2 test&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ +03 Jan 2019&[doc] Hook2 test&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ \arrayrulecolor{lightgray}\hline -3 Jan 2019&[doc] Hook test&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ +03 Jan 2019&[doc] Hook test&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ \arrayrulecolor{lightgray}\hline -3 Jan 2019&[doc] Features/Bugs +03 Jan 2019&[doc] Features/Bugs [py] reversed changed&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ \arrayrulecolor{lightgray}\hline -3 Jan 2019&[doc] neuer Branch&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ +03 Jan 2019&[doc] neuer Branch&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ \arrayrulecolor{lightgray}\hline -2 Jan 2019&[doc] neues Hooks&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ +02 Jan 2019&[doc] neues Hooks&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ \arrayrulecolor{lightgray}\hline -2 Jan 2019&[py] Export copy finished&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ +02 Jan 2019&[py] Export copy finished&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ \arrayrulecolor{lightgray}\hline -2 Jan 2019&[doc] kleine änderrung&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ +02 Jan 2019&[doc] kleine änderrung&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ \arrayrulecolor{lightgray}\hline -2 Jan 2019&Grober Latex Test&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ +02 Jan 2019&Grober Latex Test&\href{mailto:schaeferpm@gmail.com}{Peter Schaefer}\\ \arrayrulecolor{lightgray}\hline \arrayrulecolor{lightgray}\hline \end{tabular} diff --git a/gitLog2tikz.py b/gitLog2tikz.py index cee16e2..b48e5f3 100644 --- a/gitLog2tikz.py +++ b/gitLog2tikz.py @@ -6,6 +6,7 @@ from subprocess import check_output from collections import OrderedDict from re import compile, match from argparse import ArgumentParser +from datetime import datetime import sys out_stream = sys.stdout @@ -179,14 +180,17 @@ class Repo: def hash(self): return self._hash.hash() + def date(self): + return self._date.strftime("%d %b %Y") + def AddInfo(self,line): line = line[self._message_pos:] info = line.split(':') if info[0] == 'Author': self._author = Author(':'.join(info[1:]).strip()) elif info[0] == 'Date': - tmp = ':'.join(info[1:]).strip().split(' ') - self._date = tmp[2] + ' ' + tmp[1] + ' ' + tmp[4] + t = ':'.join(info[1:]).strip() + self._date = datetime.strptime(t,"%a %b %d %H:%M:%S %Y %z") elif info[0] == 'Merge': self._merge = info[1].strip().split(' ') elif line[0:4] == ' ': @@ -208,7 +212,7 @@ class Repo: out("\\node[right,xshift=10] (label" + self.hash() + ") at (" + self.hash() + ".east) {\\verb!" + self.hash() + ": " + VerbClean(self._message) + "!};") def export_commit2table(self): - out(self._date + '&' + Str2Tex(self._message) + '&' + self._author.auth2Tex() + "\\\\") + out(self.date() + '&' + Str2Tex(self._message) + '&' + self._author.auth2Tex() + "\\\\") def export_path2tikz(self): for child in self._children.values(): @@ -216,6 +220,10 @@ class Repo: def __eq__(self,other): return self.hash() == other.hash() + + def __lt__(self,other): + return self._date < other._date + class Branch: def __init__(self, line): words = list(filter(lambda x:x!='',line[2:].split(" "))) diff --git a/text-output.pdf b/text-output.pdf index f939bdb..1a50c02 100644 Binary files a/text-output.pdf and b/text-output.pdf differ