Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Error estimate in file age |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f86812b76624b288fa1261aa2f8cd2d5 |
User & Date: | peter 2015-02-26 01:17:43.685 |
Context
2015-02-26
| ||
01:19 | Error estimate in file age check-in: 38b105b675 user: peter tags: trunk | |
01:17 | Error estimate in file age check-in: f86812b766 user: peter tags: trunk | |
00:23 | Use fossil ls to polish the result from fileage check-in: 8303f3458f user: peter tags: trunk | |
Changes
Changes to src/vcsvfs.tcl.
︙ | ︙ | |||
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 137 138 139 140 141 142 | set col1 [string trim [lindex $cols 1]] set col2 [string trim [lindex $cols 3]] # First column is age, in readable format # e.g. "current" "36.4 minutes" "97.0 days" "1.06 years" if {$col1 eq ""} continue if {$col1 eq "current"} { set fTime $commitTime } else { set value [lindex $col1 0] set unit [lindex $col1 1] switch -glob $unit { second* { set value [expr {int($value)}] set unit second } minute* { # In general, try to underestimate the value. The web # page rounds to one decimal. set value [expr {int(($value-0.05)*60)}] set unit second } hour* { set value [expr {int(($value-0.05)*60*60)}] set unit second } day* { set value [expr {int(($value-0.05)*60*60*24)}] set unit second } year* { # Year has two decimals set value [expr {int(($value-0.005)*60*60*24*365)}] set unit second } default { puts "Unhandled unit: $unit in '$col1'" set value [expr {int($value)}] } } set fTime [expr {$commitTime - $value}] | > > > > > > > | 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 137 138 139 140 141 142 143 144 145 146 147 148 149 | set col1 [string trim [lindex $cols 1]] set col2 [string trim [lindex $cols 3]] # First column is age, in readable format # e.g. "current" "36.4 minutes" "97.0 days" "1.06 years" if {$col1 eq ""} continue if {$col1 eq "current"} { set fTime $commitTime set errX 0 } else { set value [lindex $col1 0] set unit [lindex $col1 1] set errX 0 switch -glob $unit { second* { set value [expr {int($value)}] set unit second set errX 0 } minute* { # In general, try to underestimate the value. The web # page rounds to one decimal. set value [expr {int(($value-0.05)*60)}] set unit second set errX 6 } hour* { set value [expr {int(($value-0.05)*60*60)}] set unit second set errX 360 } day* { set value [expr {int(($value-0.05)*60*60*24)}] set unit second set errX 8640 } year* { # Year has two decimals set value [expr {int(($value-0.005)*60*60*24*365)}] set unit second set errX [expr {6*60*24*365}] } default { puts "Unhandled unit: $unit in '$col1'" set value [expr {int($value)}] } } set fTime [expr {$commitTime - $value}] |
︙ | ︙ | |||
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | regsub -all {\n} $col2 "" col2 regsub -all {<br>} $col2 "\n" col2 set col2 [string trim $col2] foreach fName [split $col2 \n] { # Check that it matches something filled in from the artifact if {[dict exists $finfo $fName]} { dict set finfo $fName mtime $fTime } } } # Kill surrounding while loop break } # As another step, get current file stamps from fossil ls. # Since ls show current checkout they might not be valid for the rev # being looked at. However if they are still present and older than the # ones from fileage they are likely correct. set allfiles [exec fossil ls --age .] foreach line [split $allfiles \n] { # Expected format in a line: # 2012-08-21 20:38:19 tests/rev.test regexp {(\S+ \S+)\s+(.+)} $line -> fDate fName set mTime [clock scan $fDate -gmt 1] if {[dict exists $finfo $fName mtime]} { set x [dict get $finfo $fName mtime] if {$mTime < $x} { dict set finfo $fName mtime $mTime } } } cd $oldpwd # Generate a mount point. | > > > > > > | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | regsub -all {\n} $col2 "" col2 regsub -all {<br>} $col2 "\n" col2 set col2 [string trim $col2] foreach fName [split $col2 \n] { # Check that it matches something filled in from the artifact if {[dict exists $finfo $fName]} { dict set finfo $fName mtime $fTime dict set finfo $fName errX $errX } } } # Kill surrounding while loop break } # As another step, get current file stamps from fossil ls. # Since ls show current checkout they might not be valid for the rev # being looked at. However if they are still present and older than the # ones from fileage they are likely correct. # Also, fileage and ls uses different criteria for which commit defines # the age (across merges), so things basically will be a best effort guess. set allfiles [exec fossil ls --age .] foreach line [split $allfiles \n] { # Expected format in a line: # 2012-08-21 20:38:19 tests/rev.test regexp {(\S+ \S+)\s+(.+)} $line -> fDate fName set mTime [clock scan $fDate -gmt 1] if {[dict exists $finfo $fName mtime]} { set x [dict get $finfo $fName mtime] set e [dict get $finfo $fName errX] if {$mTime < $x} { dict set finfo $fName mtime $mTime } elseif {abs($mTime - $x) < 3600} { #puts "$fName age $x ls $mTime diff [expr {$mTime - $x}] err $e" } } } cd $oldpwd # Generate a mount point. |
︙ | ︙ |