--- a/AbstrSCMgr.st Sat Nov 18 18:20:33 1995 +0100
+++ b/AbstrSCMgr.st Mon Nov 20 14:19:50 1995 +0100
@@ -44,7 +44,7 @@
!
version
-^ '$Header: /cvs/stx/stx/libbasic3/Attic/AbstrSCMgr.st,v 1.18 1995-11-18 17:15:30 cg Exp $'! !
+^ '$Header: /cvs/stx/stx/libbasic3/Attic/AbstrSCMgr.st,v 1.19 1995-11-20 13:19:47 cg Exp $'! !
!AbstractSourceCodeManager class methodsFor:'initialization'!
@@ -88,6 +88,25 @@
"Created: 4.11.1995 / 19:09:12 / cg"
"Modified: 4.11.1995 / 19:15:43 / cg"
+!
+
+revisionAfter:aRevisionString
+ |idx s|
+
+ idx := aRevisionString lastIndexOf:$..
+ idx == 0 ifTrue:[
+ ^ ((Integer readFrom:aRevisionString) + 1) printString
+ ].
+
+ ^ (aRevisionString copyTo:idx) , ((Integer readFrom:(aRevisionString copyFrom:(idx+1)))+1) printString
+
+ "
+ SourceCodeManager revisionAfter:'1.2.3.4'
+ SourceCodeManager revisionAfter:'123'
+ SourceCodeManager revisionAfter:'1.24'
+ "
+
+ "Created: 20.11.1995 / 12:54:05 / cg"
! !
!AbstractSourceCodeManager class methodsFor:'source code access'!
@@ -218,13 +237,18 @@
!AbstractSourceCodeManager class methodsFor:'source code administration'!
-writeRevisionLogOf:cls fileName:classFileName directory:packageDir module:moduleDir to:aStream
- self subclassResponsibility.
+writeRevisionLogOf:aClass to:aStream
+ "extract a classes log and append it to aStream."
- "Created: 15.11.1995 / 18:12:51 / cg"
+ ^ self
+ writeRevisionLogOf:aClass fromRevision:nil toRevision:nil to:aStream
+
+ "
+ SourceCodeManager writeRevisionLogOf:Array to:Transcript
+ "
!
-writeRevisionLogOf:aClass to:aStream
+writeRevisionLogOf:aClass fromRevision:rev1 toRevision:rev2 to:aStream
"extract a classes log and append it to aStream."
|cls sourceInfo tempDir packageDir moduleDir tempFile classFileName ok|
@@ -246,15 +270,26 @@
^ self
writeRevisionLogOf:cls
+ fromRevision:rev1
+ toRevision:rev2
fileName:classFileName
directory:packageDir
module:moduleDir
to:aStream
"
- SourceCodeManager checkinClass:Array
+ SourceCodeManager writeRevisionLogOf:Array fromRevision:'1.40' toRevision:'1.43' to:Transcript
"
"Created: 6.11.1995 / 18:56:00 / cg"
- "Modified: 15.11.1995 / 18:12:22 / cg"
+ "Modified: 20.11.1995 / 12:19:47 / cg"
+!
+
+writeRevisionLogOf:cls fromRevision:rev1 toRevision:rev2 fileName:classFileName directory:packageDir module:moduleDir to:aStream
+ self subclassResponsibility.
+
+ "Created: 15.11.1995 / 18:12:51 / cg"
+ "Modified: 20.11.1995 / 12:20:12 / cg"
+!
+
! !
--- a/AbstractSourceCodeManager.st Sat Nov 18 18:20:33 1995 +0100
+++ b/AbstractSourceCodeManager.st Mon Nov 20 14:19:50 1995 +0100
@@ -44,7 +44,7 @@
!
version
-^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.18 1995-11-18 17:15:30 cg Exp $'! !
+^ '$Header: /cvs/stx/stx/libbasic3/AbstractSourceCodeManager.st,v 1.19 1995-11-20 13:19:47 cg Exp $'! !
!AbstractSourceCodeManager class methodsFor:'initialization'!
@@ -88,6 +88,25 @@
"Created: 4.11.1995 / 19:09:12 / cg"
"Modified: 4.11.1995 / 19:15:43 / cg"
+!
+
+revisionAfter:aRevisionString
+ |idx s|
+
+ idx := aRevisionString lastIndexOf:$..
+ idx == 0 ifTrue:[
+ ^ ((Integer readFrom:aRevisionString) + 1) printString
+ ].
+
+ ^ (aRevisionString copyTo:idx) , ((Integer readFrom:(aRevisionString copyFrom:(idx+1)))+1) printString
+
+ "
+ SourceCodeManager revisionAfter:'1.2.3.4'
+ SourceCodeManager revisionAfter:'123'
+ SourceCodeManager revisionAfter:'1.24'
+ "
+
+ "Created: 20.11.1995 / 12:54:05 / cg"
! !
!AbstractSourceCodeManager class methodsFor:'source code access'!
@@ -218,13 +237,18 @@
!AbstractSourceCodeManager class methodsFor:'source code administration'!
-writeRevisionLogOf:cls fileName:classFileName directory:packageDir module:moduleDir to:aStream
- self subclassResponsibility.
+writeRevisionLogOf:aClass to:aStream
+ "extract a classes log and append it to aStream."
- "Created: 15.11.1995 / 18:12:51 / cg"
+ ^ self
+ writeRevisionLogOf:aClass fromRevision:nil toRevision:nil to:aStream
+
+ "
+ SourceCodeManager writeRevisionLogOf:Array to:Transcript
+ "
!
-writeRevisionLogOf:aClass to:aStream
+writeRevisionLogOf:aClass fromRevision:rev1 toRevision:rev2 to:aStream
"extract a classes log and append it to aStream."
|cls sourceInfo tempDir packageDir moduleDir tempFile classFileName ok|
@@ -246,15 +270,26 @@
^ self
writeRevisionLogOf:cls
+ fromRevision:rev1
+ toRevision:rev2
fileName:classFileName
directory:packageDir
module:moduleDir
to:aStream
"
- SourceCodeManager checkinClass:Array
+ SourceCodeManager writeRevisionLogOf:Array fromRevision:'1.40' toRevision:'1.43' to:Transcript
"
"Created: 6.11.1995 / 18:56:00 / cg"
- "Modified: 15.11.1995 / 18:12:22 / cg"
+ "Modified: 20.11.1995 / 12:19:47 / cg"
+!
+
+writeRevisionLogOf:cls fromRevision:rev1 toRevision:rev2 fileName:classFileName directory:packageDir module:moduleDir to:aStream
+ self subclassResponsibility.
+
+ "Created: 15.11.1995 / 18:12:51 / cg"
+ "Modified: 20.11.1995 / 12:20:12 / cg"
+!
+
! !
--- a/CVSSCMgr.st Sat Nov 18 18:20:33 1995 +0100
+++ b/CVSSCMgr.st Mon Nov 20 14:19:50 1995 +0100
@@ -83,7 +83,7 @@
!
version
-^ '$Header: /cvs/stx/stx/libbasic3/Attic/CVSSCMgr.st,v 1.15 1995-11-18 17:20:33 cg Exp $'! !
+^ '$Header: /cvs/stx/stx/libbasic3/Attic/CVSSCMgr.st,v 1.16 1995-11-20 13:19:50 cg Exp $'! !
!CVSSourceCodeManager class methodsFor:'initialization'!
@@ -116,9 +116,10 @@
into the source repository.
Return true if ok, false if not."
- |tempdir dir cmd checkoutName logMsg revision merge|
+ |tempdir dir cmd checkoutName logMsg revision merge cmdOut whatHappened s|
merge := false. "/ for now ....
+merge := true. "/ for now ....
merge ifTrue:[
revision := cls revision.
@@ -133,6 +134,11 @@
logMsg := 'checkin from browser'.
].
+ cmdOut := Filename newTemporary.
+ cmdOut exists ifTrue:[
+ cmdOut remove.
+ ].
+
"/
"/ in CVS, we have to checkout the file first, in order
"/ to get up-to-date CVS entries, and also to be able to merge in
@@ -158,10 +164,11 @@
checkoutName := moduleDir , '/' , packageDir , '/' , classFileName , '.st'.
merge ifTrue:[
- cmd := 'cd ' , tempdir name , ';cvs checkout -r ' revision , ' ', checkoutName.
+ cmd := 'cd ' , tempdir name , ';cvs checkout -r ' , revision , ' ', checkoutName.
] ifFalse:[
cmd := 'cd ' , tempdir name , ';cvs checkout ' , checkoutName.
].
+('checkout: ' , cmd) printNL.
(OperatingSystem executeCommand:cmd) ifFalse:[
'failed: ' errorPrint. cmd errorPrintNL.
@@ -180,17 +187,66 @@
^ false.
].
-"/merge ifTrue:[
-"/ "/
-"/ "/ synchronize i.e. merge in any changes
-"/ "/
-"/ cmd := 'cd ' , tempdir name , ';cvs update ' , checkoutName.
-"/ (OperatingSystem executeCommand:cmd) ifFalse:[
-"/'failed: ' errorPrint. cmd errorPrintNL.
-"/ 'CVSMGR: cannot copy-over filedOut class source' errorPrintNL.
-"/ ^ false.
-"/ ].
-"/].
+merge ifTrue:[
+ "/
+ "/ synchronize i.e. merge in any changes
+ "/
+ cmd := 'cd ' , tempdir name , ';cvs update ' , checkoutName , ' > ' , cmdOut name.
+('update: ' , cmd) printNL.
+ (OperatingSystem executeCommand:cmd) ifFalse:[
+'failed: ' errorPrint. cmd errorPrintNL.
+ 'CVSMGR: cannot copy-over filedOut class source' errorPrintNL.
+ ^ false.
+ ].
+
+ "/
+ "/ check what happened - the contents of the cmdOut file may be:
+ "/ empty -> nothing changed
+ "/ M xxx -> merged-in changes from other users
+ "/ C xxx -> a conflict occured and the differences have been merged into the source
+ "/ needs special action
+ whatHappened := cmdOut contentsOfEntireFile asString.
+ (whatHappened isNil or:[whatHappened isEmpty]) ifTrue:[
+ "/
+ "/ no change
+ "/
+ self information:'nothing changed'
+ ] ifFalse:[
+ (whatHappened startsWith:'M ') ifTrue:[
+ "/
+ "/ merged in changes
+ "/
+ s := WriteStream on:String new.
+ self writeRevisionLogOf:Array fromRevision:(self revisionAfter:revision) toRevision:nil to:s.
+
+ self information:'The source has been changed in the meanwhile as follows:
+' , (s contents) , '
+I have merged your new changes (based upon rev. ' , revision , ') into the newest revision.
+
+You should update your class from the repository.'
+ ] ifFalse:[
+ (whatHappened startsWith:'C ') ifTrue:[
+ "/
+ "/ conflict
+ "/
+ s := WriteStream on:String new.
+ self writeRevisionLogOf:Array fromRevision:(self revisionAfter:revision) toRevision:nil to:s.
+
+ self information:'The source has been changed in the meanwhile as follows:
+' , (s contents) , '
+Your new changes (based upon rev. ' , revision , ') CONFLICT with those changes - please fix.'
+ 'CVSMGR: cannot (for now) checkin; conflicts found' errorPrintNL.
+ ^ false.
+ ] ifFalse:[
+ "/
+ "/ unexpected
+ "/
+ self information:'unexpected message from CVS:
+' , whatHappened
+ ]
+ ]
+ ].
+].
"/
"/ now check it in again
@@ -206,11 +262,11 @@
^ true
"
- SourceCodeManager checkinClass:Array
+ SourceCodeManager checkinClass:Array logMessage:'testing only'
"
"Created: 6.11.1995 / 18:57:05 / cg"
- "Modified: 16.11.1995 / 13:43:53 / cg"
+ "Modified: 20.11.1995 / 12:58:46 / cg"
!
streamForClass:cls fileName:classFileName revision:revision directory:packageDir module:moduleDir cache:cacheIt
@@ -292,10 +348,10 @@
!CVSSourceCodeManager class methodsFor:'source code administration'!
-writeRevisionLogOf:cls fileName:classFileName directory:packageDir module:moduleDir to:aStream
- "send revisionlog to aStream"
+writeRevisionLogOf:cls fromRevision:rev1 toRevision:rev2 fileName:classFileName directory:packageDir module:moduleDir to:aStream
+ "send (part of) the revisionlog to aStream"
- |file cmd fullName inStream skip atEnd line revLine1 revLine2 idx|
+ |file cmd fullName inStream skip atEnd line revArg revLine1 revLine2 idx|
CVSRoot isNil ifTrue:[
'CVSMGR: CVSROOT not set' infoPrintNL.
@@ -309,7 +365,19 @@
^ false
].
- inStream := PipeStream readingFrom:('rlog ' , file name).
+ revArg := ''.
+ (rev1 notNil or:[rev2 notNil]) ifTrue:[
+ revArg := '-r'.
+ rev1 notNil ifTrue:[
+ revArg := revArg , rev1
+ ].
+ revArg := revArg , ':'.
+ rev2 notNil ifTrue:[
+ revArg := revArg , rev2
+ ]
+ ].
+
+ inStream := PipeStream readingFrom:('rlog ' , revArg , ' ' , file name).
inStream isNil ifTrue:[
('CVSMGR: cannot open pipe to rlog ', file name) infoPrintNL.
^ false
@@ -318,7 +386,9 @@
skip := true.
[skip and:[inStream atEnd not]] whileTrue:[
line:= inStream nextLine.
- (line startsWith:'description:') ifTrue:[skip := false].
+ line notNil ifTrue:[
+ (line startsWith:'description:') ifTrue:[skip := false].
+ ]
].
inStream nextLine. "/ skip separating line.
atEnd := false.
@@ -349,8 +419,15 @@
inStream close.
^ true
+ "
+ SourceCodeManager writeRevisionLogOf:Array to:Transcript
+ SourceCodeManager writeRevisionLogOf:Array fromRevision:'1.40' toRevision:'1.43' to:Transcript
+ SourceCodeManager writeRevisionLogOf:Array fromRevision:'1.40' toRevision:nil to:Transcript
+ SourceCodeManager writeRevisionLogOf:Array fromRevision:nil toRevision:'1.3' to:Transcript
+ "
+
"Created: 16.11.1995 / 13:25:30 / cg"
- "Modified: 16.11.1995 / 13:32:02 / cg"
+ "Modified: 20.11.1995 / 13:42:41 / cg"
! !
CVSSourceCodeManager initialize!
--- a/CVSSourceCodeManager.st Sat Nov 18 18:20:33 1995 +0100
+++ b/CVSSourceCodeManager.st Mon Nov 20 14:19:50 1995 +0100
@@ -83,7 +83,7 @@
!
version
-^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.15 1995-11-18 17:20:33 cg Exp $'! !
+^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.16 1995-11-20 13:19:50 cg Exp $'! !
!CVSSourceCodeManager class methodsFor:'initialization'!
@@ -116,9 +116,10 @@
into the source repository.
Return true if ok, false if not."
- |tempdir dir cmd checkoutName logMsg revision merge|
+ |tempdir dir cmd checkoutName logMsg revision merge cmdOut whatHappened s|
merge := false. "/ for now ....
+merge := true. "/ for now ....
merge ifTrue:[
revision := cls revision.
@@ -133,6 +134,11 @@
logMsg := 'checkin from browser'.
].
+ cmdOut := Filename newTemporary.
+ cmdOut exists ifTrue:[
+ cmdOut remove.
+ ].
+
"/
"/ in CVS, we have to checkout the file first, in order
"/ to get up-to-date CVS entries, and also to be able to merge in
@@ -158,10 +164,11 @@
checkoutName := moduleDir , '/' , packageDir , '/' , classFileName , '.st'.
merge ifTrue:[
- cmd := 'cd ' , tempdir name , ';cvs checkout -r ' revision , ' ', checkoutName.
+ cmd := 'cd ' , tempdir name , ';cvs checkout -r ' , revision , ' ', checkoutName.
] ifFalse:[
cmd := 'cd ' , tempdir name , ';cvs checkout ' , checkoutName.
].
+('checkout: ' , cmd) printNL.
(OperatingSystem executeCommand:cmd) ifFalse:[
'failed: ' errorPrint. cmd errorPrintNL.
@@ -180,17 +187,66 @@
^ false.
].
-"/merge ifTrue:[
-"/ "/
-"/ "/ synchronize i.e. merge in any changes
-"/ "/
-"/ cmd := 'cd ' , tempdir name , ';cvs update ' , checkoutName.
-"/ (OperatingSystem executeCommand:cmd) ifFalse:[
-"/'failed: ' errorPrint. cmd errorPrintNL.
-"/ 'CVSMGR: cannot copy-over filedOut class source' errorPrintNL.
-"/ ^ false.
-"/ ].
-"/].
+merge ifTrue:[
+ "/
+ "/ synchronize i.e. merge in any changes
+ "/
+ cmd := 'cd ' , tempdir name , ';cvs update ' , checkoutName , ' > ' , cmdOut name.
+('update: ' , cmd) printNL.
+ (OperatingSystem executeCommand:cmd) ifFalse:[
+'failed: ' errorPrint. cmd errorPrintNL.
+ 'CVSMGR: cannot copy-over filedOut class source' errorPrintNL.
+ ^ false.
+ ].
+
+ "/
+ "/ check what happened - the contents of the cmdOut file may be:
+ "/ empty -> nothing changed
+ "/ M xxx -> merged-in changes from other users
+ "/ C xxx -> a conflict occured and the differences have been merged into the source
+ "/ needs special action
+ whatHappened := cmdOut contentsOfEntireFile asString.
+ (whatHappened isNil or:[whatHappened isEmpty]) ifTrue:[
+ "/
+ "/ no change
+ "/
+ self information:'nothing changed'
+ ] ifFalse:[
+ (whatHappened startsWith:'M ') ifTrue:[
+ "/
+ "/ merged in changes
+ "/
+ s := WriteStream on:String new.
+ self writeRevisionLogOf:Array fromRevision:(self revisionAfter:revision) toRevision:nil to:s.
+
+ self information:'The source has been changed in the meanwhile as follows:
+' , (s contents) , '
+I have merged your new changes (based upon rev. ' , revision , ') into the newest revision.
+
+You should update your class from the repository.'
+ ] ifFalse:[
+ (whatHappened startsWith:'C ') ifTrue:[
+ "/
+ "/ conflict
+ "/
+ s := WriteStream on:String new.
+ self writeRevisionLogOf:Array fromRevision:(self revisionAfter:revision) toRevision:nil to:s.
+
+ self information:'The source has been changed in the meanwhile as follows:
+' , (s contents) , '
+Your new changes (based upon rev. ' , revision , ') CONFLICT with those changes - please fix.'
+ 'CVSMGR: cannot (for now) checkin; conflicts found' errorPrintNL.
+ ^ false.
+ ] ifFalse:[
+ "/
+ "/ unexpected
+ "/
+ self information:'unexpected message from CVS:
+' , whatHappened
+ ]
+ ]
+ ].
+].
"/
"/ now check it in again
@@ -206,11 +262,11 @@
^ true
"
- SourceCodeManager checkinClass:Array
+ SourceCodeManager checkinClass:Array logMessage:'testing only'
"
"Created: 6.11.1995 / 18:57:05 / cg"
- "Modified: 16.11.1995 / 13:43:53 / cg"
+ "Modified: 20.11.1995 / 12:58:46 / cg"
!
streamForClass:cls fileName:classFileName revision:revision directory:packageDir module:moduleDir cache:cacheIt
@@ -292,10 +348,10 @@
!CVSSourceCodeManager class methodsFor:'source code administration'!
-writeRevisionLogOf:cls fileName:classFileName directory:packageDir module:moduleDir to:aStream
- "send revisionlog to aStream"
+writeRevisionLogOf:cls fromRevision:rev1 toRevision:rev2 fileName:classFileName directory:packageDir module:moduleDir to:aStream
+ "send (part of) the revisionlog to aStream"
- |file cmd fullName inStream skip atEnd line revLine1 revLine2 idx|
+ |file cmd fullName inStream skip atEnd line revArg revLine1 revLine2 idx|
CVSRoot isNil ifTrue:[
'CVSMGR: CVSROOT not set' infoPrintNL.
@@ -309,7 +365,19 @@
^ false
].
- inStream := PipeStream readingFrom:('rlog ' , file name).
+ revArg := ''.
+ (rev1 notNil or:[rev2 notNil]) ifTrue:[
+ revArg := '-r'.
+ rev1 notNil ifTrue:[
+ revArg := revArg , rev1
+ ].
+ revArg := revArg , ':'.
+ rev2 notNil ifTrue:[
+ revArg := revArg , rev2
+ ]
+ ].
+
+ inStream := PipeStream readingFrom:('rlog ' , revArg , ' ' , file name).
inStream isNil ifTrue:[
('CVSMGR: cannot open pipe to rlog ', file name) infoPrintNL.
^ false
@@ -318,7 +386,9 @@
skip := true.
[skip and:[inStream atEnd not]] whileTrue:[
line:= inStream nextLine.
- (line startsWith:'description:') ifTrue:[skip := false].
+ line notNil ifTrue:[
+ (line startsWith:'description:') ifTrue:[skip := false].
+ ]
].
inStream nextLine. "/ skip separating line.
atEnd := false.
@@ -349,8 +419,15 @@
inStream close.
^ true
+ "
+ SourceCodeManager writeRevisionLogOf:Array to:Transcript
+ SourceCodeManager writeRevisionLogOf:Array fromRevision:'1.40' toRevision:'1.43' to:Transcript
+ SourceCodeManager writeRevisionLogOf:Array fromRevision:'1.40' toRevision:nil to:Transcript
+ SourceCodeManager writeRevisionLogOf:Array fromRevision:nil toRevision:'1.3' to:Transcript
+ "
+
"Created: 16.11.1995 / 13:25:30 / cg"
- "Modified: 16.11.1995 / 13:32:02 / cg"
+ "Modified: 20.11.1995 / 13:42:41 / cg"
! !
CVSSourceCodeManager initialize!