Fossil SCM

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