Eskil

Diff
Login

Differences From Artifact [7b79db5d3b]:

To Artifact [19c3963370]:


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
                dict set finfo $parentStr type directory
                set parentStr [file join $parentStr $dirPath]
            }
        }
    }
    # Try to use "fossil ls -r, available in newer versions"
    set doneCollecting 0
    if {![catch {exec fossil ls -r $rev -v} lsdata]} {
        set lsdata [string trim $lsdata \n]
        foreach line [split $lsdata \n] {
            # Expected format in a line:
            # 2012-08-21 20:38:19  4563  tests/rev.test
            regexp {(\S+ \S+)\s+(\d+)\s+(.+)} $line -> fDate fSize fName
            dict set finfo $fName mtimestr $fDate
            dict set finfo $fName size $fSize
        }
        set doneCollecting 1
    }

    # Getting files via http fileage to aquire file times
    # Since dates are parsed from the age string they are rather imprecise
    # Use a while around it to be able to break free easily (faking goto)
    while {!$doneCollecting} {
        set html [exec fossil http << "GET /fileage?name=$rev"]
        if {![regexp {Files in.*} $html html]} {
            # Not the expected format of response, skip
            break
        }
        if {![regexp {\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}} $html cTime2]} {
            # Not the expected format of response, skip
            break
        }
        # This is currently unused since we do not trust the formatted time in
        # the web page. The time stamp from the artifact is used later.
        set commitTime2 [clock scan $cTime2 -gmt 1]
        #puts "CT $commitTime  CT2 $commitTime2"







|














|

|



