support multiple managers
authorClaus Gittinger <cg@exept.de>
Fri, 25 Aug 2006 18:00:20 +0200
changeset 1730 0dc7ef515414
parent 1729 18ea45b4a1be
child 1731 16af565d0676
support multiple managers
CVSSourceCodeManager.st
--- a/CVSSourceCodeManager.st	Fri Aug 25 17:07:26 2006 +0200
+++ b/CVSSourceCodeManager.st	Fri Aug 25 18:00:20 2006 +0200
@@ -224,6 +224,7 @@
 
     CVSBinDir size > 0 ifTrue:[
         OperatingSystem isMSDOSlike ifTrue:[
+            cvsCmd := 'cvs.exe'.
             cmdName := CVSBinDir asFilename constructString:cvsCmd.
             ( OperatingSystem canExecuteCommand:cmdName) ifFalse:[
                 CVSBinDir := ''.
@@ -244,16 +245,6 @@
         ^ self
     ].
 
-"/    (OperatingSystem canExecuteCommand:(CVSBinDir , 'co')) ifFalse:[
-"/        'CVSSourceCodeManager [warning]: limited functionality - no >> co << command found' infoPrintCR.
-"/    ].
-"/    (OperatingSystem canExecuteCommand:(CVSBinDir , 'rlog')) ifFalse:[
-"/        'CVSSourceCodeManager [warning]: limited functionality - no >> rlog << command found' infoPrintCR.
-"/    ].
-"/    (OperatingSystem canExecuteCommand:(CVSBinDir , 'patch')) ifFalse:[
-"/        'CVSSourceCodeManager [warning]: limited functionality - no >> patch << command found' infoPrintCR.
-"/    ].
-
     UseWorkTree := false.
 
     CacheDirectoryName ifNil:[
@@ -386,10 +377,20 @@
     ^ CVSModuleRoots values copyWith:CVSRoot 
 !
 
-managerTypeName
-    ^ 'CVS'
-
-    "Created: / 16-08-2006 / 11:05:56 / cg"
+repositoryInfoPerModule
+    "return the dictionary, which associates CVSRoots to module names.
+     If no entry is contained in this dictionary for some module,
+     the default cvsRoot (CVSRoot) will be used."
+
+    ^ CVSModuleRoots ? #()
+!
+
+repositoryInfoPerModule:aDictionary
+    "set the dictionary, which associates CVSRoots to module names.
+     If no entry is contained in this dictionary for some module,
+     the default cvsRoot (CVSRoot) will be used."
+
+    CVSModuleRoots := aDictionary
 !
 
 repositoryName
@@ -446,6 +447,7 @@
      If no entry is contained in this dictionary for some module,
      the default cvsRoot (CVSRoot) will be used."
 
+    self obsoleteMethodWarning:'use repositoryInfoPerModule'.
     ^ CVSModuleRoots 
 !
 
@@ -454,6 +456,7 @@
      If no entry is contained in this dictionary for some module,
      the default cvsRoot (CVSRoot) will be used."
 
+    self obsoleteMethodWarning:'use repositoryInfoPerModule:'.
     CVSModuleRoots := aDictionary
 ! !
 
@@ -1244,6 +1247,14 @@
     "Modified: / 04-07-2006 / 18:05:43 / cg"
 ! !
 
+!CVSSourceCodeManager class methodsFor:'queries'!
+
+managerTypeName
+    ^ 'CVS'
+
+    "Created: / 16-08-2006 / 11:05:56 / cg"
+! !
+
 !CVSSourceCodeManager class methodsFor:'source code access'!
 
 checkin:containerFilename text:someText directory:packageDir module:moduleDir logMessage:logMessage force:force
@@ -1732,12 +1743,12 @@
      instead, the code is checked in as given (Dangerous).
      Return true if ok, false if not."
 
-    |tempdir cmd checkoutName logMsg revision logTmp 
+    |tempdir cmd checkoutName logMsg revision newestRevision logTmp 
      cmdOut whatHappened s entry idx changeLog changesAsLogged l 
      newRevision newString binRevision className msg answer didMerge
      modulePath time 
      editor checkInRepaired checkInNew didAccept emphasizedText repairedText out 
-     emSep comment force|
+     emSep comment force newVersionString|
 
     force := forceArg.
 
@@ -1745,7 +1756,7 @@
     cls isPrivate ifTrue:[
         self error:'refuse to check in private classes.'.
     ].
-    revision := cls revision.
+    revision := cls revision.        
     (revision notNil
     and:[revision endsWith:$m]) 
     ifTrue:[
@@ -1761,10 +1772,10 @@
     ].
 
     revision isNil ifTrue:[
-        revision := self newestRevisionOf:cls.
+        revision := newestRevision := self newestRevisionOf:cls.
         revision isNil ifTrue:[
             force ifTrue:[
-                revision := self newestRevisionInFile:classFileName directory:packageDir module:moduleDir.
+                revision := newestRevision := self newestRevisionInFile:classFileName directory:packageDir module:moduleDir.
             ] ifFalse:[
                 revision := '1.0'   "/ initial checkin
             ]
@@ -1851,14 +1862,27 @@
             (cls binaryRevision notNil
             and:[(self checkForExistingContainerInModule:moduleDir directory:packageDir container:classFileName) not ])
             ifTrue:[
-                (Dialog confirm:('Someone seems to have removed the source container for ' , cls name , '\\Force new checkin ?') withCRs)
+                (Dialog confirm:('Someone seems to have removed the source container for ',cls name,'\\Force new checkin ?') withCRs)
                 ifTrue:[
                     cls setBinaryRevision:nil.
                     ^ self checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMsg force:force.
                 ].
             ].
-        ].
-        force ifFalse:[
+
+            "/ is the version correct ?
+            newestRevision isNil ifTrue:[
+                newestRevision := self newestRevisionOf:cls.
+            ].
+            revision > newestRevision ifTrue:[
+                (Dialog confirm:('The version-info of ',cls name allBold,' is wrong \(The class version (',revision allBold,') is newer than the newest version in the repository (',newestRevision allBold,').\\Patch the version and retry checkin ?') withCRs)
+                ifTrue:[
+                    self halt.
+                    newVersionString := self updatedRevisionStringOf:cls forRevision:newestRevision with:cls revisionString.
+                    cls updateVersionMethodFor:newVersionString.
+                    ^ self checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMsg force:force.
+                ].
+            ].
+
             'CVSSourceCodeManager [error]: failed to execute: ' errorPrint. cmd errorPrintCR.
             tempdir recursiveRemove.
             cmdOut remove.
@@ -3453,7 +3477,7 @@
             ^ #().
         ].
 
-        [line := inStream nextLine. line notNil] whileTrue:[
+        [line := inStream atEnd ifTrue:nil ifFalse:[ inStream nextLine ]. line notNil] whileTrue:[
             |idx|
 
             "/ 'd--- 2005-06-02 17:21:20 +0200 Eigene Dateien'
@@ -4281,7 +4305,7 @@
 !CVSSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.315 2006-08-23 12:21:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.316 2006-08-25 16:00:20 cg Exp $'
 ! !
 
 CVSSourceCodeManager initialize!