#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Wed, 06 Dec 2017 03:31:38 +0100
changeset 4280 f4fb6e5cd1fb
parent 4279 c1c328421f15
child 4281 7b1c0f0170d0
#FEATURE by cg class: CVSSourceCodeManager class branch stuff (uninished) added: #checkin:text:directory:module:logMessage:force:onBranch: removed: #checkin:text:directory:module:logMessage:force: comment/format in: #setSymbolicName:revision:overWrite:path: changed: #createBranch:forClasses: #createBranch:pathes: #executeCVSCommand:module:inDirectory:log:pipe:orElseOutputTo:errorTo: #setSymbolicName:asBranch:revision:overWrite:pathes:
CVSSourceCodeManager.st
--- a/CVSSourceCodeManager.st	Tue Dec 05 20:33:28 2017 +0100
+++ b/CVSSourceCodeManager.st	Wed Dec 06 03:31:38 2017 +0100
@@ -1106,7 +1106,7 @@
         osProcess := OSProcess new
                         command:command;
                         outStream:outStreamOrNil;
-                        errorStream:outStreamOrNil;
+                        errorStream:errorStreamOrNil;
                         directory:pathOfDir.
 
         Processor isDispatching ifFalse:[
@@ -1157,6 +1157,7 @@
     "Modified: / 10-10-2011 / 14:47:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (format): / 13-10-2011 / 17:06:28 / jv"
     "Created: / 28-02-2012 / 17:30:34 / cg"
+    "Modified: / 06-12-2017 / 03:22:53 / cg"
 !
 
 fetchRevisionsFromRLogStream:inStream searchForKeyword:searchFor
@@ -1631,7 +1632,7 @@
 
 !CVSSourceCodeManager class methodsFor:'source code access'!
 
-checkin:containerFilename text:someText directory:packageDir module:moduleDir logMessage:logMessage force:force
+checkin:containerFilename text:someText directory:packageDir module:moduleDir logMessage:logMessage force:force onBranch:branchNameOrNil
     "enter some (source) code (which is someText)
      into the source repository. If the force argument is true, no merge is done;
      instead, the code is checked in as given (Dangerous).
@@ -1642,10 +1643,21 @@
      newRevision  msg answer didMerge
      modulePath time
      editor checkInRepaired didAccept emphasizedText repairedText out
-     emSep comment|
-
-    revision := self newestRevisionInFile:containerFilename directory:packageDir module:moduleDir.
-
+     emSep comment branchTag|
+
+    branchNameOrNil notNil ifTrue:[
+        branchTag := (self branchTagPrefix,branchNameOrNil).
+        revision := self utilities
+                        revisionForSymbolicName:branchTag
+                        class:nil
+                        fileName:containerFilename
+                        directory:packageDir
+                        module:moduleDir
+                        manager:self.
+    ] ifFalse:[    
+        revision := self newestRevisionInFile:containerFilename directory:packageDir module:moduleDir.
+    ].
+    
     logMsg := logMessage.
     (logMsg isEmptyOrNil) ifTrue:[
         logMsg := 'checkin from browser'.
@@ -1660,8 +1672,7 @@
 
     revision isNil ifTrue:[
         "/ a new file ...
-        ^ self
-            createContainerForText:someText inModule:moduleDir package:packageDir container:containerFilename
+        ^ self createContainerForText:someText inModule:moduleDir package:packageDir container:containerFilename
     ].
 
     [
@@ -1719,7 +1730,11 @@
         "/
         self activityNotification:'CVS: Merging ' , containerFilename , ' with repository version...'.
 
-        cmd := 'update ', CVSUpdateOptions, ' ', containerFilename, ' >', '"' , cmdOut name , '"'.
+        branchTag notNil ifTrue:[
+            cmd := 'update ', CVSUpdateOptions, ' -r ', branchTag, ' ' , containerFilename, ' >', '"' , cmdOut name , '"'.
+        ] ifFalse:[    
+            cmd := 'update ', CVSUpdateOptions, ' ', containerFilename, ' >', '"' , cmdOut name , '"'.
+        ].
         (self
             executeCVSCommand:cmd
             module:moduleDir
@@ -2110,8 +2125,8 @@
     ].
     ^ true
 
-    "Modified: / 12-11-2010 / 11:04:10 / cg"
-    "Modified: / 19-04-2012 / 14:18:24 / sr"
+    "Created: / 05-12-2017 / 23:28:31 / cg"
+    "Modified: / 06-12-2017 / 03:19:59 / cg"
 !
 
 checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMessage force:forceArg
@@ -3365,17 +3380,19 @@
 createBranch:branchName forClasses:aCollectionOfClasses
     "create a branch"
 
-    self setSymbolicName:branchName asBranch:true revision:nil overWrite:false classes:aCollectionOfClasses
+    self setSymbolicName:(self branchTagPrefix,branchName) asBranch:true revision:nil overWrite:false classes:aCollectionOfClasses
 
     "Created: / 04-12-2017 / 18:47:06 / cg"
+    "Modified: / 05-12-2017 / 23:20:49 / cg"
 !
 
 createBranch:branchName pathes:aCollectionOfPathNames
     "create a branch"
 
-    self setSymbolicName:branchName asBranch:true revision:nil overWrite:false pathes:aCollectionOfPathNames
+    self setSymbolicName:(self branchTagPrefix,branchName) asBranch:true revision:nil overWrite:false pathes:aCollectionOfPathNames
 
     "Created: / 04-12-2017 / 18:56:30 / cg"
+    "Modified: / 05-12-2017 / 23:20:59 / cg"
 !
 
 createContainerFor:aClass inModule:moduleDir package:packageDir container:fileName
@@ -5228,7 +5245,7 @@
      If filename is nil, the symbolicName for a whole package is set.
      If multiple paths are given, the revision MUST be nil."
 
-    |argumentString result errorStream outStream moduleDirs symbolicName|
+    |argumentString result errorStream outStream moduleDirs symbolicName cvsErrorOutput cvsOutput|
 
     symbolicName := (symbolicNameArg includes:Character space)
                         ifTrue:[ '"',symbolicNameArg,'"' ]
@@ -5241,7 +5258,7 @@
     moduleDirs := pathsInRepository
                     collect:[:pathInRepository |
                         (pathInRepository asCollectionOfSubstringsSeparatedByAny:'/\') first.
-                    ].
+                    ] as:Set.
     moduleDirs do:[:moduleDir |
         |pathsInModule pathsInModuleAsArgument|
 
@@ -5287,12 +5304,15 @@
                     log:true
                     outputTo:outStream
                     errorTo:errorStream.
+                    
         self activityNotification:nil.
+        cvsErrorOutput := errorStream contents.
         (result not or:[errorStream size ~~ 0]) ifTrue:[
-            SourceCodeManagerError raiseRequestWith:errorStream contents errorString:' cvs tag failed: ', pathsInModuleAsArgument.
+            SourceCodeManagerError raiseRequestWith:cvsErrorOutput errorString:' cvs tag failed: ', pathsInModuleAsArgument.
         ] ifFalse:[
-            (outStream contents asStringCollection contains:[:someLine| someLine startsWithAnyOf:'WE']) ifTrue:[
-                SourceCodeManagerError raiseRequestWith:outStream contents errorString:' cvs tag could not be set: ', pathsInModuleAsArgument.
+            cvsOutput := outStream contents.
+            (cvsOutput asStringCollection contains:[:someLine| someLine startsWithAnyOf:'WE']) ifTrue:[
+                SourceCodeManagerError raiseRequestWith:cvsOutput errorString:' cvs tag could not be set: ', pathsInModuleAsArgument.
             ].
         ].
     ].
@@ -5323,6 +5343,7 @@
     "
 
     "Created: / 04-12-2017 / 18:52:14 / cg"
+    "Modified (format): / 06-12-2017 / 03:23:45 / cg"
 !
 
 setSymbolicName:symbolicName revision:rev overWrite:overWriteBool class:aClass
@@ -5383,11 +5404,7 @@
 
      If filename is nil, the symbolicName for a whole package is set"
 
-    self
-        setSymbolicName:symbolicName
-        revision:rev
-        overWrite:overWriteBool
-        pathes:(Array with:pathInRepository)
+    self setSymbolicName:symbolicName revision:rev overWrite:overWriteBool pathes:(Array with:pathInRepository)
 
     "
      self setSymbolicName:'stable' revision:nil overWrite:false path:'stx/libbasic/Array.st'
@@ -5397,6 +5414,7 @@
     "
 
     "Modified: / 12-09-2006 / 12:37:20 / cg"
+    "Modified (format): / 05-12-2017 / 22:56:04 / cg"
 !
 
 setSymbolicName:symbolicNameArg revision:rev overWrite:overWriteBool pathes:pathsInRepository