如何获取 hg History 的输出并将其转换为 点 文件?
hg History
How can I take the output of hg history and convert it into a dot file?
hg history
您正在寻找此扩展程序。
You are looking for this extension.
我编写了一个脚本来执行此操作(并将其命名为 hghistory2dot.pl)。请参阅代码下方的用法:
#!/usr/bin/perl print "digraph {\n"; $first = 1; $cset = (); sub printedge { my $one = csetstr(shift(@_)); my $two = csetstr(shift(@_)); print $one, " -> ", $two, ";\n"; } sub csetstr { my $csetid = shift(@_); $csetid =~ s/\s//; $csetid =~ s/\\n//; return "cset_" . $csetid; } while($line = <> ) { if (!($line eq "\n") ) { $line =~ s/\n/\\n/; push(@cset, $line); } else { print csetstr($current), " [shape=record label=\"", @cset, "\"];\n"; @cset = (); } if( $line =~ m/^changeset/ ) { @arr = split(/:/, $line); $arr[2] =~ s/\s//; if( ! $parent_found && ! $first) { #previous changeset had no defined parent; therefore this one is the implied parent. printedge($current, $arr[2]); } $current = $arr[2]; $parent_found = 0; $first = 0; } elsif($line =~ m/^parent/) { $parent_found = 1; @arr = split(/:/, $line); $arr[2] =~ s/\s//; printedge($current, $arr[2]); } } print "}\n";
hg History | hghistory2dot.pl |点-Tpng>树.png
I wrote a script to do this (and called it hghistory2dot.pl). See its usage below the code:
hg history | hghistory2dot.pl | dot -Tpng > tree.png
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(2)
您正在寻找此扩展程序。
You are looking for this extension.
我编写了一个脚本来执行此操作(并将其命名为 hghistory2dot.pl)。请参阅代码下方的用法:
hg History | hghistory2dot.pl |点-Tpng>树.png
I wrote a script to do this (and called it hghistory2dot.pl). See its usage below the code:
hg history | hghistory2dot.pl | dot -Tpng > tree.png