\node[right,xshift=10] (label2256509) at (2256509.east) {\verb!2256509: [py] fixed automatic colors!};
\node[commit, black, fill=black] (6e41ab0) at (0.0,6.0) {};
\node[right,xshift=10] (label6e41ab0) at (6e41ab0.east) {\verb!6e41ab0: [py] fixed order!};
-\node[commit, black, fill=black] (53e02cf) at (0.0,6.5) {};
+\node[commit, blue, fill=blue] (16d4f59) at (0.5,6.5) {};
+\node[right,xshift=10] (label16d4f59) at (16d4f59.east) {\verb!16d4f59: [doc] test!};
+\node[commit, black, fill=black] (53e02cf) at (0.0,7.0) {};
\node[right,xshift=10] (label53e02cf) at (53e02cf.east) {\verb!53e02cf: [doc] test!};
-\node[commit, black, fill=black] (8dde7ec) at (0.0,7.0) {};
+\node[commit, black, fill=black] (8dde7ec) at (0.0,7.5) {};
\node[right,xshift=10] (label8dde7ec) at (8dde7ec.east) {\verb!8dde7ec: [doc] neues Hooks!};
-\node[commit, black, fill=black] (8024ece) at (0.0,7.5) {};
+\node[commit, black, fill=black] (8024ece) at (0.0,8.0) {};
\node[right,xshift=10] (label8024ece) at (8024ece.east) {\verb!8024ece: [doc] hook test!};
-\node[commit, black, fill=black] (7ef61eb) at (0.0,8.0) {};
+\node[commit, black, fill=black] (7ef61eb) at (0.0,8.5) {};
\node[right,xshift=10] (label7ef61eb) at (7ef61eb.east) {\verb!7ef61eb: [doc] hooktest 2!};
-\node[commit, black, fill=black] (d477a13) at (0.0,8.5) {};
-\node[right,xshift=10] (labeld477a13) at (d477a13.east) {\verb!d477a13: [doc] neuer Branch!};
\node[commit, blue, fill=blue] (d2bf877) at (0.5,9.0) {};
\node[right,xshift=10] (labeld2bf877) at (d2bf877.east) {\verb!d2bf877: [py] new git order!};
\node[commit, blue, fill=blue] (6b30984) at (0.5,9.5) {};
\node[right,xshift=10] (label6b30984) at (6b30984.east) {\verb!6b30984: [py] 2new git order!};
-\node[commit, blue, fill=blue] (827f503) at (0.5,10.0) {};
+\node[commit, brown, fill=brown] (feccffc) at (1.0,10.0) {};
+\node[right,xshift=10] (labelfeccffc) at (feccffc.east) {\verb!feccffc: Merge branch 'develop'!};
+\node[commit, brown, fill=brown] (1b6432e) at (1.0,10.5) {};
+\node[right,xshift=10] (label1b6432e) at (1b6432e.east) {\verb!1b6432e: merge successful!};
+\node[commit, blue, fill=blue] (827f503) at (0.5,11.0) {};
\node[right,xshift=10] (label827f503) at (827f503.east) {\verb!827f503: [doc] Features/Bugs [py] reversed changed!};
-\node[commit, blue, fill=blue] (0ee95d1) at (0.5,10.5) {};
+\node[commit, blue, fill=blue] (0ee95d1) at (0.5,11.5) {};
\node[right,xshift=10] (label0ee95d1) at (0ee95d1.east) {\verb!0ee95d1: [doc] Hook test!};
-\node[commit, blue, fill=blue] (0009b09) at (0.5,11.0) {};
+\node[commit, blue, fill=blue] (0009b09) at (0.5,12.0) {};
\node[right,xshift=10] (label0009b09) at (0009b09.east) {\verb!0009b09: [doc] Hook2 test!};
-\node[commit, blue, fill=blue] (494a6ba) at (0.5,11.5) {};
+\node[commit, blue, fill=blue] (494a6ba) at (0.5,12.5) {};
\node[right,xshift=10] (label494a6ba) at (494a6ba.east) {\verb!494a6ba: [doc] Hook2 test!};
-\node[commit, blue, fill=blue] (ddec20f) at (0.5,12.0) {};
+\node[commit, blue, fill=blue] (ddec20f) at (0.5,13.0) {};
\node[right,xshift=10] (labelddec20f) at (ddec20f.east) {\verb!ddec20f: [doc] lsting Hooks!};
-\node[commit, blue, fill=blue] (71f4986) at (0.5,12.5) {};
+\node[commit, brown, fill=brown] (65dae54) at (1.0,13.5) {};
+\node[right,xshift=10] (label65dae54) at (65dae54.east) {\verb!65dae54: Merge branch 'develop'!};
+\node[commit, black, fill=black] (d477a13) at (0.0,14.0) {};
+\node[right,xshift=10] (labeld477a13) at (d477a13.east) {\verb!d477a13: [doc] neuer Branch !};
+\node[commit, blue, fill=blue] (71f4986) at (0.5,14.5) {};
\node[right,xshift=10] (label71f4986) at (71f4986.east) {\verb!71f4986: [py] better color function!};
-\node[commit, black, fill=black] (7c94d50) at (0.0,13.0) {};
+\node[commit, black, fill=black] (7c94d50) at (0.0,15.0) {};
\node[right,xshift=10] (label7c94d50) at (7c94d50.east) {\verb!7c94d50: Merge branch 'develop' into feature/python2!};
-\node[commit, black, fill=black] (52b6561) at (0.0,13.5) {};
+\node[commit, black, fill=black] (52b6561) at (0.0,15.5) {};
\node[right,xshift=10] (label52b6561) at (52b6561.east) {\verb!52b6561: minor PyUpdate Fix Front parsing works basic!};
-\node[commit, black, fill=black] (cc9a3ca) at (0.0,14.0) {};
+\node[commit, black, fill=black] (cc9a3ca) at (0.0,16.0) {};
\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[commit, black, fill=black] (769f9d1) at (0.0,16.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[commit, black, fill=black] (a53824c) at (0.0,17.0) {};
\node[right,xshift=10] (labela53824c) at (a53824c.east) {\verb!a53824c: fixed some issues!};
-\node[commit, black, fill=black] (0f95945) at (0.0,15.5) {};
+\node[commit, black, fill=black] (0f95945) at (0.0,17.5) {};
\node[right,xshift=10] (label0f95945) at (0f95945.east) {\verb!0f95945: . fix for messages!};
-\node[commit, black, fill=black] (a0c0aef) at (0.0,16.0) {};
+\node[commit, black, fill=black] (a0c0aef) at (0.0,18.0) {};
\node[right,xshift=10] (labela0c0aef) at (a0c0aef.east) {\verb!a0c0aef: branches get loaded correctly!};
-\node[commit, black, fill=black] (625259d) at (0.0,16.5) {};
+\node[commit, black, fill=black] (625259d) at (0.0,18.5) {};
\node[right,xshift=10] (label625259d) at (625259d.east) {\verb!625259d: save Merged Info!};
+\node[commit, black, fill=black] (d151979) at (0.0,19.0) {};
+\node[right,xshift=10] (labeld151979) at (d151979.east) {\verb!d151979: -o functioniert (traumhaft)!};
+\node[commit, black, fill=black] (2d3b28d) at (0.0,19.5) {};
+\node[right,xshift=10] (label2d3b28d) at (2d3b28d.east) {\verb!2d3b28d: -o functioniert (traumhaft)!};
+\path[black] (d151979) to[out=90,in=-90] (2d3b28d);
+\path[black] (625259d) to[out=90,in=-90] (d151979);
\path[black] (a0c0aef) to[out=90,in=-90] (625259d);
\path[black] (0f95945) to[out=90,in=-90] (a0c0aef);
\path[black] (a53824c) to[out=90,in=-90] (0f95945);
\path[black] (52b6561) to[out=90,in=-90] (cc9a3ca);
\path[black] (7c94d50) to[out=90,in=-90] (52b6561);
\path[blue] (71f4986) to[out=90,in=-90] (7c94d50);
+\path[black] (d477a13) to[out=90,in=-90] (7c94d50);
\path[blue] (ddec20f) to[out=90,in=-90] (71f4986);
+\path[blue] (ddec20f) to[out=90,in=-90] (65dae54);
\path[blue] (494a6ba) to[out=90,in=-90] (ddec20f);
\path[blue] (0009b09) to[out=90,in=-90] (494a6ba);
\path[blue] (0ee95d1) to[out=90,in=-90] (0009b09);
\path[blue] (827f503) to[out=90,in=-90] (0ee95d1);
+\path[brown] (1b6432e) to[out=90,in=-90] (65dae54);
+\path[brown] (feccffc) to[out=90,in=-90] (1b6432e);
\path[blue] (6b30984) to[out=90,in=-90] (827f503);
+\path[blue] (6b30984) to[out=90,in=-90] (feccffc);
\path[blue] (d2bf877) to[out=90,in=-90] (6b30984);
-\path[black] (d477a13) to[out=90,in=-90] (7c94d50);
-\path[black] (7ef61eb) to[out=90,in=-90] (d2bf877);
\path[black] (7ef61eb) to[out=90,in=-90] (d477a13);
+\path[black] (7ef61eb) to[out=90,in=-90] (d2bf877);
\path[black] (8024ece) to[out=90,in=-90] (7ef61eb);
\path[black] (8dde7ec) to[out=90,in=-90] (8024ece);
\path[black] (53e02cf) to[out=90,in=-90] (8dde7ec);
+\path[blue] (16d4f59) to[out=90,in=-90] (feccffc);
\path[black] (6e41ab0) to[out=90,in=-90] (53e02cf);
+\path[black] (6e41ab0) to[out=90,in=-90] (16d4f59);
\path[black] (2256509) to[out=90,in=-90] (6e41ab0);
\path[black] (8a5d531) to[out=90,in=-90] (2256509);
\path[black] (7ac7de4) to[out=90,in=-90] (8a5d531);
\path[black] (d78896f) to[out=90,in=-90] (e5c3cd5);
\path[black] (a6f6d74) to[out=90,in=-90] (d78896f);
\node[branch,right,xshift=10] (develop) at (labela0c0aef.east) {\lstinline{develop}};
-\node[branch,right,xshift=10] (feature/python2) at (label625259d.east) {\lstinline{feature/python2}};
+\node[branch,right,xshift=10] (feature/python2) at (label2d3b28d.east) {\lstinline{feature/python2}};
+\node[branch,right,xshift=10] (master) at (label65dae54.east) {\lstinline{master}};
+\node[branch,right,xshift=10] (origin/HEAD) at (label65dae54.east) {\lstinline{origin/HEAD}};
\node[branch,right,xshift=10] (origin/develop) at (label71f4986.east) {\lstinline{origin/develop}};
\node[branch,right,xshift=10] (origin/feature/python) at (label6b30984.east) {\lstinline{origin/feature/python}};
\node[branch,right,xshift=10] (origin/feature/python2) at (label769f9d1.east) {\lstinline{origin/feature/python2}};
+\node[branch,right,xshift=10] (origin/master) at (label65dae54.east) {\lstinline{origin/master}};
\end{tikzpicture}
def VerbClean(message):
return message.replace('\n',' ').replace("!",'.')
-class Branch:
- def __init__(self, line):
- words = list(filter(lambda x:x!='',line[2:].split(" ")))
- name = words[0].split('/')
- if name[0] == 'remotes':
- self._remote = name[1]
- self._name = '/'.join(name[2:])
- else:
- self._name = '/'.join(name)
- self._remote = None
- if Hash.isHash(words[1]):
- self._hash = Hash(words[1])
- elif words[1] == '->':
- self._hash = None
- self._link = words[2]
- else:
- raise ValueError('Not known Branch syntax: ' + words[1])
-
- def hash(self):
- return self._hash.hash()
-
- def name(self):
- if self._remote:
- return self._remote + '/' + self._name
- else:
- return self._name
-
- def export_branch2tikz(self):
- out("\\node[branch,right,xshift=10] (" + self.name() + ") at (label" + self.hash() + ".east) {\\lstinline{" + self.name() +"}};")
-
- def __eq__(self,other):
- return self.name() == other
-
-
class Repo:
def __init__(self):
self._commits = OrderedDict()
branches = []
for line in log.split("\n"):
if not line == "":
- branches.append(Branch(line))
+ branches.append(Repo.Branch(line))
#use only branches in commitlist
for branch in branches:
if not branch._hash:
del branch._link
if branch.hash() in self._commits:
self._branches.append(branch)
-
+
+ def export_to_tabular(self):
+ out("\\begin{tabular}{!{\\color{lightgray}\\vline}c!{\\color{lightgray}\\vline}c!{\\color{lightgray}\\vline}c!{\\color{lightgray}\\vline}}")
+ out("\\arrayrulecolor{lightgray}\\hline")
+ out("Date & Changes & Author\\\\")
+ for commit in self._commits.values():
+ commit.export_commit2table()
+ out("\\arrayrulecolor{lightgray}\\hline")
+ out("\\end{tabular}")
def export_to_tikz(self):
out("\\begin{tikzpicture}")
out("\\node[commit, " + color(self._node_pos) + ", fill=" + color(self._node_pos) + "] (" + self.hash() + ") at (" + str(.5 * self._node_pos) + "," + str(ypos) + ") {};")
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 + '& \\verb!' + VerbClean(self._message) + '! &' + self._author + "\\\\")
+
def export_path2tikz(self):
for child in self._children.values():
out("\\path[" + color(self._node_pos) +"] (" + self.hash() + ") to[out=90,in=-90] (" + child.hash() + ");")
def __eq__(self,other):
return self.hash() == other.hash()
+ class Branch:
+ def __init__(self, line):
+ words = list(filter(lambda x:x!='',line[2:].split(" ")))
+ name = words[0].split('/')
+ if name[0] == 'remotes':
+ self._remote = name[1]
+ self._name = '/'.join(name[2:])
+ else:
+ self._name = '/'.join(name)
+ self._remote = None
+ if Hash.isHash(words[1]):
+ self._hash = Hash(words[1])
+ elif words[1] == '->':
+ self._hash = None
+ self._link = words[2]
+ else:
+ raise ValueError('Not known Branch syntax: ' + words[1])
+
+ def hash(self):
+ return self._hash.hash()
+
+ def name(self):
+ if self._remote:
+ return self._remote + '/' + self._name
+ else:
+ return self._name
+
+ def export_branch2tikz(self):
+ out("\\node[branch,right,xshift=10] (" + self.name() + ") at (label" + self.hash() + ".east) {\\lstinline{" + self.name() +"}};")
+
+ def __eq__(self,other):
+ return self.name() == other
args = ArgumentParser()
args.add_argument("--log_opts", help="additional options for git log", dest="log_opts", metavar='<LOG_OPTS>')
args.add_argument("--branch_opts", help="additional options for git branch", dest="branch_opts", metavar='<BRANCH_OPTS>')
args.add_argument("-o","--ofile", help="write output to <FILE>", dest="file", metavar="<FILE>")
+args.add_argument("-p","--path", help="show only history of given <PATH>", dest="path", metavar="<PATH>")
+
+args.add_argument("-t","--table", help="print table format", dest="table", action="store_true")
options = args.parse_args()
r = Repo()
# extract Commits
-cmd = "git log --graph --parents --branches"
+if options.path:
+ cmd = "git log --graph --parents -- " + options.path
+else:
+ cmd = "git log --graph --parents --branches"
+
if options.log_opts:
-# log_opts = options.log_opts.strip()
-# if log_opts[0] == log_opts[-1] and log_opts[0] in "\"'":
-# log_opts = log_opts[1:-1]
cmd = cmd + ' ' + options.log_opts
r.add_commitlog(check_output(cmd, shell=True, encoding='utf-8'))
if options.file:
with open(options.file,"w", encoding="utf-8") as out_stream:
#Export
- r.export_to_tikz()
\ No newline at end of file
+ if options.table:
+ r.export_to_tabular()
+ else:
+ r.export_to_tikz()
\ No newline at end of file