我使用GraphViz和以下点文件:
digraph "Fast-forward"
{
rankdir=LR;
subgraph master
{
"5c071a6b2c" -> "968bda3251";
}
subgraph branch
{
"35ee8ce6b6" [color="blue"] [style="filled"];
"968bda3251" -> "9754d40473" [weight=0];
"9754d40473" -> "9e59700d33" -> "35ee8ce6b6";
}
subgraph c1
{
rankdir=LR;
rank="same";
"remote/master/HEAD" [shape=box];
"remote/master/HEAD" -> "35ee8ce6b6" [weight=0];
oldmh [label="master/HEAD"] [shape=box] [color="red"] [style="filled"];
newmh [label="master/HEAD"] [shape=box] [color="blue"] [style="filled"];
oldmh -> "968bda3251" [weight=0];
newmh -> "35ee8ce6b6" [weight=0];
}
}
它给我这样的东西:
但我想要这样的东西:
white | \/ "9754d40473" -> "9e59700d33" -> "35ee8ce6b6"; / /\
5c071a6b2c - > 968bda3251
/\ | | red blue
我该怎么做?
为了你的帮助, 先谢谢。
答案 0 :(得分:3)
我倾向于首先定义所有具有特殊需求的节点(如同一级别或具有特殊形状/颜色),然后定义链接。这样,您可以确保rank=same
个节点已正确分组,并按正确的顺序定义。
如果没有weight=0
,则所有侧链接都位于顶部。将weight=0
添加到底部的所需内容。
digraph "Fast-forward"
{
rankdir=LR;
subgraph c1 {
rank="same";
"968bda3251";
oldmh [label="master/HEAD"] [shape=box] [color="red"] [style="filled"];
}
subgraph c2
{
rank="same";
"remote/master/HEAD" [shape=box];
"35ee8ce6b6" [color="blue"] [style="filled"];
newmh [label="master/HEAD"] [shape=box] [color="blue"] [style="filled"];
}
"5c071a6b2c" -> "968bda3251" -> "9754d40473" -> "9e59700d33" -> "35ee8ce6b6";
oldmh -> "968bda3251" [weight=0];
"remote/master/HEAD" -> "35ee8ce6b6";
newmh -> "35ee8ce6b6" [weight=0];
}
如果你真的想要在96到97之间慢跑,你可以这样做:
digraph "Fast-forward"
{
rankdir=LR;
subgraph c1 {
rank=same;
"968bda3251";
oldmh [label="master/HEAD"] [shape=box] [color="red"] [style="filled"];
}
subgraph c1p5 {
rank=same;
"9754d40473";
inviso [style="invis"];
}
subgraph c2
{
rank="same";
"remote/master/HEAD" [shape=box];
"35ee8ce6b6" [color="blue"] [style="filled"];
newmh [label="master/HEAD"] [shape=box] [color="blue"] [style="filled"];
}
"5c071a6b2c" -> "968bda3251";
"968bda3251" -> "9754d40473" [weight=0];
"9754d40473" -> "9e59700d33" -> "35ee8ce6b6";
oldmh -> "968bda3251" [weight=0];
"remote/master/HEAD" -> "35ee8ce6b6";
newmh -> "35ee8ce6b6" [weight=0];
"968bda3251" -> inviso [style="invis"];
"9754d40473" -> inviso [style="invis"];
}
答案 1 :(得分:0)
rank="same"
会影响子图的所有节点,因此您必须将标记子图拆分为两部分:
digraph "Fast-forward"
{
rankdir=LR;
subgraph master
{
"5c071a6b2c" -> "968bda3251";
}
subgraph branch
{
"968bda3251" -> "9754d40473" [weight=0];
"9754d40473" -> "9e59700d33" -> "35ee8ce6b6";
"35ee8ce6b6" [color="blue"] [style="filled"];
}
subgraph c1
{
rank="same";
"remote/master/HEAD" [shape=box];
"remote/master/HEAD" -> "35ee8ce6b6" [weight=0];
newmh [label="master/HEAD"] [shape=box] [color="blue"] [style="filled"];
newmh -> "35ee8ce6b6" [weight=0];
}
subgraph c2
{
rank="same";
oldmh [label="master/HEAD"] [shape=box] [color="red"] [style="filled"];
oldmh -> "968bda3251" [weight=0];
}
}
这会给你: