dot语言是一种使用代码描述各种图形关系的工具,通常需要安装graphviz。
有两种方法使用dot语言:使用graphviz,使用plantuml。
- 使用graphviz
graphviz一般是在linux下面运行命令 - 使用plantuml
plantuml中使用graphviz/dot需要以"@startuml"开头,以"@enduml"结束。
可以通过在线plantuml网站来绘制,非常方便,就避免了在linux下输入命令
plantuml中使用dot的例子:
@startdot
digraph graph_name {
shape1 [shape=box, label="矩形 "];
shape3 [shape=ellipse, label="椭圆 "];
shape5 [shape="diamond", label="菱形 "];
shape1:s -> shape3
shape3 -> shape5
}
@enddot
下面绘制一个gitflow的开发流程:
@startdot
digraph gitflow_workflow {
"开始" [shape="box"]
"开始" -> "新的feature还是新的bug?"
"新的feature还是新的bug?" [shape="diamond"]
"新的feature还是新的bug?" -> "从dev分支创建feat-xxx分支" [label = "新feature"]
"新的feature还是新的bug?" -> "从master中fork分支fixbug-xxx" [label = "新bug"]
"从master中fork分支fixbug-xxx" [shape="box"]
"从master中fork分支fixbug-xxx" -> "在分支fixbug-xxx中修改bug" [label=""]
"在分支fixbug-xxx中修改bug" [shape="box"]
"在分支fixbug-xxx中修改bug" -> "分支fixbug-xxx合并到master" [label="bug修改完成"]
"在分支fixbug-xxx中修改bug" -> "分支fixbug-xxx合并到develop" [label="bug修改完成"]
"分支fixbug-xxx合并到master" [shape="box"]
"分支fixbug-xxx合并到master" -> "master分支版本增加" [label=""]
"分支fixbug-xxx合并到develop" [shape="box"]
"分支fixbug-xxx合并到develop" -> "完成"
"master分支版本增加" [shape="box"]
"master分支版本增加" -> "完成"
"完成" [shape="box"]
"从dev分支创建feat-xxx分支" [shape="box"]
"从dev分支创建feat-xxx分支" -> "开发feat-xxx分支" [label=""]
"开发feat-xxx分支" [shape="box"]
"开发feat-xxx分支" -> "合并feat-xxx分支到dev分支" [label="新特点完成"]
"合并feat-xxx分支到dev分支" [shape="box"]
"合并feat-xxx分支到dev分支" -> "从dev分支创建release分支"
"从dev分支创建release分支" [shape="box"]
"从dev分支创建release分支" -> "release分支新版本发布"
"release分支新版本发布" [shape="box"]
"release分支新版本发布" -> "release分支合并到master分支"
"release分支新版本发布" -> "release分支合并到dev分支"
"release分支合并到master分支" [shape="box"]
"release分支合并到master分支" -> "完成"
"release分支合并到dev分支" [shape="box"]
"release分支合并到dev分支" -> "完成"
}
@enddot
结果是这样的: