Eskil

Check-in [8303f3458f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use fossil ls to polish the result from fileage
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8303f3458f6613f7dceeb574c4c2eafa1af2ea7b
User & Date: peter 2015-02-26 00:23:53.873
Context
2015-02-26
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
2015-02-25
23:50
Postpone fossil whatis call until needed. check-in: 12cbadae02 user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vcsvfs.tcl.
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
                set unit [lindex $col1 1]
                switch -glob $unit {
                    second* {
                        set value [expr {int($value)}]
                        set unit second
                    }
                    minute* {


                        set value [expr {int($value*60)}]
                        set unit second
                    }
                    hour* {
                        set value [expr {int($value*60*60)}]
                        set unit second
                    }
                    day* {
                        set value [expr {int($value*60*60*24)}]
                        set unit second
                    }
                    year* {

                        set value [expr {int($value*60*60*24*365)}]
                        set unit second
                    }
                    default {
                        puts "Unhandled unit: $unit in '$col1'"
                        set value [expr {int($value)}]
                    }
                }







>
>
|



|



|



>
|







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
                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)}]
                    }
                }
153
154
155
156
157
158
159


















160
161
162
163
164
165
166
                    dict set finfo $fName mtime $fTime
                }
            }
        }
        # Kill surrounding while loop
        break
    }



















    cd $oldpwd

    # Generate a mount point.
    set tail [string range $dir [string length $root] end]
    set mountpoint "${root} ($rev)"








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
185
186
187
                    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.
    set tail [string range $dir [string length $root] end]
    set mountpoint "${root} ($rev)"

582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
                if {![dict exists $finfor size]} {
                    set size [vcsvfs::${vcstype}::size $finfor]
                    dict set finfor "size" $size
                    # Cache in main dictionary too
                    dict set mpoints $root "finfo" $relative "size" $size
                }
                dict set res "mtime" [dict get $finfor "mtime"]
                dict set res size  [dict get $finfor size]
            }
            return $res
        }
        createdirectory - deletefile - removedirectory - utime {
            # Read-only, always error
        }
    }







|







603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
                if {![dict exists $finfor size]} {
                    set size [vcsvfs::${vcstype}::size $finfor]
                    dict set finfor "size" $size
                    # Cache in main dictionary too
                    dict set mpoints $root "finfo" $relative "size" $size
                }
                dict set res "mtime" [dict get $finfor "mtime"]
                dict set res "size"  [dict get $finfor "size"]
            }
            return $res
        }
        createdirectory - deletefile - removedirectory - utime {
            # Read-only, always error
        }
    }