Fossil SCM

Reworked the dot export internals a bit to be more general regarding labeling and attribute writing. Updated the cycle breaker to define proper labels.

aku 2007-11-22 07:22 trunk
Commit f2848471340dde88a890bbcbee857a8b73a11a37
--- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
+++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
@@ -148,10 +148,11 @@
148148
set dg [struct::graph dg]
149149
150150
foreach cset $changesets {
151151
$dg node insert $cset
152152
$dg node set $cset timerange [$cset timerange]
153
+ $dg node set $cset label [ID $cset]
153154
}
154155
155156
# 2. Find for all relevant changeset their revisions and their
156157
# dependencies. Map the latter back to changesets and
157158
# construct the corresponding arcs.
158159
--- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
+++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
@@ -148,10 +148,11 @@
148 set dg [struct::graph dg]
149
150 foreach cset $changesets {
151 $dg node insert $cset
152 $dg node set $cset timerange [$cset timerange]
 
153 }
154
155 # 2. Find for all relevant changeset their revisions and their
156 # dependencies. Map the latter back to changesets and
157 # construct the corresponding arcs.
158
--- tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
+++ tools/cvs2fossil/lib/c2f_cyclebreaker.tcl
@@ -148,10 +148,11 @@
148 set dg [struct::graph dg]
149
150 foreach cset $changesets {
151 $dg node insert $cset
152 $dg node set $cset timerange [$cset timerange]
153 $dg node set $cset label [ID $cset]
154 }
155
156 # 2. Find for all relevant changeset their revisions and their
157 # dependencies. Map the latter back to changesets and
158 # construct the corresponding arcs.
159
--- tools/cvs2fossil/lib/dot.tcl
+++ tools/cvs2fossil/lib/dot.tcl
@@ -29,21 +29,31 @@
2929
3030
typemethod format {g name} {
3131
lappend lines "digraph \"$name\" \{"
3232
3333
foreach n [$g nodes] {
34
- set cmd "[$n id] \["
35
- append cmd " label=\"<[$n id]>\""
34
+ set cmd "\"$n\""
35
+ set sep " "
36
+ set head " \["
37
+ set tail ""
38
+ foreach {gattr nodekey} {
39
+ label label
40
+ shape shape
41
+ } {
42
+ if {![$g node keyexists $n $nodekey]} continue
43
+ append cmd "$head$sep${gattr}=\"[$g node get $n $nodekey]\""
3644
37
- if {[$g node keyexists $n shape]} {
38
- append cmd " shape=[$g node get $n shape]"
45
+ set sep ", "
46
+ set head ""
47
+ set tail " \]"
3948
}
40
- append cmd " \];"
49
+
50
+ append cmd ${tail} ";"
4151
lappend lines $cmd
4252
}
4353
foreach a [$g arcs] {
44
- lappend lines "[[$g arc source $a] id] -> [[$g arc target $a] id];"
54
+ lappend lines "\"[$g arc source $a]\" -> \"[$g arc target $a]\";"
4555
}
4656
4757
lappend lines "\}"
4858
return [join $lines \n]
4959
}
5060
--- tools/cvs2fossil/lib/dot.tcl
+++ tools/cvs2fossil/lib/dot.tcl
@@ -29,21 +29,31 @@
29
30 typemethod format {g name} {
31 lappend lines "digraph \"$name\" \{"
32
33 foreach n [$g nodes] {
34 set cmd "[$n id] \["
35 append cmd " label=\"<[$n id]>\""
 
 
 
 
 
 
 
 
36
37 if {[$g node keyexists $n shape]} {
38 append cmd " shape=[$g node get $n shape]"
 
39 }
40 append cmd " \];"
 
41 lappend lines $cmd
42 }
43 foreach a [$g arcs] {
44 lappend lines "[[$g arc source $a] id] -> [[$g arc target $a] id];"
45 }
46
47 lappend lines "\}"
48 return [join $lines \n]
49 }
50
--- tools/cvs2fossil/lib/dot.tcl
+++ tools/cvs2fossil/lib/dot.tcl
@@ -29,21 +29,31 @@
29
30 typemethod format {g name} {
31 lappend lines "digraph \"$name\" \{"
32
33 foreach n [$g nodes] {
34 set cmd "\"$n\""
35 set sep " "
36 set head " \["
37 set tail ""
38 foreach {gattr nodekey} {
39 label label
40 shape shape
41 } {
42 if {![$g node keyexists $n $nodekey]} continue
43 append cmd "$head$sep${gattr}=\"[$g node get $n $nodekey]\""
44
45 set sep ", "
46 set head ""
47 set tail " \]"
48 }
49
50 append cmd ${tail} ";"
51 lappend lines $cmd
52 }
53 foreach a [$g arcs] {
54 lappend lines "\"[$g arc source $a]\" -> \"[$g arc target $a]\";"
55 }
56
57 lappend lines "\}"
58 return [join $lines \n]
59 }
60

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button