Eskil

Check-in [84e4b8cf0e]
Login

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

Overview
Comment:Read all from a pipe before closing.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 84e4b8cf0e17c0f9328c019dda8e4e97fae5f343
User & Date: peter 2014-11-17 17:01:03.027
Context
2014-11-17
20:17
Adapt test to code change check-in: 2add1c9b29 user: peter tags: trunk
17:01
Read all from a pipe before closing. check-in: 84e4b8cf0e user: peter tags: trunk
16:59
Avoid duplicated .-files in dirdiff check-in: bd1e62dc68 user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vcsvfs.tcl.
230
231
232
233
234
235
236






237
238
239
240
241
242
243
        incr t
    }
    set DataRefChan($t,data) $data
    set DataRefChan($t,ptr) 0
    set chId [chan create r [list vcsvfs::DataRefChan $t]]
    return $chId
}







# Helper for glob matching in directory
proc vcsvfs::MatchInDirectory {finfo relative actual args} {
    set pattern [lindex $args 0]
    set types [lindex $args 1]
    set allowFile 0
    set allowDir 0







>
>
>
>
>
>







230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
        incr t
    }
    set DataRefChan($t,data) $data
    set DataRefChan($t,ptr) 0
    set chId [chan create r [list vcsvfs::DataRefChan $t]]
    return $chId
}

# This is used before closing a pipe from a command.
# It should read all data to avoid errors from the command.
proc vcsvfs::ReadAllBeforeClose {chId} {
    read $chId
}

# Helper for glob matching in directory
proc vcsvfs::MatchInDirectory {finfo relative actual args} {
    set pattern [lindex $args 0]
    set types [lindex $args 1]
    set allowFile 0
    set allowDir 0
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
            # Read through a pipe to get a binary channel
            set chId [open [list |fossil cat $relative -r $rev] rb]
            #set data [read $chId]
            #close $chId
            #cd $oldpwd

            #set chId [vcsvfs::CreateDataRefChan $data]
            return [list $chId ""]
        }
        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]
            if {[dict get $finfor isdir]} {
                # TBD, fake mtime etc. for directory?
                dict set res type directory







|







327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
            # Read through a pipe to get a binary channel
            set chId [open [list |fossil cat $relative -r $rev] rb]
            #set data [read $chId]
            #close $chId
            #cd $oldpwd

            #set chId [vcsvfs::CreateDataRefChan $data]
            return [list $chId [list vcsvfs::ReadAllBeforeClose $chId]]
        }
        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]
            if {[dict get $finfor isdir]} {
                # TBD, fake mtime etc. for directory?
                dict set res type directory
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
            # Read through a pipe to get a binary channel
            set chId [open [list |svn cat -r $rev $relative] rb]
            #set data [read $chId]
            #close $chId
            #cd $oldpwd

            #set chId [vcsvfs::CreateDataRefChan $data]
            return [list $chId ""]
        }
        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]
            if {[dict get $finfor isdir]} {
                # TBD, fake mtime etc. for directory?
                dict set res type directory







|







416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
            # Read through a pipe to get a binary channel
            set chId [open [list |svn cat -r $rev $relative] rb]
            #set data [read $chId]
            #close $chId
            #cd $oldpwd

            #set chId [vcsvfs::CreateDataRefChan $data]
            return [list $chId [list vcsvfs::ReadAllBeforeClose $chId]]
        }
        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]
            if {[dict get $finfor isdir]} {
                # TBD, fake mtime etc. for directory?
                dict set res type directory