Fossil

Check-in [b8c35421]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added two helper applications which peek into a conversion state and generate graphs from it. Both helpers look at the tree of symbols and show it in toto (symbol tree), or restrict themselves to the branches, aka lines of development (lodtree).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b8c3542172c11e429a12696ea8f6d78397f9b97b
User & Date: aku 2007-11-22 07:24:06
Context
2007-11-23
05:38
Added two more debugging helper applications. One to extract and show a file revision tree, the other to display a dot file generated by the importer during cycle breaking passes. check-in: 64d0019e user: aku tags: trunk
2007-11-22
07:24
Added two helper applications which peek into a conversion state and generate graphs from it. Both helpers look at the tree of symbols and show it in toto (symbol tree), or restrict themselves to the branches, aka lines of development (lodtree). check-in: b8c35421 user: aku tags: trunk
07:22
Reworked the dot export internals a bit to be more general regarding labeling and attribute writing. Updated the cycle breaker to define proper labels. check-in: f2848471 user: aku tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added tools/cvs2fossil/lodtree.

















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
## -*- tcl -*- \
exec tclsh "$0" ${1+"$@"}

# # ## ### ##### ######## ############# #####################
## Copyright (c) 2007 Andreas Kupries.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# This software consists of voluntary contributions made by many
# individuals.  For exact contribution history, see the revision
# history and logs, available at http://fossil-scm.hwaci.com/fossil
# # ## ### ##### ######## ############# #####################

## Command line application to extract the tree of branches (lines of
## development) from a state database and show it graphically. The
## code uses GraphViz's 'dot' to do the layouting and conversion into
## an image.

# # ## ### ##### ######## ############# #####################
## Requirements, extended package management for local packages.

lappend auto_path [file join [file dirname [info script]] lib]

package require Tcl 8.4                               ; # Required runtime.
package require struct::graph                         ; # Graph handling.
package require struct::list                          ; # Higher order list ops.
package require vc::fossil::import::cvs::state        ; # State storage.
package require vc::tools::dot                        ; # Graph export to DOT.

namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::tools::dot

# Process the command line. Get the database to access.

state use [lindex $argv 0]
state reading symbol
state reading parent

# Get the data of all symbols in the state as a list for iteration,
# and as array for random access of neighbouring symbols.

foreach {sid name} [set symbols [state run { SELECT sid, name FROM symbol }]] {
    set sym($sid) [list $name]
}
foreach {sid lod} [state run { SELECT sid, lod FROM tag }] {
    catch {unset sym($sid)}
}
foreach {sid lod} [state run { SELECT sid, lod FROM branch }] {
    lappend sym($sid) $lod $sym($lod) diamond Branch
}

# Start the graph

struct::graph dg

# Convert the symbols into nodes of the graph, and use node attributes
# to highlight various pieces of interest for the dot conversion.
# Label => Symbol name.

foreach sid [array names sym] {
    dg node insert $sid
    struct::list assign $sym($sid) name lod lodname shape what
    if {$shape eq ""} { set shape circle }
    if {$what ne ""} { append what " " }
    dg node set $sid label "$what$name"
    dg node set $sid shape $shape
}

# Go through the symbols a second time, now set up the arcs based on
# their parent choices. Use arc attributes to highlight interesting
# things (...).

foreach sid [array names sym] {
    struct::list assign $sym($sid) name lod lodname shape
    if {$lod eq ""} continue ; # Root has no parent.
    dg arc insert $sid $lod
}

# Convert the graph to dot, then run the layouter and convert to png,
# at last show the image.

vc::tools::dot layout png dg SymbolTree st.png
exec display st.png
file delete st.png
exit

Added tools/cvs2fossil/symboltree.

















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
## -*- tcl -*- \
exec tclsh "$0" ${1+"$@"}

# # ## ### ##### ######## ############# #####################
## Copyright (c) 2007 Andreas Kupries.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# This software consists of voluntary contributions made by many
# individuals.  For exact contribution history, see the revision
# history and logs, available at http://fossil-scm.hwaci.com/fossil
# # ## ### ##### ######## ############# #####################

## Command line application to extract the tree of symbols (tags and
## branches) from a state database and show it graphically. The code
## uses GraphViz's 'dot' to do the layouting and conversion into an
## image.

# # ## ### ##### ######## ############# #####################
## Requirements, extended package management for local packages.

lappend auto_path [file join [file dirname [info script]] lib]

package require Tcl 8.4                               ; # Required runtime.
package require struct::graph                         ; # Graph handling.
package require struct::list                          ; # Higher order list ops.
package require vc::fossil::import::cvs::state        ; # State storage.
package require vc::tools::dot                        ; # Graph export to DOT.

namespace import ::vc::fossil::import::cvs::state
namespace import ::vc::tools::dot

# Process the command line. Get the database to access.

state use [lindex $argv 0]
state reading symbol
state reading parent

# Get the data of all symbols in the state as a list for iteration,
# and as array for random access of neighbouring symbols.

foreach {sid name} [set symbols [state run { SELECT sid, name FROM symbol }]] {
    set sym($sid) [list $name]
}
foreach {sid lod} [state run { SELECT sid, lod FROM tag }] {
    lappend sym($sid) $lod $sym($lod) box Tag
}
foreach {sid lod} [state run { SELECT sid, lod FROM branch }] {
    lappend sym($sid) $lod $sym($lod) diamond Branch
}

# Start the graph

struct::graph dg

# Convert the symbols into nodes of the graph, and use node attributes
# to highlight various pieces of interest for the dot conversion.
# Label => Symbol name.

foreach sid [array names sym] {
    dg node insert $sid
    struct::list assign $sym($sid) name lod lodname shape what
    if {$shape eq ""} { set shape circle }
    if {$what ne ""} { append what " " }
    dg node set $sid label "$what$name"
    dg node set $sid shape $shape
}

# Go through the symbols a second time, now set up the arcs based on
# their parent choices. Use arc attributes to highlight interesting
# things (...).

foreach sid [array names sym] {
    struct::list assign $sym($sid) name lod lodname shape
    if {$lod eq ""} continue ; # Root has no parent.
    dg arc insert $sid $lod
}

# Convert the graph to dot, then run the layouter and convert to png,
# at last show the image.

vc::tools::dot layout png dg SymbolTree st.png
exec display st.png
file delete st.png
exit