Fossil SCM

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.

aku 2007-11-23 05:38 UTC trunk
Commit 64d0019e0fdc2971f890b21c42ee0d6f3ca25a39
--- a/tools/cvs2fossil/filerevtree
+++ b/tools/cvs2fossil/filerevtree
@@ -0,0 +1,158 @@
1
+#!/bin/sh
2
+## -*- tcl -*- \
3
+exec tclsh "$0" ${1+"$@"}
4
+
5
+# # ## ### ##### ######## ############# #####################
6
+## Copyright (c) 2007 Andreas Kupries.
7
+#
8
+# This software is licensed as described in the file LICENSE, which
9
+# you should have received as part of this distribution.
10
+#
11
+# This software consists of voluntary contributions made by many
12
+# individuals. For exact contribution history, see the revision
13
+# history and logs, available at http://fossil-scm.hwaci.com/fossil
14
+# # ## ### ##### ######## ############# #####################
15
+
16
+## Helper application, debugging of cvs2fossil. This application
17
+## extracts the tree of revisions for a file of inte#!/bin/sh
18
+## -*- tcl -*#!/bin/sh
19
+## -*- tcl -*- \
20
+exec tclsh "$0" ${1+"$@"}
21
+
22
+# # ## ### ##### ######## ############# #####################
23
+## Copyright (c) 2007 Andreas Kupries.
24
+#
25
+# This software is licensed as described in the file LICENSE, which
26
+# you should have received as part of this distribution.
27
+#
28
+# This software consists of voluntary contributions made by many
29
+# individuals. For exact contribution history, see the revision
30
+# history and logs, available at http://fossil-scm.hwaci.com/fossil
31
+# # ## ### ##### ######## ############# #####################
32
+
33
+## Helper application, debugging of cvs2fossil. This application
34
+## extracts the tree of revisions for a file of interest, specified
35
+## either directly through its id, or indirectly through the id of a
36
+## revision it contains, and generates a nice graphical representation
37
+## of it (png image). It uses GraphiViz's 'dot' tool to do all the
38
+## layouting.
39
+
40
+# # ## ### ##### ######## equire struct::list -*- \
41
+exec tclsh "$0#!/brequire struct::list ; # Higher order list ops.
42
+package require vc::fossil::import::cvs::project::rev ; # Changesets
43
+package require vc::fossil::import::cvs::state ; # State storage.
44
+package require vc::tools::misc ; # Min/max.
45
+package rrevisionevisions it contains.
46
+
47
+rtate reading project
48
+state reading file
49
+state reading revision
50
+state reading revisionbranchchildren
51
+state reading changeset
52
+state reading csitem
53
+state reading csorder
54
+
55
+set what [lindex $argv 1]
56
+set centralrid -1
57
+
58
+switch -exact -- $what {
59
+ rid {
60
+ # Get the revision of interest, identified by the internal
61
+ # numeric id used by cvs2fossil.
62
+ set centralrid [lindex $argv 2]
63
+
64
+ puts "Revision : [state one { SELECT rev FROM revision WHERE rid = $centralrid }] ($centralrid)"
65
+
66
+ # Map it to the file containing the revision of interest.
67
+ set fid [state one { SELECT fid FROM revision WHERE rid = $centralrid }]
68
+ }
69
+ fid {
70
+ # Get the file of interest, identified by internal numeric id
71
+ # used by cvs2fossil.
72
+ set fid [lindex $argv 2]
73
+ }
74
+ fname {
75
+ # Get the file of interest, identified by its name.
76
+
77
+ set fname [lindex $argv 2]
78
+ set fid [state one { SELECT fid FROM file WHERE name == $fname }]
79
+ }
80
+ default {
81
+ trouble fatal \
82
+ "Unknown spec \"$what\", expected one of \"fid\", \"fname\", or \"rid\""
83
+ }
84
+}
85
+trouble abort?
86
+
87
+set pid [state one { SELECT pid FROM file WHERE fid == $fid }]
88
+
89
+puts "File : [state one { SELECT name FROM file WHERE fid = $fid }] ($fid)"
90
+puts "Project : [state one { SELECT name FROM project WHERE pid = $pid }] ($pid)"
91
+
92
+# Get the data of all revisions in the file of interest, as a list for
93
+# iteration, and as array for random access of neighbouring revisions.
94
+
95
+array set rev {}
96
+foreach {rid revnr lod date isdefault} [set revisions [state run {
97
+ SELECT R.rid, R.rev, S.name, R.date, R.isdefault
98
+ FROM revision R, symbol S
99
+ WHERE R.fid = $fid
100
+ AND R.lod = S.sid
101
+}]] {
102
+ set cs [state run {
103
+ SELECT CR. -*- \
104
+exec tclsh "$0" ${1+"$@"}
105
+#!/bin/sh
106
+## -*- tcl -*- \
107
+execdotequire struct::list misc::*list ops.
108
+package require vc::fossil::import::cvs::project::rev ; # Changesets
109
+package require vc::fossil::import::cvs::state ; # State storage.
110
+package require vc::tools::misc ; # Min/max.
111
+package rrevisionevisions it contains.
112
+
113
+rtate reading project
114
+state reading file
115
+state reading revision
116
+state reading revisionbranchchildren
117
+state reading changeset
118
+state reading csitem
119
+state reading csorder
120
+
121
+set what [lindex $argv 1]
122
+set centralrid -1
123
+
124
+switch -exact -- $what {
125
+ rid {
126
+ # Get the revision of interest, identified by the internal
127
+ # numeric id used by cvs2fossil.
128
+ set centralrid [lindex $argv 2]
129
+
130
+ puts "Revision : [state one { SELECT rev FROM revision WHERE rid = $centralrid }] ($centralrid)"
131
+
132
+ # Map it to the file containing the revision of interest.
133
+ set fid [state one { SELECT fid FROM revision WHERE rid = $centralrid }]
134
+ }
135
+ fid {
136
+ # Get the file of interest, identified by internal numeric id
137
+ # used by cvs2fossil.
138
+ set fid [lindex $argv 2]
139
+ }
140
+ fname {
141
+ # Get the file of interest, identified by its name.
142
+
143
+ set fname [lindex $argv 2]
144
+ set fid [state one { SELECT fid FROM file WHERE name == $fname }]
145
+ }
146
+ default {
147
+ trouble fatal \
148
+ "Unknown spec \"$what\"he
149
+## layouting.
150
+
151
+# # ## ### ##### ######## ############# #####################
152
+## Requirements, extended package management for local packages.
153
+
154
+lappend auto_path [file join [file dirname [info script]] lib]
155
+
156
+package require Tcl 8.4 ; # Required runtime.
157
+package require struct::graph ; # Graph handling.
158
+package require struct::list ; # Hi
--- a/tools/cvs2fossil/filerevtree
+++ b/tools/cvs2fossil/filerevtree
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/tools/cvs2fossil/filerevtree
+++ b/tools/cvs2fossil/filerevtree
@@ -0,0 +1,158 @@
1 #!/bin/sh
2 ## -*- tcl -*- \
3 exec tclsh "$0" ${1+"$@"}
4
5 # # ## ### ##### ######## ############# #####################
6 ## Copyright (c) 2007 Andreas Kupries.
7 #
8 # This software is licensed as described in the file LICENSE, which
9 # you should have received as part of this distribution.
10 #
11 # This software consists of voluntary contributions made by many
12 # individuals. For exact contribution history, see the revision
13 # history and logs, available at http://fossil-scm.hwaci.com/fossil
14 # # ## ### ##### ######## ############# #####################
15
16 ## Helper application, debugging of cvs2fossil. This application
17 ## extracts the tree of revisions for a file of inte#!/bin/sh
18 ## -*- tcl -*#!/bin/sh
19 ## -*- tcl -*- \
20 exec tclsh "$0" ${1+"$@"}
21
22 # # ## ### ##### ######## ############# #####################
23 ## Copyright (c) 2007 Andreas Kupries.
24 #
25 # This software is licensed as described in the file LICENSE, which
26 # you should have received as part of this distribution.
27 #
28 # This software consists of voluntary contributions made by many
29 # individuals. For exact contribution history, see the revision
30 # history and logs, available at http://fossil-scm.hwaci.com/fossil
31 # # ## ### ##### ######## ############# #####################
32
33 ## Helper application, debugging of cvs2fossil. This application
34 ## extracts the tree of revisions for a file of interest, specified
35 ## either directly through its id, or indirectly through the id of a
36 ## revision it contains, and generates a nice graphical representation
37 ## of it (png image). It uses GraphiViz's 'dot' tool to do all the
38 ## layouting.
39
40 # # ## ### ##### ######## equire struct::list -*- \
41 exec tclsh "$0#!/brequire struct::list ; # Higher order list ops.
42 package require vc::fossil::import::cvs::project::rev ; # Changesets
43 package require vc::fossil::import::cvs::state ; # State storage.
44 package require vc::tools::misc ; # Min/max.
45 package rrevisionevisions it contains.
46
47 rtate reading project
48 state reading file
49 state reading revision
50 state reading revisionbranchchildren
51 state reading changeset
52 state reading csitem
53 state reading csorder
54
55 set what [lindex $argv 1]
56 set centralrid -1
57
58 switch -exact -- $what {
59 rid {
60 # Get the revision of interest, identified by the internal
61 # numeric id used by cvs2fossil.
62 set centralrid [lindex $argv 2]
63
64 puts "Revision : [state one { SELECT rev FROM revision WHERE rid = $centralrid }] ($centralrid)"
65
66 # Map it to the file containing the revision of interest.
67 set fid [state one { SELECT fid FROM revision WHERE rid = $centralrid }]
68 }
69 fid {
70 # Get the file of interest, identified by internal numeric id
71 # used by cvs2fossil.
72 set fid [lindex $argv 2]
73 }
74 fname {
75 # Get the file of interest, identified by its name.
76
77 set fname [lindex $argv 2]
78 set fid [state one { SELECT fid FROM file WHERE name == $fname }]
79 }
80 default {
81 trouble fatal \
82 "Unknown spec \"$what\", expected one of \"fid\", \"fname\", or \"rid\""
83 }
84 }
85 trouble abort?
86
87 set pid [state one { SELECT pid FROM file WHERE fid == $fid }]
88
89 puts "File : [state one { SELECT name FROM file WHERE fid = $fid }] ($fid)"
90 puts "Project : [state one { SELECT name FROM project WHERE pid = $pid }] ($pid)"
91
92 # Get the data of all revisions in the file of interest, as a list for
93 # iteration, and as array for random access of neighbouring revisions.
94
95 array set rev {}
96 foreach {rid revnr lod date isdefault} [set revisions [state run {
97 SELECT R.rid, R.rev, S.name, R.date, R.isdefault
98 FROM revision R, symbol S
99 WHERE R.fid = $fid
100 AND R.lod = S.sid
101 }]] {
102 set cs [state run {
103 SELECT CR. -*- \
104 exec tclsh "$0" ${1+"$@"}
105 #!/bin/sh
106 ## -*- tcl -*- \
107 execdotequire struct::list misc::*list ops.
108 package require vc::fossil::import::cvs::project::rev ; # Changesets
109 package require vc::fossil::import::cvs::state ; # State storage.
110 package require vc::tools::misc ; # Min/max.
111 package rrevisionevisions it contains.
112
113 rtate reading project
114 state reading file
115 state reading revision
116 state reading revisionbranchchildren
117 state reading changeset
118 state reading csitem
119 state reading csorder
120
121 set what [lindex $argv 1]
122 set centralrid -1
123
124 switch -exact -- $what {
125 rid {
126 # Get the revision of interest, identified by the internal
127 # numeric id used by cvs2fossil.
128 set centralrid [lindex $argv 2]
129
130 puts "Revision : [state one { SELECT rev FROM revision WHERE rid = $centralrid }] ($centralrid)"
131
132 # Map it to the file containing the revision of interest.
133 set fid [state one { SELECT fid FROM revision WHERE rid = $centralrid }]
134 }
135 fid {
136 # Get the file of interest, identified by internal numeric id
137 # used by cvs2fossil.
138 set fid [lindex $argv 2]
139 }
140 fname {
141 # Get the file of interest, identified by its name.
142
143 set fname [lindex $argv 2]
144 set fid [state one { SELECT fid FROM file WHERE name == $fname }]
145 }
146 default {
147 trouble fatal \
148 "Unknown spec \"$what\"he
149 ## layouting.
150
151 # # ## ### ##### ######## ############# #####################
152 ## Requirements, extended package management for local packages.
153
154 lappend auto_path [file join [file dirname [info script]] lib]
155
156 package require Tcl 8.4 ; # Required runtime.
157 package require struct::graph ; # Graph handling.
158 package require struct::list ; # Hi
--- a/tools/cvs2fossil/showg
+++ b/tools/cvs2fossil/showg
@@ -0,0 +1,6 @@
1
+#!/bin/sh
2
+
3
+dot -Tpng -o $$.png $1
4
+display $$.png
5
+rm $$.png
6
+exit
--- a/tools/cvs2fossil/showg
+++ b/tools/cvs2fossil/showg
@@ -0,0 +1,6 @@
 
 
 
 
 
 
--- a/tools/cvs2fossil/showg
+++ b/tools/cvs2fossil/showg
@@ -0,0 +1,6 @@
1 #!/bin/sh
2
3 dot -Tpng -o $$.png $1
4 display $$.png
5 rm $$.png
6 exit

Keyboard Shortcuts

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