bulk tagging
authorClaus Gittinger <cg@exept.de>
Tue, 12 Sep 2006 14:29:52 +0200
changeset 1783 e72b11658c9f
parent 1782 41b0e8111aea
child 1784 7afd92336ac1
bulk tagging
CVSSourceCodeManager.st
--- a/CVSSourceCodeManager.st	Tue Sep 12 14:28:12 2006 +0200
+++ b/CVSSourceCodeManager.st	Tue Sep 12 14:29:52 2006 +0200
@@ -4107,6 +4107,62 @@
         module:moduleDir
 !
 
+setSymbolicName:symbolicName revision:rev overWrite:overWriteBool class:aClass
+    "set a symbolicName for revision rev.
+     If rev is nil, set it for the head (most recent) revision.
+     If rev is 0, delete the symbolic name.
+     If overWriteBool is true, the symbolicName will be changed, even if it has already been set.
+     If overWriteBool is false, an error will be raised if symbolicName has already been set.
+
+     If filename is nil, the symbolicName for a whole package is set"
+
+    self
+        setSymbolicName:symbolicName 
+        revision:rev 
+        overWrite:overWriteBool 
+        path:((self sourceInfoOfClass:aClass) at:#pathInRepository)
+
+    "
+     self setSymbolicName:'foo' revision:nil overWrite:false class:Array
+     self setSymbolicName:'foo' revision:nil overWrite:true class:Array
+     self setSymbolicName:'foo' revision:nil overWrite:true class:Array
+     self setSymbolicName:'foo' revision:'1.1' overWrite:true class:Array
+     self setSymbolicName:'foo' revision:0 overWrite:true class:Array
+    "
+
+    "Created: / 12-09-2006 / 12:56:52 / cg"
+!
+
+setSymbolicName:symbolicName revision:rev overWrite:overWriteBool classes:aCollectionOfClasses
+    "set a symbolicName for revision rev.
+     If rev is nil, set it for the head (most recent) revision.
+     If rev is 0, delete the symbolic name.
+     If overWriteBool is true, the symbolicName will be changed, even if it has already been set.
+     If overWriteBool is false, an error will be raised if symbolicName has already been set.
+
+     If filename is nil, the symbolicName for a whole package is set"
+
+    |pathes|
+
+    pathes := aCollectionOfClasses 
+                collect:[:cls | (self sourceInfoOfClass:cls) at:#pathInRepository].
+    self
+        setSymbolicName:symbolicName 
+        revision:rev 
+        overWrite:overWriteBool 
+        pathes:pathes
+
+    "
+     self setSymbolicName:'foo' revision:nil overWrite:false classes:(Array with:True with:False)
+     self setSymbolicName:'foo' revision:nil overWrite:true classes:(Array with:True with:False)
+     self setSymbolicName:'foo' revision:nil overWrite:true classes:(Array with:True with:False)
+     self setSymbolicName:'foo' revision:'1.1' overWrite:true classes:(Array with:True with:False)
+     self setSymbolicName:'foo' revision:0 overWrite:true classes:(Array with:True with:False)
+    "
+
+    "Created: / 12-09-2006 / 12:58:23 / cg"
+!
+
 setSymbolicName:symbolicName revision:rev overWrite:overWriteBool path:pathInRepository
     "set a symbolicName for revision rev.
      If rev is nil, set it for the head (most recent) revision.
@@ -4116,47 +4172,122 @@
 
      If filename is nil, the symbolicName for a whole package is set"
 
-    |inStream argumentString result errorStream outStream moduleDir|
-
-    moduleDir := (pathInRepository asCollectionOfSubstringsSeparatedByAny:'/\') first.
-
-    rev = 0 ifTrue:[
-        argumentString := ' -d '.
-    ] ifFalse:[
-        argumentString := ' -r ', (rev ? 'HEAD').
-        overWriteBool ifTrue:[
-            argumentString := argumentString, ' -F'
+    self
+        setSymbolicName:symbolicName 
+        revision:rev 
+        overWrite:overWriteBool 
+        pathes:(Array with:pathInRepository)
+
+    "
+     self setSymbolicName:'stable' revision:nil overWrite:false path:'stx/libbasic/Array.st'
+     self setSymbolicName:'stable' revision:nil overWrite:true path:'stx/libbasic/Array.st'
+     self setSymbolicName:'stable' revision:nil overWrite:true path:'stx/libbasic/Array.st'
+     self setSymbolicName:'stable' revision:'1.1' overWrite:true path:'stx/libbasic/Array.st'
+    "
+
+    "Modified: / 12-09-2006 / 12:37:20 / cg"
+!
+
+setSymbolicName:symbolicNameArg revision:rev overWrite:overWriteBool pathes:pathesInRepository
+    "set a symbolicName for revision rev.
+     If rev is nil, set it for the head (most recent) revision.
+     If rev is 0, delete the symbolic name.
+     If overWriteBool is true, the symbolicName will be changed, even if it has already been set.
+     If overWriteBool is false, an error will be raised if symbolicName has already been set.
+
+     If filename is nil, the symbolicName for a whole package is set.
+     If multiple pathes are given, the revision MUST be nil."
+
+    |argumentString result errorStream outStream moduleDirs symbolicName|
+
+    symbolicName := (symbolicNameArg includes:Character space) 
+                        ifTrue:[ '"',symbolicNameArg,'"' ]
+                        ifFalse:[ symbolicNameArg ].
+
+    pathesInRepository size > 1 ifTrue:[
+        self assert:(rev isNil or:[rev == 0]) "revision must be nil (for head) or 0 (for delete) with multiple pathes"
+    ].
+
+    moduleDirs := pathesInRepository 
+                    collect:[:pathInRepository |
+                        (pathInRepository asCollectionOfSubstringsSeparatedByAny:'/\') first.
+                    ].
+    moduleDirs do:[:moduleDir |
+        |pathesInModule pathesInModuleAsArgument|
+
+        pathesInModule := pathesInRepository
+                    select:[:pathInRepository |
+                        |moduleOfThisPath|
+
+                        moduleOfThisPath := (pathInRepository asCollectionOfSubstringsSeparatedByAny:'/\') first.
+                        moduleOfThisPath = moduleDir
+                    ].
+
+        rev = 0 ifTrue:[
+            argumentString := ' -d '.
+        ] ifFalse:[
+            argumentString := ' -r ', (rev ? 'HEAD').
+            overWriteBool ifTrue:[
+                argumentString := argumentString, ' -F'
+            ].
         ].
-    ].
-
-    [
-        self activityNotification:'setting symbolic name ', pathInRepository.
+
+        pathesInModuleAsArgument := pathesInModule 
+                                        collect:[:eachPath |
+                                            (eachPath includes:Character space) ifTrue:[
+                                                '"',eachPath,'"'
+                                            ] ifFalse:[
+                                                eachPath
+                                            ].
+                                        ].
+        pathesInModuleAsArgument := pathesInModuleAsArgument asStringCollection asString.
+
+        self activityNotification:'setting symbolic name for: ', pathesInModuleAsArgument.
 
         errorStream := '' writeStream.
         outStream := '' writeStream.
 
-        result := self  executeCVSCommand:('rtag ' , argumentString, ' ', symbolicName, ' ', pathInRepository) 
-                        module:moduleDir 
-                        inDirectory:nil 
-                        log:true
-                        outputTo:outStream
-                        errorTo:errorStream.
+        result := self  
+                    executeCVSCommand:('rtag ' , argumentString, ' ', symbolicName, ' ', pathesInModuleAsArgument) 
+                    module:moduleDir 
+                    inDirectory:nil 
+                    log:true
+                    outputTo:outStream
+                    errorTo:errorStream.
         (result not or:[errorStream size ~~ 0]) ifTrue:[
-            SourceCodeManagerError raiseWith:errorStream contents errorString:' cvs tag failed: ', pathInRepository.
+            SourceCodeManagerError raiseWith:errorStream contents errorString:' cvs tag failed: ', pathesInModuleAsArgument.
         ].
-        (outStream contents asStringCollection contains:[:eachLine| eachLine startsWithAnyOf:'WE']) ifTrue:[
-            SourceCodeManagerError raiseWith:outStream contents errorString:' cvs tag could not be set: ', pathInRepository.
+        (outStream contents asStringCollection contains:[:someLine| someLine startsWithAnyOf:'WE']) ifTrue:[
+            SourceCodeManagerError raiseWith:outStream contents errorString:' cvs tag could not be set: ', pathesInModuleAsArgument.
         ].
-    ] ensure:[
-        inStream notNil ifTrue:[inStream close].
     ].
 
     "
-        self setSymbolicName:'stable' revision:nil overWrite:false path:'stx/libbasic/Array.st'
-        self setSymbolicName:'stable' revision:nil overWrite:true path:'stx/libbasic/Array.st'
-        self setSymbolicName:'stable' revision:nil overWrite:true path:'stx/libbasic/Array.st'
-        self setSymbolicName:'stable' revision:'1.1' overWrite:true path:'stx/libbasic/Array.st'
+     self setSymbolicName:'stable' revision:nil overWrite:false path:'stx/libbasic/Array.st'
+     self setSymbolicName:'stable' revision:nil overWrite:true path:'stx/libbasic/Array.st'
+
+     self 
+        setSymbolicName:'test1' 
+        revision:nil 
+        overWrite:true 
+        path:'bosch/dapasx/datenbasis/DAPASX__HierarchicalList.st'
+
+     self 
+        setSymbolicName:'test2' 
+        revision:nil 
+        overWrite:true 
+        pathes:#( 'bosch/dapasx/datenbasis/DAPASX__HierarchicalList.st' 
+                  'bosch/dapasx/datenbasis/DAPASX__ProjectSearch.st' )
+
+     self 
+        setSymbolicName:'test2' 
+        revision:0 
+        overWrite:true 
+        pathes:#( 'bosch/dapasx/datenbasis/DAPASX__HierarchicalList.st' 
+                  'bosch/dapasx/datenbasis/DAPASX__ProjectSearch.st' )
     "
+
+    "Created: / 12-09-2006 / 12:36:44 / cg"
 !
 
 statusOf:clsOrNil fileName:classFileName directory:packageDir module:moduleDir
@@ -4269,7 +4400,7 @@
 !CVSSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.321 2006-08-29 14:00:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.322 2006-09-12 12:29:52 cg Exp $'
 ! !
 
 CVSSourceCodeManager initialize!