]> OCCT Git - occt-wok.git/commitdiff
No comments
authorcas <cas@opencascade.com>
Tue, 12 Dec 2000 18:19:30 +0000 (18:19 +0000)
committercas <cas@opencascade.com>
Tue, 12 Dec 2000 18:19:30 +0000 (18:19 +0000)
src/WOKTclLib/WOKVC.SCCS
src/WOKTclLib/WOKVC.tcl

index 79c8f2e26fe386d457e811235426df5f62adb48e..dec40e072f2f703f8e45584c450ad076f8e135ca 100755 (executable)
@@ -102,8 +102,8 @@ proc wokIntegre:BASE:GetFile { Sfile invrs {fileid stdout} } {
 #;>
 # retourne la liste des sfile dans une base
 #;<
-proc wokIntegre:BASE:List { fshop Bname vrs } {
-    set diradm [glob -nocomplain [wokIntegre:BASE:GetRootName $fshop]/${Bname}.?]
+proc wokIntegre:BASE:List { Bname vrs } {
+    set diradm [glob -nocomplain [wokIntegre:BASE:GetRootName]/${Bname}.?]
     if [file exists $diradm] {
        set l {}
        foreach Sfile [lsort [readdir $diradm]] {
@@ -118,7 +118,7 @@ proc wokIntegre:BASE:List { fshop Bname vrs } {
     }
 }
 #;>
-# Ecrit dans fileid la fin d'un envoi. Permet a BASE:Execute de retourner un status
+# Writes on fileid a pattern that indicates the wintegre.cmd command completion.
 #;<
 proc wokIntegre:BASE:EOF { {fileid stdout} } {
     puts $fileid "echo Successfull completion"
@@ -126,13 +126,13 @@ proc wokIntegre:BASE:EOF { {fileid stdout} } {
     return
 }
 #;>
-# Execute les commandes SCCS command dans un Bourne Shell
-# 1. Ecrit sur fileid quand certains pattern sont reconnus.
-#    Retourne 1 si tout est OK. (Pattern De BASE::EOF bien recu)
+# Execute  SCCS command in a Bourne Shell
+# 1. Writes on fileid when specific pattern are matched.
+#    Returns  1 if everything's OK. (Pattern De BASE::EOF has been received.)
 # debugger:
-#    exp_internal 1         : patterns sur stderr ( ca suffit en general)
-#    exp_internal -f file 0 : stdout et patterns dans file
-#    exp_internal -f file 1 : stdout et patterns dans file + pattern sur stderr
+#    exp_internal 1         : patterns on stderr 
+#    exp_internal -f file 0 : stdout and patterns in file
+#    exp_internal -f file 1 : stdout and patterns in file + pattern on stderr
 #;<
 proc wokIntegre:BASE:Execute { VERBOSE command {fileid stdout} } {
     spawn -noecho sh $command
@@ -270,41 +270,3 @@ proc wokIntegre:BASE:tree { infile fils} {
     }
     return [list $data $next]
 }
-#
-#  ((((((((((((((((VERSION))))))))))))))))
-#
-#;>
-# Verifie que l'on peu plugger shop avec le numero ver retourne ver si OK
-#;<
-proc wokIntegre:Version:Check { fshop ver } {
-    set f [wokIntegre:Version:GetTableName $fshop 1]
-    set l [wokUtils:FILES:FileToList $f]
-    set str [wokinfo -n [wokinfo -s $fshop]]
-    foreach e $l {
-       if { [lindex $e 0] == $str } {
-           if { [lindex $e 1] != $ver } {
-               msgprint -c WOKVC -e "The shop $str is already registered with number [lindex $e 1]"
-               return {}
-           } else {
-               return $ver
-           }
-       }
-    }
-    set mx 0
-    foreach e $l {
-       set n [lindex $e 1]
-       set mx [expr ( $mx > $n ) ? $mx : $n]
-    }
-    foreach e $l {
-       set n [lindex $e 1]
-       if {$ver < $n } {
-           msgprint -c WOKVC -e "Bad version number. Should be strictly greater than $mx "
-           return {}
-       }
-       if {$ver == $n } {
-           msgprint -c WOKVC -e "The version $ver is already assigned to the shop [lindex $e 0]"
-           return {}
-       }
-    }
-    return $ver
-}
index 15bde784581c61e0d46ab60d9fe08bc7ffedec10..91d8f57efe65298cda378c1a0f7942298c5c2985 100755 (executable)
@@ -671,22 +671,27 @@ proc wokGetUsage { } {
            {
        Usage:
        
-       wget  [-f] [-ud <udname>] <filename> [-v <version>]
-       wget  [-f] [-ud <udname>] <filename_1> ... <filename_N>
-       
-       -ud     : Keyword used to specify a unit name
+       wget  -wb wbnam [-f] [-ud <udname>] <filename> [-v <version>]
+       wget  -wb wbnam [-f] [-ud <udname>] <filename_1> ... <filename_N>
+
+       -wb     : Specify the workbench to copy from. This option is mandatory.
+                  If the specified workbench has a repository attached to, the file(s)
+                  are getted from there. In this case and if only one file is selected
+                  then option -v can specify the version you want to get.
+                  If the specified workbench has no repository attahec to, the file(s)
+                  are directly copied form the specified workbench.
 
-       -wb     : Specify the workbench repository to copy from.
+       -ud     : Specify a unit name. If it does not exist in the current workbench it is
+                  created with the same type than in the origin workbench.
 
-       -f      : Force files to be overwritten if they already exist.
+       -f      : Force files to be overwritten if they already exist in the current
+                  unit..
 
-       wget -l : List "gettable" files for the current unit (default)
+       wget -l : List "gettable" files for the current unit 
 
     }
     return
 }
-
-
 #
 # Point d'entree de la commande
 #
@@ -700,7 +705,6 @@ proc wget { args } {
     set tblreq(-V)      {}
     set tblreq(-v)      value_required:string
     set tblreq(-ud)     value_required:string
-    set tblreq(-r)      value_required:string
     set tblreq(-wb)     value_required:string
     
     set param {}
@@ -708,40 +712,27 @@ proc wget { args } {
 
     set VERBOSE [info exists tabarg(-V)]
 
-    ;# recup 1 er workbench dans l'arbre"
-    ;#
-
-    if [info exists tabarg(-wb)] {
-       set fromwb $tabarg(-wb)
-    } else {
-       msgprint -c WOKVC -e "Option -from is required."
+    if [info exists tabarg(-h)] {
+       wokGetUsage
        return
     }
 
-
-    if { "[wokinfo -t [wokinfo -w $fromwb]]" == "workbench" } {
-       if { [wokStore:Report:SetQName $fromwb] == {} } {       
-           msgprint -c WOKVC -e "$fromwb has no repository. Copying from workbench $fromwb."
-           set directcp 1
-       }
+    if [info exists tabarg(-wb)] {
+       set fromwb $tabarg(-wb)
     } else {
-       msgprint -c WOKVC -e "$fromwb is not a workbench. Nothing done."
+       msgprint -c WOKVC -e "Option -wb is required."
        return
     }
     
 
     set workbench [wokinfo -n [wokinfo -w [wokcd]]]
     if { "[wokinfo -n [wokinfo -w $fromwb]]" == "$workbench" } {
-       msgprint -c WOKVC -e "Cannot piss on my foot"
+       msgprint -c WOKVC -e "Cannot get from current workbench"
        return
     }
 
     set fshop [wokinfo -s [wokcd]]
 
-    if { $VERBOSE } {
-       puts "Copying from $fromwb "
-    }
-
     if [info exists tabarg(-ud)] {
        set ud $tabarg(-ud)
     } else {
@@ -762,17 +753,74 @@ proc wget { args } {
        catch {unset listbase}
     }
 
-    if { [set BTYPE [wokIntegre:BASE:InitFunc]] == {} } {
-       return -1
-    }
 
-    if { ![file exists [set broot [wokIntegre:BASE:GetRootName]]] } {
-       msgprint -c WOKVC -e "The repository does not exists."
-       return -1
+    if { "[wokinfo -t [wokinfo -w $fromwb]]" != "workbench" } {
+       msgprint -c WOKVC -e "$fromwb is not a workbench. Nothing done."
+       return
     }
+    
+    if { [wokStore:Report:SetQName $fromwb] != {} } {  
+       if { [set BTYPE [wokIntegre:BASE:InitFunc]] == {} } {
+           return -1
+       }
+       if { ![file exists [set broot [wokIntegre:BASE:GetRootName]]] } {
+           msgprint -c WOKVC -e "The repository does not exists."
+           return -1
+       }
+       wokGetbase
+       return
+    } else {
+       if [info exists version] {
+           msgprint -c WOKVC -w "Option -v ignored in this context"
+       }
+       wokGetcopy
+       return
+    }
+}
+;#
+;#
+;#
+proc wokGetcopy { } {
+    uplevel {
+       if [wokinfo -x ${fromwb}:$ud] {
+           set listfileinbase [uinfo -f -Tsource ${fromwb}:$ud]
+       } else {
+           set listfileinbase {}
+       }
+       
+       if [info exists listbase] {
+           if { $param == {} } { 
+               foreach f [wokUtils:LIST:GM $listfileinbase *] {
+                   puts $f
+               }
+           } else {
+               foreach f [wokUtils:LIST:GM $listfileinbase $param] {
+                   puts $f
+               }
+           }
+           return
+       }
+       
+       if { [set RES [wokUtils:LIST:GM $listfileinbase $param]]  == {} } {
+           msgprint -c WOKVC -e "No match for $param in unit ${fromwb}:$ud. "
+           return
+       }
+       if { ![wokinfo -x ${workbench}:$ud] } {
+           ucreate ${workbench}:${ud}
+       }
+       
+       set from [wokinfo -p source:. ${fromwb}:${ud}]
+       set to [wokinfo -p source:. ${workbench}:${ud}]
 
-    wokGetbase
-    return
+       foreach e $RES {
+           if { [file exists [file join $to $e]] } {
+               msgprint -c WOKVC -w "Renamed [file join $to $e] [file join $to $e]-sav"
+               frename [file join $to $e] [file join $to $e]-sav
+           }
+           if { $VERBOSE } { msgprint -c WOKVC -i "Copying [file join $from $e] to [file join $to $e]" } 
+           wokUtils:FILES:copy [file join $from $e] [file join $to $e]
+       }
+    }
 }
 ;#
 ;#