Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | minor tidy up: avoid redundant sub-pattern captures in `regsub'. |
|---|---|
| Timelines: | family | ancestors | descendants | both | dresden |
| Files: | files | file ages | folders |
| SHA1: |
5a2358d8c3b635cb4381134e79217fa0 |
| User & Date: | j 2019-07-21 15:42:11 |
Context
|
2019-07-21
| ||
| 16:05 | regression fix in `clone' interceptor. check-in: 24053a7df2 user: j tags: dresden | |
| 15:42 | minor tidy up: avoid redundant sub-pattern captures in `regsub'. check-in: 5a2358d8c3 user: j tags: dresden | |
| 12:27 | merged `grep'. check-in: 8df6e8d8f7 user: j tags: dresden | |
Changes
Changes to fsl.
| ︙ | ︙ | |||
152 153 154 155 156 157 158 |
REMOVE { coloured blue $line }
UNDO { coloured blue $line }
REDO { coloured red $line }
NEW { coloured magenta $line }
RENAMED { coloured green $line }
^(checkout|parent|merged-(from|into)): {
set date_rx {([a-f\d]{40} )(\d{4}-\d{2}-\d{2})}
| | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
REMOVE { coloured blue $line }
UNDO { coloured blue $line }
REDO { coloured red $line }
NEW { coloured magenta $line }
RENAMED { coloured green $line }
^(checkout|parent|merged-(from|into)): {
set date_rx {([a-f\d]{40} )(\d{4}-\d{2}-\d{2})}
set artifact_rx {[a-f\d]{4}}
regsub $date_rx $line \\1[coloured blue \\2] line
regsub $artifact_rx $line [coloured red &]
}
tags: {
regsub {(^tags:[ ]+)(.*)} $line [coloured yellow \\1][coloured cyan \\2]
}
comment: {
append colorized "[coloured blue \\1\\2]\\3"
append colorized "[coloured yellow \\4]"
|
| ︙ | ︙ | |||
188 189 190 191 192 193 194 |
# since most of the work is relocated to `reformTimeline'
# the regex/regsubs below could be tidied up, accordingly...
#
# Expressions to match:
set revnum_rx {(\]:)(\d+)}
set artifact_rx {\[([a-f\d]{4})([a-f\d]{6}\]*)\]}
set date_rx {(^|\n|([ ]*\(\d+\) ))((=== )?\d{4}-\d\d-\d\d( ===)?)}
| | | | | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# since most of the work is relocated to `reformTimeline'
# the regex/regsubs below could be tidied up, accordingly...
#
# Expressions to match:
set revnum_rx {(\]:)(\d+)}
set artifact_rx {\[([a-f\d]{4})([a-f\d]{6}\]*)\]}
set date_rx {(^|\n|([ ]*\(\d+\) ))((=== )?\d{4}-\d\d-\d\d( ===)?)}
set time_rx {\d\d:\d\d:\d\d (UTC)?}
set current_rx {\*CURRENT\*}
set frkmrg_rx {\*(FORK|MERGE|BRANCH)\*}
# Colour the output (repeated substitutions on $line):
set line [regsub $date_rx $line \\2[coloured blue \\3\\6]]
set line [regsub $time_rx $line [coloured yellow &]]
set line [regsub $revnum_rx $line \\1[coloured magenta \\2]]
set line [regsub $artifact_rx $line [format {[%s%s]} [coloured red {\1}] {\2}]]
set line [regsub $current_rx $line [display reversed &]]
set line [regsub $frkmrg_rx $line [display underscored &]]
set line [regsub {(user: )([A-Za-z][-_.A-Za-z0-9]*)} $line [coloured yellow \\1][coloured green \\2]]
set line [regsub {((tags|branch):)(( [A-Za-z][-_,.A-Za-z0-9 ]*)|(\n))} $line [coloured yellow \\1][coloured cyan \\4\\5]]
regsub {(artifact: )} $line [coloured yellow &]
}
# Filter only on aliases of `diff' but not the original command so that
# the latter's output can be redirected to create patch files.
filter diff {d di} {
switch -regexp $line {
{^-} { coloured red $line }
|
| ︙ | ︙ | |||
600 601 602 603 604 605 606 |
set line [join [lrange $field 2 end]]
set cihash [dict get $cihashes $fhash]
set revnum {}
foreach hash $cihash {
append revnum [dict get $revnums $hash] " "
}
set revnum [join $revnum ,]
| | | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
set line [join [lrange $field 2 end]]
set cihash [dict get $cihashes $fhash]
set revnum {}
foreach hash $cihash {
append revnum [dict get $revnums $hash] " "
}
set revnum [join $revnum ,]
regsub -all "$greppat" $line [coloured redbold &] line
# for now, we just preprend the chronological revision numbers
# and add a bit of colour
if {[lindex $revnum end] != $lastrev} { set idx [expr {1 - $idx}] }
set col [lindex $checkincols $idx]
set buf [coloured magenta $revnum]:[coloured $col $fhash]
if {[llength $field] > 1} {
append buf :[coloured cyan $lino]:$line
|
| ︙ | ︙ | |||
649 650 651 652 653 654 655 |
}
set size [exec stty size]
set cols [lindex $size end]
set need [expr [string length $numrev] + $more]
set width [expr $cols - $need]
| | | 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 |
}
set size [exec stty size]
set cols [lindex $size end]
set need [expr [string length $numrev] + $more]
set width [expr $cols - $need]
regsub {timeline|finfo|search|descendants} $params "& -W $width" params
# we need do undo the -W insertion in case we are dealing with
# `finfo -p'
regsub {(finfo)( -W .*)( -p)(.*)} $params "\\1\\3\\4" params
}
return $params
}
|
| ︙ | ︙ | |||
1027 1028 1029 1030 1031 1032 1033 |
dict set num2hash $val $sha1
}
if {[dict exists $num2hash $version]} {
set version [dict get $num2hash $version]
set args [lreplace $args 0 0 $version]
}
}
| | | 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 |
dict set num2hash $val $sha1
}
if {[dict exists $num2hash $version]} {
set version [dict get $num2hash $version]
set args [lreplace $args 0 0 $version]
}
}
set params "$cmd --setmtime $opts$args"
return $params
}
interceptor am:amend {
# ----------------------------------------------------------------------------
# The provided UUID is tentatively interpreted as a chronological
# revision number for which a lookup of the corresponding SHA1 hash is tried.
|
| ︙ | ︙ |