/usr/share/tcltk/tcllib1.14/doctools/cvs.tcl is in tcllib 1.14-dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | # cvs.tcl --
#
# Handling of various cvs output formats.
#
# Copyright (c) 2003-2008 Andreas Kupries <andreas_kupries@sourceforge.net>
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: cvs.tcl,v 1.10 2008/07/08 23:03:58 andreas_kupries Exp $
package require Tcl 8.2
package require textutil
namespace eval ::doctools {}
namespace eval ::doctools::cvs {
namespace export scanLog toChangeLog
}
# ::doctools::cvs::scanLog --
#
# Scan a log generated by 'cvs log' and extract the relevant information.
#
# Arguments:
# text The text to scan
#
# Results:
# None.
#
# Sideeffects:
# None.
#
# Notes:
# Original location of code: http://wiki.tcl.tk/3638
# aka http://wiki.tcl.tk/log2changelog
# Original author unknown.
# Bugfix by TR / Torsten Reincke
proc ::doctools::cvs::scanLog {text evar cvar fvar} {
set text [split $text \n]
set n [llength $text]
upvar 1 $evar entries ; #set entries [list]
upvar 1 $cvar comments ; #array set comments {}
upvar 1 $fvar files ; #array set files {}
for {set i 0} {$i < $n} {incr i} {
set line [lindex $text $i]
switch -glob -- $line {
"*Working file:*" {
regexp {Working file: (.*)} $line -> filename
}
"date:*" {
scan $line "date: %s %s author: %s" date time author
set author [string trim $author ";"]
# read the comment lines following date
set comment ""
incr i
set line [lindex $text $i]
# [TR]: use regexp here to see if log ends:
while {(![regexp "(-----*)|(=====*)" $line]) && ($i < $n)} {
append comment $line "\n"
incr i
set line [lindex $text $i]
}
# Store this date/author/comment
lappend entries [list $date $author]
lappend comments($date,$author) $comment
lappend files($date,$author,$comment) $filename
}
}
}
return
}
# ::doctools::cvs::toChangeLog --
# Convert a preprocessed cvs log (see scanLog) into a Changelog
# suitable for emacs.
#
# Arguments:
# evar, cvar, fvar: Name of the variables containing the preprocessed log.
#
# Results:
# A string containing a properly formatted ChangeLog.
#
# Sideeffects:
# None.
#
# Notes:
# Original location of code: http://wiki.tcl.tk/3638
# aka http://wiki.tcl.tk/log2changelog
# Original author unknown.
proc ::doctools::cvs::toChangeLog {evar cvar fvar} {
upvar 1 $evar entries $cvar comments $fvar files
set linebuffer [list]
foreach e [lsort -unique -decreasing $entries] {
# print the date/author
foreach {date author} $e {break}
lappend linebuffer "$date $author"
lappend linebuffer ""
# Find all the comments submitted this date/author
set clist [lsort -unique $comments($date,$author)]
foreach c $clist {
# Print all files for a given comment
foreach f [lsort -unique $files($date,$author,$c)] {
lappend linebuffer "\t* $f:"
}
# Format and print the comment
lappend linebuffer [textutil::indent [textutil::undent $c] "\t "]
lappend linebuffer ""
continue
}
}
return [join $linebuffer \n]
}
#------------------------------------
# Module initialization
package provide doctools::cvs 1
|