class: AbstractSourceCodeManager
authorClaus Gittinger <cg@exept.de>
Mon, 21 Jul 2014 13:25:58 +0200
changeset 3597 f433e8d02208
parent 3596 df322e0661fb
child 3598 96223506d5ff
class: AbstractSourceCodeManager added: #revisionStringFor:inModule:directory:container:revision: comment/format in: #revisionLogOf:fromRevision:toRevision:fileName:directory:module: changed: #checkinClass:fileName:directory:module:logMessage:force: #revisionLogOf:fromRevision:toRevision:numberOfRevisions:fileName:directory:module: some stuff moved from a concrete subclass
AbstractSourceCodeManager.st
--- a/AbstractSourceCodeManager.st	Thu Jul 17 03:45:13 2014 +0000
+++ b/AbstractSourceCodeManager.st	Mon Jul 21 13:25:58 2014 +0200
@@ -580,7 +580,10 @@
     "Created: / 23-08-2006 / 14:05:42 / cg"
 !
 
-revisionLogOf:clsOrNil fromRevision:firstRev toRevision:lastRef fileName:classFileName directory:packageDir module:moduleDir 
+revisionLogOf:clsOrNil 
+    fromRevision:firstRev toRevision:lastRef 
+    fileName:classFileName directory:packageDir module:moduleDir 
+
     ^ self 
         revisionLogOf:clsOrNil
         fromRevision:firstRev
@@ -591,7 +594,10 @@
         module:moduleDir
 !
 
-revisionLogOf:clsOrNil fromRevision:rev1OrNil toRevision:rev2OrNil numberOfRevisions:limitOrNil fileName:classFileName directory:packageDir module:moduleDir 
+revisionLogOf:clsOrNil 
+    fromRevision:rev1OrNil toRevision:rev2OrNil numberOfRevisions:limitOrNil 
+    fileName:classFileName directory:packageDir module:moduleDir 
+
     "Return info about the repository container and (part of) the revisionlog as a collection 
      of revision entries. Return nil on failure.
 
@@ -632,6 +638,8 @@
             Attention: if state = 'dead' that revision is no longer valid.
         "
 
+    self subclassResponsibility
+
     "Created: / 15-11-1995 / 18:12:51 / cg"
     "Modified: / 14-02-1997 / 21:14:01 / cg"
     "Modified: / 11-02-2014 / 13:03:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -2058,12 +2066,12 @@
      Return true if ok, false if not."
 
     |className answer allLabel allValue 
-     nameOfVersionMethodInClasses|
+     nameOfVersionMethodInClasses revision|
 
     className := aClass name.
     nameOfVersionMethodInClasses := self nameOfVersionMethodInClasses.
 
-    aClass revision isNil ifTrue:[ 
+    (revision := aClass revision) isNil ifTrue:[ 
         force ifFalse:[
             ('SourceCodeManager [warning]: class ' , className, ' has no revision string') errorPrintCR.
 
@@ -2084,32 +2092,32 @@
                             values:(allValue , #(false #checkIn))
                             default:#checkIn.
             ] ifFalse:[
-                answer := OptionBox 
-                            request:('Class %1 has no revision string.\\Check in as newest ?' bindWith:className allBold) withCRs
-                            label:'Confirm'
-                            buttonLabels:(allLabel , #('Cancel' 'CheckIn' 'Create & CheckIn')) 
-                            values:(allValue , #(false #checkIn #create))
-                            default:#create.
+                force ifTrue:[
+                    revision := self newestRevisionInFile:classFileName directory:packageDir module:moduleDir.
+                    revision isNil ifTrue:[
+                        revision := '1.0'   "/ initial checkin
+                    ].
+                ] ifFalse:[
+                    revision := '1.0'   "/ initial checkin
+                ].
+                answer := #create.
+"/                answer := OptionBox 
+"/                            request:('Class %1 has no revision string.\\Check in as newest ?' bindWith:className allBold) withCRs
+"/                            label:'Confirm'
+"/                            buttonLabels:(allLabel , #('Cancel' 'CheckIn' 'Create & CheckIn')) 
+"/                            values:(allValue , #(false #checkIn #create))
+"/                            default:#create.
             ].
             answer == false ifTrue:[ AbortOperationRequest raise. ^ false ].
             answer == #cancelAll ifTrue:[ AbortAllOperationRequest raise. ^ false ].
             answer == #create ifTrue:[ 
-                self updateVersionMethodOf:aClass for:'$' , 'Header' , '$'.  "/ concatenated to avoid RCS expansion
+                self updateVersionMethodOf:aClass for:(self revisionStringFor:aClass inModule:moduleDir directory:packageDir container:classFileName revision:revision).
             ].
         ]
     ].
 
     "Ensure that the method #version_XXX is present before checking in XXX. 
      It will be missing when checking in classes with only the old method #version"
-"/ this is wrong - it would add the SVN-id as CVS id...
-"/    (aClass theMetaclass includesSelector: nameOfVersionMethodInClasses) ifFalse: [
-"/        versionAsKnownBefore := aClass revisionString.   "/ looks in the old version (non-repository based)
-"/
-"/        self 
-"/            compileVersionMethod:nameOfVersionMethodInClasses 
-"/            of:aClass 
-"/            for:(versionAsKnownBefore ? ('$' , 'Header' , '$')).  "/ concatenated to avoid RCS expansion
-"/    ].
 
     ^ self basicCheckinClass:aClass fileName:classFileName directory:packageDir module:moduleDir logMessage:logMessage force:force.
 
@@ -3369,6 +3377,22 @@
     "Created: / 23-08-2006 / 14:14:59 / cg"
 !
 
+revisionStringFor:aClass inModule:moduleDir directory:packageDir container:fileName revision:revisionString
+    "utility function: return a string usable as initial revision string.
+     Can be redefined in subclasses"
+
+    ^ self standardRevisionStringFor:aClass inModule:moduleDir directory:packageDir container:fileName revision:revisionString
+
+    "
+     self 
+        revisionStringFor:Array 
+        inModule:'stx' 
+        directory:'libbasic' 
+        container:'Array.st' 
+        revision:'123'          
+    "
+!
+
 revisionsOf:aClass
     "return a collection of revisions (as strings) found in the repository.
      The most recent (newest) revision will be the first in the list.
@@ -3932,15 +3956,15 @@
 !AbstractSourceCodeManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.326 2014-07-16 18:48:41 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.327 2014-07-21 11:25:58 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.326 2014-07-16 18:48:41 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.327 2014-07-21 11:25:58 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: AbstractSourceCodeManager.st,v 1.326 2014-07-16 18:48:41 cg Exp $'
+    ^ '$Id: AbstractSourceCodeManager.st,v 1.327 2014-07-21 11:25:58 cg Exp $'
 ! !