|
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 all information about a changeset and writes it nicely |
|
18
|
## formatted to stdout. The changeset is specified by its internal |
|
19
|
## numerical id. |
|
20
|
|
|
21
|
# # ## ### ##### ######## ############# ##################### |
|
22
|
## Requirements, extended package management for local packages. |
|
23
|
|
|
24
|
lappend auto_path [file join [file dirname [info script]] lib] |
|
25
|
|
|
26
|
package require Tcl 8.4 ; # Required runtime. |
|
27
|
package require struct::graph ; # Graph handling. |
|
28
|
package require struct::list ; # Higher order list ops. |
|
29
|
package require vc::fossil::import::cvs::project::rev ; # Changesets |
|
30
|
package require vc::fossil::import::cvs::state ; # State storage. |
|
31
|
package require vc::tools::misc ; # Min/max. |
|
32
|
|
|
33
|
namespace import ::vc::fossil::import::cvs::state |
|
34
|
namespace import ::vc::fossil::import::cvs::project::rev |
|
35
|
namespace import ::vc::tools::misc::* |
|
36
|
namespace import ::vc::tools::log |
|
37
|
log verbosity 0 |
|
38
|
|
|
39
|
# Process the command line, i.e. get the database to access, and file |
|
40
|
# of interest. The latter can be specified by name, id, or indirectly |
|
41
|
# through the id of one of the revisions it contains. |
|
42
|
|
|
43
|
state use [lindex $argv 0] |
|
44
|
state reading changeset |
|
45
|
state reading cstype |
|
46
|
state reading csrevision |
|
47
|
state reading project |
|
48
|
state reading revision |
|
49
|
state reading file |
|
50
|
state reading symbol |
|
51
|
state reading meta |
|
52
|
state reading author |
|
53
|
state reading cmessage |
|
54
|
|
|
55
|
set cid [lindex $argv 1] |
|
56
|
|
|
57
|
struct::list assign [state run { |
|
58
|
SELECT C.cid, C.pid, C.src, P.name, CT.name |
|
59
|
FROM changeset C, project P, cstype CT |
|
60
|
WHERE C.cid = $cid |
|
61
|
AND P.pid = C.pid |
|
62
|
AND CT.tid = C.type |
|
63
|
}] cid pid src pname tname |
|
64
|
|
|
65
|
puts "" |
|
66
|
puts "Changeset <$tname $cid> in project \"$pname\" ($pid)" |
|
67
|
|
|
68
|
if {$tname eq "sym"} { |
|
69
|
puts "Symbol \"[state run { |
|
70
|
SELECT name |
|
71
|
FROM symbol |
|
72
|
WHERE sid = $src |
|
73
|
}]\"" |
|
74
|
} else { |
|
75
|
struct::list assign [state run { |
|
76
|
SELECT P.name, S.name, A.name, L.text |
|
77
|
FROM meta M, project P, symbol S, author A, cmessage L |
|
78
|
WHERE M.mid = $src |
|
79
|
AND P.pid = M.pid |
|
80
|
AND S.sid = M.bid |
|
81
|
AND A.aid = M.aid |
|
82
|
AND L.cid = M.cid |
|
83
|
}] project lod author cmessage |
|
84
|
puts "Meta: Project = \"$project\"" |
|
85
|
puts "Meta: LOD = \"$lod\"" |
|
86
|
puts "Meta: Author = \"$author\"" |
|
87
|
puts "Meta: Log |[join [split $cmessage \n] "\"\nMeta: Log |"]" |
|
88
|
} |
|
89
|
|
|
90
|
array set rev {} |
|
91
|
foreach {rid date pos fname frev default} [state run { |
|
92
|
SELECT R.rid, R.date, C.pos, F.name, R.rev, R.isdefault |
|
93
|
FROM csrevision C, revision R, file F |
|
94
|
WHERE C.cid = $cid |
|
95
|
AND R.rid = C.rid |
|
96
|
AND F.fid = R.fid |
|
97
|
ORDER BY C.pos, R.date |
|
98
|
}] { |
|
99
|
set rev($rid) [list $pos $date $fname $frev $default] |
|
100
|
puts "File: [expr {$default?"D":" "}] [clock format $date] [format %3d $pos]/[format %6d $rid] ${frev}::$fname" |
|
101
|
} |
|
102
|
|
|
103
|
|
|
104
|
::vc::fossil::import::cvs::project::rev::PullPredecessorRevisions pdep [array names rev] |
|
105
|
::vc::fossil::import::cvs::project::rev::PullSuccessorRevisions sdep [array names rev] |
|
106
|
|
|
107
|
|
|
108
|
|
|
109
|
puts "" |
|
110
|
exit |
|
111
|
|
|
112
|
|
|
113
|
|
|
114
|
|
|
115
|
|
|
116
|
|
|
117
|
|
|
118
|
|
|
119
|
exit |
|
120
|
|