|







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
                dict set finfo $parentStr type directory
                set parentStr [file join $parentStr $dirPath]
            }
        }
    }
    # Try to use "fossil ls -r, available in newer versions"
    set doneCollecting 0
    if { ! [catch {exec fossil ls -r $rev -v} lsdata]} {
        set lsdata [string trim $lsdata \n]
        foreach line [split $lsdata \n] {
            # Expected format in a line:
            # 2012-08-21 20:38:19  4563  tests/rev.test
            regexp {(\S+ \S+)\s+(\d+)\s+(.+)} $line -> fDate fSize fName
            dict set finfo $fName mtimestr $fDate
            dict set finfo $fName size $fSize
        }
        set doneCollecting 1
    }

    # Getting files via http fileage to aquire file times
    # Since dates are parsed from the age string they are rather imprecise
    # Use a while around it to be able to break free easily (faking goto)
    while { ! $doneCollecting} {
        set html [exec fossil http << "GET /fileage?name=$rev"]
        if { ! [regexp {Files in.*} $html html]} {
            # Not the expected format of response, skip
            break
        }
        if { ! [regexp {\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}} $html cTime2]} {
            # Not the expected format of response, skip
            break
        }
        # This is currently unused since we do not trust the formatted time in
        # the web page. The time stamp from the artifact is used later.
        set commitTime2 [clock scan $cTime2 -gmt 1]
        #puts "CT $commitTime  CT2 $commitTime2"
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212

    # 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.
    if {!$doneCollecting} {
        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]} {







|







198
199
200
201
202
203
204
205
206
207
208
209
210
211
212

    # 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.
    if { ! $doneCollecting} {
        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]} {
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
    set oldpwd [pwd]
    cd $dir

    # The mount point will normally be at the wc root, even if
    # a sub directory was given.
    # Locate root for the given directory.
    set info [exec svn info]
    if {![regexp -line {Working Copy Root Path:\s*(\S.*)} $info -> root]} {
        # Fallback to given dir
        set root .
    }
    # TBD: Always root at given dir, for speed
    set root .
    set root [file normalize $root]
    cd $root







|







261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
    set oldpwd [pwd]
    cd $dir

    # The mount point will normally be at the wc root, even if
    # a sub directory was given.
    # Locate root for the given directory.
    set info [exec svn info]
    if { ! [regexp -line {Working Copy Root Path:\s*(\S.*)} $info -> root]} {
        # Fallback to given dir
        set root .
    }
    # TBD: Always root at given dir, for speed
    set root .
    set root [file normalize $root]
    cd $root
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
        }
    }
    # TBD: Any way to get file sizes and mtimes from HG?

    # Try using the hglist extension
    set cmd [list hg ls --template "{size} {date} {name}\n" -a \
                     --recursive -r $rev]
    if {![catch {exec {*}$cmd} allfiles]} {
        # Expected line format:
        # size date name
        foreach line [split $allfiles \n] {
            if {[regexp {^(\d+)\s+(\d+)\S*\s+(\S.*)$} $line -> size mtime fName]} {
                # Check that it matches something filled in from the manifest
                if {[dict exists $finfo $fName]} {
                    dict set finfo $fName "mtime" $mtime







|







392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
        }
    }
    # TBD: Any way to get file sizes and mtimes from HG?

    # Try using the hglist extension
    set cmd [list hg ls --template "{size} {date} {name}\n" -a \
                     --recursive -r $rev]
    if { ! [catch {exec {*}$cmd} allfiles]} {
        # Expected line format:
        # size date name
        foreach line [split $allfiles \n] {
            if {[regexp {^(\d+)\s+(\d+)\S*\s+(\S.*)$} $line -> size mtime fName]} {
                # Check that it matches something filled in from the manifest
                if {[dict exists $finfo $fName]} {
                    dict set finfo $fName "mtime" $mtime
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
    if {[dict exists $finfo $relative child]} {
        set childD [dict get $finfo $relative child]
    } else {
        # Empty dir
        return {}
    }
    foreach child [dict keys $childD] {
        if {![string match $pattern $child]} continue
        set local [file join $relative $child]
        if {[dict get $finfo $local isfile] && !$allowFile} continue
        if {[dict get $finfo $local isdir] && !$allowDir} continue
        lappend result [file join $actual $child]
    }
    return $result
}







|







570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
    if {[dict exists $finfo $relative child]} {
        set childD [dict get $finfo $relative child]
    } else {
        # Empty dir
        return {}
    }
    foreach child [dict keys $childD] {
        if { ! [string match $pattern $child]} continue
        set local [file join $relative $child]
        if {[dict get $finfo $local isfile] && !$allowFile} continue
        if {[dict get $finfo $local isdir] && !$allowDir} continue
        lappend result [file join $actual $child]
    }
    return $result
}
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
    #puts " Ar $args"

    set rootD [dict get $mpoints $root]
    set origroot [dict get $rootD origroot]
    set finfo [dict get $rootD finfo]
    set vcstype [dict get $rootD vcstype]

    if {![dict exists $finfo $relative]} {
        # Unknown path
        vfs::filesystem posixerror $::vfs::posix(EACCES)
        return -code error $::vfs::posix(EACCES)
    }
    set finfor [dict get $finfo $relative]
    #puts " $finfor"








|







679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
    #puts " Ar $args"

    set rootD [dict get $mpoints $root]
    set origroot [dict get $rootD origroot]
    set finfo [dict get $rootD finfo]
    set vcstype [dict get $rootD vcstype]

    if { ! [dict exists $finfo $relative]} {
        # Unknown path
        vfs::filesystem posixerror $::vfs::posix(EACCES)
        return -code error $::vfs::posix(EACCES)
    }
    set finfor [dict get $finfo $relative]
    #puts " $finfor"

723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
        }
        stat {
            set res [dict create dev 0 ino 0 "mode" 0 nlink 0 uid 0 gid 0 \
                             size 0 atime 0 mtime 0 ctime 0 type file]
            dict set res type [dict get $finfor type]
            if {[dict get $finfor isfile]} {
                # Fill in any postponed info
                if {![dict exists $finfor mtime]} {
                    set mtime [vcsvfs::${vcstype}::mTime $finfor]
                    dict set finfor "mtime" $mtime
                    # Cache in main dictionary too
                    dict set mpoints $root "finfo" $relative "mtime" $mtime
                }
                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"]







|





|







723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
        }
        stat {
            set res [dict create dev 0 ino 0 "mode" 0 nlink 0 uid 0 gid 0 \
                             size 0 atime 0 mtime 0 ctime 0 type file]
            dict set res type [dict get $finfor type]
            if {[dict get $finfor isfile]} {
                # Fill in any postponed info
                if { ! [dict exists $finfor mtime]} {
                    set mtime [vcsvfs::${vcstype}::mTime $finfor]
                    dict set finfor "mtime" $mtime
                    # Cache in main dictionary too
                    dict set mpoints $root "finfo" $relative "mtime" $mtime
                }
                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"]