From 1fa0d8c0d35a38406ffecf4e49121abd44cea607 Mon Sep 17 00:00:00 2001 From: Steve Huntley Date: Sun, 10 Dec 2006 06:18:50 +0000 Subject: [PATCH] 2006-12-10 Steve Huntley * library/template/versionvfs.tcl: when time attribute is set, files created after set time are made invisible. --- ChangeLog | 5 +++++ library/template/fishvfs.tcl | 2 +- library/template/versionvfs.tcl | 11 +++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 633bd58..f61dea4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-12-10 Steve Huntley + + * library/template/versionvfs.tcl: when time attribute is set, + files created after set time are made invisible. + 2006-11-14 Jean-Claude Wippler * library/mkclvfs.tcl: removed, now part of the vlerq extension again diff --git a/library/template/fishvfs.tcl b/library/template/fishvfs.tcl index fd10b71..4680bbe 100644 --- a/library/template/fishvfs.tcl +++ b/library/template/fishvfs.tcl @@ -476,7 +476,7 @@ proc FileTransport {filename} { } -# end namespace ::vfs::template +# end namespace ::vfs::template::fish # Each transport procedure has its own namespace and Transport proc. diff --git a/library/template/versionvfs.tcl b/library/template/versionvfs.tcl index 6226581..9651256 100644 --- a/library/template/versionvfs.tcl +++ b/library/template/versionvfs.tcl @@ -5,7 +5,7 @@ versionvfs.tcl -- Written by Stephen Huntley (stephen.huntley@alum.mit.edu) License: Tcl license -Version 1.02 +Version 1.03 A versioning virtual filesystem. Requires the template vfs in templatevfs.tcl. @@ -150,7 +150,6 @@ proc file_attributes {file {attribute {}} args} { set latest [lindex [lindex [lsort [set allVersions [VersionsAll $path $relative]]] end] 0] set acquired [lindex [split [set fileName [VAcquireFile $path $root $relative]] \;] 1] if ![string first .&dir [file tail $fileName]] {::vfs::filesystem posixerror $::vfs::posix(ENOENT)} - # process vfs-specific attributes: if {($relative == {}) && ([string map {-keep 1 -project 1 -time 1} $attribute] == 1)} { set attribute [string range $attribute 1 end] @@ -171,11 +170,9 @@ proc file_attributes {file {attribute {}} args} { if {$args == {}} {return [file tail $fileName]} error "cannot set attribute \"-version_filename\" for file \"[file tail $relative]\": attribute is readonly" } - # check if current version is latest, if not disallow edit: if {($args != {}) && ($acquired != {}) && ($latest != $acquired)} {::vfs::filesystem posixerror $::vfs::posix(EPERM)} set returnValue [eval file attributes \$fileName $attribute $args] - # collect values for vfs-specific attributes: if {$attribute == {}} { append returnValue " [list -versions $allVersions]" @@ -473,6 +470,12 @@ proc VAcquireFile {path root relative {actualpath {}}} { set projectLength [llength $tags] if {($projectLength > 1) && !$projectMember} {return [file join $path $relative]} } + +# if time tag value is before creation date of chosen version, make file invisible: + if {[info exists ::vfs::template::version::time($root)] && ([lindex [split $fileName \;] 1] > "$::vfs::template::version::time($root)000")} { + return [file join $path $relative] + } + if ![string first .&dir [file tail $relative]] { set fileName [file join $path [file dirname $relative]] return [file normalize $fileName] -- 2.23.0