Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Started on dirdif plugin |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7c0936457ca06288e907bf4b5a74429c |
User & Date: | peter 2014-11-09 22:29:21.382 |
Context
2014-11-12
| ||
21:24 | Added vcsvfs check-in: 199c039bea user: peter tags: trunk | |
2014-11-09
| ||
22:29 | Started on dirdif plugin check-in: 7c0936457c user: peter tags: trunk | |
2014-11-07
| ||
21:41 | Generalised plugin reader a bit. check-in: 27715e3307 user: peter tags: trunk | |
Changes
Added plugins/keyword.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | ##Eskil Plugin : Ignore $Keywords$ # Example file for a plugin. # A plugin must start exactly like this one. # The text after : is the summary you can get at the command line # This plugin ignores keywords like $Revision$, both in file diff # and in directory diff # A plugin must define this procedure to do the job. # side: left or right # chi: An input channel for reading the original file. # cho: An output channel for writing the processed file. proc PreProcess {side chi cho} { while {1} { # Read data in large chunks for speed set data [read $chi 100000] if {$data eq ""} break # Replace keywords with nothing # Use line mode to be sure not to affect newlines regsub -all -line {\$\w+:[^\$]*\$} $data {} data puts -nonewline $cho $data } # Signal that the file after processing should be used only for # comparison, not for displaying. # The processed file must match the original line-wise. return 0 } # To be used in directory diff, a plugin must define this procedure. # ch1: An input channel for reading the first file. # ch2: An input channel for reading the second file. # info1: A dictionary with info about the first file. # info2: A dictionary with info about the second file. proc FileCompare {ch1 ch2 info1 info2} { set bufsz 65536 # Assume that all keywords are in the first block set f1 [read $ch1 $bufsz] set f2 [read $ch2 $bufsz] regsub -all {\$\w+:[^\$]*\$} $f1 {} f1 regsub -all {\$\w+:[^\$]*\$} $f2 {} f2 # Compensate for any change in length if {[string length $f1] < [string length $f2]} { append f1 [read $ch1 [expr {[string length $f2] - [string length $f1]}]] } if {[string length $f2] < [string length $f1]} { append f2 [read $ch2 [expr {[string length $f1] - [string length $f2]}]] } if {![string equal $f1 $f2]} { # Returning 0 signals "not equal" return 0 } # Return 1 means "equal" # Return 2 means "equal this far", and lets normal compare take over return 2 } |