--- a/CVSSourceCodeManager.st Tue May 07 20:24:34 2013 +0200
+++ b/CVSSourceCodeManager.st Tue May 07 20:34:47 2013 +0200
@@ -2058,86 +2058,80 @@
('no tempDir - cannot checkin ' , className) errorPrintCR.
^ false
].
-
- "/
- "/ next, create CVS/Entries and CVS/Repository with version information of current version
- "/
- modulePath := moduleDir , '/' , packageDir.
- checkoutName := modulePath , '/' , classFileName.
-
- "/
- "/ correct our current time, so that converting it will give us UTC
- "/
- time := Timestamp now asUtcTimestamp subtractSeconds:1.
-
- self createEntryFor:checkoutName
- module:moduleDir
- in:(tempdir construct:modulePath)
- revision:revision
- date:(self cvsTimeString:time)
- special:''
- overwrite:true.
-
- "/
- "/ copy-over our current version
- "/
- Error handle:[:ex|
- tempdir recursiveRemove.
- self reportError:'cannot copy-over filedOut class source'.
- ^ false.
- ] do:[
- sourceFileName asFilename copyTo:(tempdir construct:checkoutName).
- ].
-
- "/
- "/ synchronize i.e. merge in any changes
- "/
- self activityNotification:'merging ' , cls name , ' with repository version...'.
-
- cmd := 'update %1 %2 >"%3"'
- bindWith:CVSUpdateOptions
- with:classFileName
- with:cmdOut name.
-
- (self
- executeCVSCommand:cmd
- module:moduleDir
- inDirectory:((tempdir construct:moduleDir) constructString:packageDir)
- ) ifFalse:[
- force ifFalse:[
- cmdOut remove.
-
- (self checkForExistingContainer:classFileName inModule:moduleDir directory:packageDir) ifFalse:[
- "/ no container
- "/ someone fiddled around with repository ?
- (cls binaryRevision notNil) ifTrue:[
- (Dialog confirm:('Someone seems to have removed the source container for ',cls name,'\\Force new checkin ?') withCRs)
- ifTrue:[
- tempdir recursiveRemove.
- cls setBinaryRevision:nil.
- ^ self checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir source:sourceFileName logMessage:logMsg force:force.
+ [
+ "/
+ "/ next, create CVS/Entries and CVS/Repository with version information of current version
+ "/
+ modulePath := moduleDir , '/' , packageDir.
+ checkoutName := modulePath , '/' , classFileName.
+
+ "/
+ "/ correct our current time, so that converting it will give us UTC
+ "/
+ time := Timestamp now asUtcTimestamp subtractSeconds:1.
+
+ self createEntryFor:checkoutName
+ module:moduleDir
+ in:(tempdir construct:modulePath)
+ revision:revision
+ date:(self cvsTimeString:time)
+ special:''
+ overwrite:true.
+
+ "/
+ "/ copy-over our current version
+ "/
+ Error handle:[:ex|
+ self reportError:'cannot copy-over filedOut class source'.
+ ^ false.
+ ] do:[
+ sourceFileName asFilename copyTo:(tempdir construct:checkoutName).
+ ].
+
+ "/
+ "/ synchronize i.e. merge in any changes
+ "/
+ self activityNotification:'merging ' , cls name , ' with repository version...'.
+
+ cmd := 'update %1 %2 >"%3"'
+ bindWith:CVSUpdateOptions
+ with:classFileName
+ with:cmdOut name.
+
+ (self
+ executeCVSCommand:cmd
+ module:moduleDir
+ inDirectory:((tempdir construct:moduleDir) constructString:packageDir)
+ ) ifFalse:[
+ force ifFalse:[
+ (self checkForExistingContainer:classFileName inModule:moduleDir directory:packageDir) ifFalse:[
+ "/ no container
+ "/ someone fiddled around with repository ?
+ (cls binaryRevision notNil) ifTrue:[
+ (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.
+ ].
+ ].
+ (Dialog confirm:('There seems to be no source container for "%1"\(Either the source container was removed,\or your per-module repository setting is wrong,\or the CVS server is unreachable).\\Proceed?' bindWith:cls name allBold) withCRs)
+ ifFalse:[
+ ^ false
].
].
- (Dialog confirm:('There seems to be no source container for "%1"\(Either the source container was removed,\or your per-module repository setting is wrong,\or the CVS server is unreachable).\\Proceed?' bindWith:cls name allBold) withCRs)
- ifFalse:[
- tempdir recursiveRemove.
- ^ false
+
+ "/ is the version correct ?
+ newestRevision isNil ifTrue:[
+ newestRevision := self newestRevisionOf:cls.
+ newestRevision isNil ifTrue:[
+ (Dialog confirm:('The source container for ',cls name allBold,' seems corrupted. Proceed?' withCRs)) ifFalse:[
+ ^ false
+ ].
+ ^ self
+ checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir
+ source:sourceFileName logMessage:logMessage force:true.
+ ].
].
- ].
-
- "/ is the version correct ?
- newestRevision isNil ifTrue:[
- newestRevision := self newestRevisionOf:cls.
- newestRevision isNil ifTrue:[
- (Dialog confirm:('The source container for ',cls name allBold,' seems corrupted. Proceed?' withCRs)) ifFalse:[
- tempdir recursiveRemove.
- ^ false
- ].
- ^ self
- checkinClass:cls fileName:classFileName directory:packageDir module:moduleDir
- source:sourceFileName logMessage:logMessage force:true.
- ].
- ].
"/ revision > newestRevision ifTrue:[
"/ true "/ (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:[
@@ -2149,31 +2143,29 @@
"/
"/ self reportError:('cannot merge current source with repository version (failed to execute: ',cmd,')').
"/ ^ false.
- "/ if we arrive here, proceed as if merged
- whatHappened := 'M initial'
+ "/ if we arrive here, proceed as if merged
+ whatHappened := 'M initial'
+ ].
+ ] ifTrue:[
+ "/
+ "/ 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
+ "/
+ (cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[
+ whatHappened := cmdOut contentsOfEntireFile asString.
+ ].
].
- ] ifTrue:[
- "/
- "/ 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
- "/
- (cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[
- whatHappened := cmdOut contentsOfEntireFile asString.
- ].
- ].
- cmdOut remove.
-
- (whatHappened isEmptyOrNil) ifTrue:[
- "/
- "/ no change
- "/
+
+ (whatHappened isEmptyOrNil) ifTrue:[
+ "/
+ "/ no change
+ "/
"/ Transcript showCR:'no change in ' , className , ' (repository unchanged)'.
- tempdir recursiveRemove.
-
- force ifFalse:[
+
+ force ifFalse:[
"/ (ChangeSet current includesChangeForClass:cls) ifTrue:[
"/ (self confirm:('Nothing changed in %1 (repository unchanged).\\Remove entries from changeSet ?' bindWith:className) withCRs) ifTrue:[
"/ ChangeSet current condenseChangesForClass:cls.
@@ -2181,103 +2173,103 @@
"/ ] ifFalse:[
"/ self information:('Nothing changed in %1 (repository unchanged)' bindWith:className).
"/ ].
- self postCheckInClass:cls.
- ] ifTrue:[
- changeLog := self revisionLogOfContainer:classFileName directory:packageDir module:moduleDir.
- (changeLog isNil or:[(changeLog at:#revisions) size ~~ 1]) ifTrue:[
- 'CVSSourceCodeManager [error]: failed to update revisionString (no log)' errorPrintCR.
- self updateVersionMethodOf:cls for:'$' , 'Header' , '$'. "/ concatenated to avoid RCS expansion
- ] ifFalse:[
- entry := (changeLog at:#revisions) first.
- newString := self revisionStringFromLog:changeLog entry:entry forClass:cls.
- self updateVersionMethodOf:cls for:newString.
- cls revision ~= newRevision ifTrue:[
- 'CVSSourceCodeManager [error]: failed to update revisionString' errorPrintCR
+ self postCheckInClass:cls.
+ ] ifTrue:[
+ changeLog := self revisionLogOfContainer:classFileName directory:packageDir module:moduleDir.
+ (changeLog isNil or:[(changeLog at:#revisions) size ~~ 1]) ifTrue:[
+ 'CVSSourceCodeManager [error]: failed to update revisionString (no log)' errorPrintCR.
+ self updateVersionMethodOf:cls for:'$' , 'Header' , '$'. "/ concatenated to avoid RCS expansion
] ifFalse:[
- ('CVSSourceCodeManager [info]: updated revisionString to:',newString) infoPrintCR
+ entry := (changeLog at:#revisions) first.
+ newString := self revisionStringFromLog:changeLog entry:entry forClass:cls.
+ self updateVersionMethodOf:cls for:newString.
+ cls revision ~= newRevision ifTrue:[
+ 'CVSSourceCodeManager [error]: failed to update revisionString' errorPrintCR
+ ] ifFalse:[
+ ('CVSSourceCodeManager [info]: updated revisionString to:',newString) infoPrintCR
+ ]
]
- ]
+ ].
+
+ ^ true
].
-
- ^ true
- ].
- Verbose == true ifTrue:[
- ('CVSMGR: result is: ' , whatHappened) infoPrintCR.
- ].
-
- force ifFalse:[
- revision isNil ifTrue:[
- changeLog := self revisionLogOf:cls.
- ] ifFalse:[
- changeLog := self revisionLogOf:cls fromRevision:(self revisionAfter:revision) toRevision:nil.
+ Verbose == true ifTrue:[
+ ('CVSMGR: result is: ' , whatHappened) infoPrintCR.
].
- changeLog notNil ifTrue:[
- s := WriteStream on:String new.
- self writeRevisionLogMessagesFrom:changeLog withHeader:false to:s.
- changesAsLogged := s contents.
- ] ifFalse:[
- "/ mhmh - that should not happen
- changesAsLogged := ''.
+
+ force ifFalse:[
+ revision isNil ifTrue:[
+ changeLog := self revisionLogOf:cls.
+ ] ifFalse:[
+ changeLog := self revisionLogOf:cls fromRevision:(self revisionAfter:revision) toRevision:nil.
+ ].
+ changeLog notNil ifTrue:[
+ s := WriteStream on:String new.
+ self writeRevisionLogMessagesFrom:changeLog withHeader:false to:s.
+ changesAsLogged := s contents.
+ ] ifFalse:[
+ "/ mhmh - that should not happen
+ changesAsLogged := ''.
+ ].
].
- ].
-
- didMerge := false.
- conflictResolvedManually := checkInRepaired := checkInNew := false.
-
- "/
- "/ cvs above rel10 returns a multiline info ...
- "/ we have to extract the one line which states what happened.
- "/
- whatHappened := whatHappened asCollectionOfLines asStringCollection.
- whatHappened := whatHappened select:[:line |
- (line startsWith:'RCS file') not
- and:[(line startsWith:'retrieving') not
- and:[(line startsWith:'Merging') not
- and:[line size > 0]]]
- ].
- whatHappened := whatHappened asString.
-
- (force or:[(whatHappened startsWith:'M ') or:[whatHappened startsWith:'A ']]) ifTrue:[
+
+ didMerge := false.
+ conflictResolvedManually := checkInRepaired := checkInNew := false.
+
"/
- "/ merged in changes / resurrected
+ "/ cvs above rel10 returns a multiline info ...
+ "/ we have to extract the one line which states what happened.
"/
- (force
- or:[changeLog isNil
- or:[(changeLog at:#revisions ifAbsent:nil) isEmptyOrNil]]) ifTrue:[
+ whatHappened := whatHappened asCollectionOfLines asStringCollection.
+ whatHappened := whatHappened select:[:line |
+ (line startsWith:'RCS file') not
+ and:[(line startsWith:'retrieving') not
+ and:[(line startsWith:'Merging') not
+ and:[line size > 0]]]
+ ].
+ whatHappened := whatHappened asString.
+
+ (force or:[(whatHappened startsWith:'M ') or:[whatHappened startsWith:'A ']]) ifTrue:[
"/
- "/ pretty good - nothing has changed in the meanwhile
- "/
- Transcript showCR:('checking in %1 (%2)...' bindWith:className with:modulePath).
- ] ifFalse:[
- |mySource mergedSource |
-
+ "/ merged in changes / resurrected
"/
- "/ someone else has changed things in the meanwhile, but there is no conflict
- "/ and version have been merged.
- "/
- didMerge := true.
- changesAsLogged := changesAsLogged asCollectionOfLines.
-
- s := WriteStream on:String new.
- self fileOutSourceCodeOf: cls on:s.
- mySource := s contents asString.
- mergedSource := (tempdir construct:checkoutName) readStream contents asString.
-
- mySource = mergedSource ifTrue:[
- msg := 'The source of ' , className , ' has been changed in the meanwhile as listed below.
+ (force
+ or:[changeLog isNil
+ or:[(changeLog at:#revisions ifAbsent:nil) isEmptyOrNil]]) ifTrue:[
+ "/
+ "/ pretty good - nothing has changed in the meanwhile
+ "/
+ Transcript showCR:('checking in %1 (%2)...' bindWith:className with:modulePath).
+ ] ifFalse:[
+ |mySource mergedSource |
+
+ "/
+ "/ someone else has changed things in the meanwhile, but there is no conflict
+ "/ and version have been merged.
+ "/
+ didMerge := true.
+ changesAsLogged := changesAsLogged asCollectionOfLines.
+
+ s := WriteStream on:String new.
+ self fileOutSourceCodeOf: cls on:s.
+ mySource := s contents asString.
+ mergedSource := (tempdir construct:checkoutName) readStream contents asString.
+
+ mySource = mergedSource ifTrue:[
+ msg := 'The source of ' , className , ' has been changed in the meanwhile as listed below.
I have merged your version with the newest repository version,
and found no differences between the result and your current version
(i.e. your version seemed up-to-date).'.
- self checkinTroubleDialog:'Merging versions'
- message:msg
- log:changesAsLogged
- abortable:false
- option:nil.
- didMerge := false.
- ] ifFalse:[
- msg := 'The source of ' , className , ' has been changed in the meanwhile as listed below.
+ self checkinTroubleDialog:'Merging versions'
+ message:msg
+ log:changesAsLogged
+ abortable:false
+ option:nil.
+ didMerge := false.
+ ] ifFalse:[
+ msg := 'The source of ' , className , ' has been changed in the meanwhile as listed below.
If you continue, your new changes (based upon rev. ' , revision printString , ') will be MERGED
into the newest revision. This will combine the other version with your changes
@@ -2292,38 +2284,37 @@
Continue ?'.
- answer := self checkinTroubleDialog:'Merging versions'
- message:msg
- log:changesAsLogged
- abortable:true
- option:'Stop - see first'
- option2:'Do NOT Merge - Force my Code'.
-
- answer == #option2 ifTrue:[
- (Dialog confirm:'Are you certain that you want to suppress a merge and force your code to be checked in ?')
- ifTrue:[
- s := (tempdir construct:checkoutName) writeStream.
- self fileOutSourceCodeOf: cls on:s.
- s close.
- answer := true.
- ]
+ answer := self checkinTroubleDialog:'Merging versions'
+ message:msg
+ log:changesAsLogged
+ abortable:true
+ option:'Stop - see first'
+ option2:'Do NOT Merge - Force my Code'.
+
+ answer == #option2 ifTrue:[
+ (Dialog confirm:'Are you certain that you want to suppress a merge and force your code to be checked in ?')
+ ifTrue:[
+ s := (tempdir construct:checkoutName) writeStream.
+ self fileOutSourceCodeOf: cls on:s.
+ s close.
+ answer := true.
+ ]
+ ].
+
+ answer ~~ true ifTrue:[
+ answer == #option ifTrue:[
+ DiffCodeView
+ openOn:mySource
+ label:'current version'
+ and:mergedSource
+ label:'merged version'.
+
+ ].
+ self reportError:'checkin aborted - (no merge; repository unchanged)'.
+ ^ false.
+ ].
].
- answer ~~ true ifTrue:[
- answer == #option ifTrue:[
- DiffCodeView
- openOn:mySource
- label:'current version'
- and:mergedSource
- label:'merged version'.
-
- ].
- tempdir recursiveRemove.
- self reportError:'checkin aborted - (no merge; repository unchanged)'.
- ^ false.
- ].
- ].
-
"/ changesAsLogged := (changesAsLogged asStringCollection collect:[:line | line withTabsExpanded]) asString.
"/ msg := 'The source of ' , className , ' has been changed in the meanwhile as follows:
"/' , changesAsLogged , '
@@ -2341,21 +2332,20 @@
"/Continue ?'.
"/ (self confirm:msg) ifFalse:[
"/ Transcript showCR:'checkin aborted - (no merge; repository unchanged)'.
-"/ tempdir recursiveRemove.
"/ ^ false.
"/ ].
- Transcript showCR:('checking in %1 (%2) (merge)...' bindWith:className with:modulePath).
- ]
- ] ifFalse:[
- (whatHappened startsWith:'C ') ifTrue:[
- "/
- "/ conflict; someone else checked in something in the meanwhile,
- "/ and there is a conflict between this version and the checked in version.
- "/
-
- changesAsLogged := changesAsLogged asCollectionOfLines.
-
- msg := 'The source of ' , className , ' has been changed in the meanwhile as listed below.
+ Transcript showCR:('checking in %1 (%2) (merge)...' bindWith:className with:modulePath).
+ ]
+ ] ifFalse:[
+ (whatHappened startsWith:'C ') ifTrue:[
+ "/
+ "/ conflict; someone else checked in something in the meanwhile,
+ "/ and there is a conflict between this version and the checked in version.
+ "/
+
+ changesAsLogged := changesAsLogged asCollectionOfLines.
+
+ msg := 'The source of ' , className , ' has been changed in the meanwhile as listed below.
Your new changes (based upon rev. ' , revision printString , ') CONFLICT with those changes.
@@ -2363,46 +2353,46 @@
and change your methods avoiding conflicts. Then checkin again.
'.
- answer := self checkinTroubleDialog:'Version conflict'
- message:msg
- log:changesAsLogged
- abortable:false
- option:'Show conflicts'
- option2:'Resolve conflicts'
- option3:'Do NOT Merge - Force my Code'.
-
- answer == #option ifTrue:[
- "/
- "/ show conflicts in a 3-way DiffTextView ...
- "/
- Diff3TextView
- openOnMergedText:(tempdir construct:checkoutName) readStream contents
- label:'your version (checkin attempt)'
- label:'original (base version)'
- label:'newest repository version'.
- ].
-
- answer == #option2 ifTrue:[
- "/
- "/ allow checkin of repair version
- "/ this is error prone ...
- "/
- "/
- "/ show merged version in an editor ...
- "/ ... accept will check it in.
- "/
- emphasizedText := (tempdir construct:checkoutName) readStream contents.
- emSep := (Array with:(#color->Color black)
- with:(#backgroundColor->Color green)).
- emphasizedText := Diff3TextView
- emphasizeMergedDiff3Text:emphasizedText
- emphasize1:(Array with:(#color->Color white)
- with:(#backgroundColor->Color blue))
- emphasize2:(Array with:(#color->Color white)
- with:(#backgroundColor->Color red))
- emphasizeSep:emSep.
-
- comment :=
+ answer := self checkinTroubleDialog:'Version conflict'
+ message:msg
+ log:changesAsLogged
+ abortable:false
+ option:'Show conflicts'
+ option2:'Resolve conflicts'
+ option3:'Do NOT Merge - Force my Code'.
+
+ answer == #option ifTrue:[
+ "/
+ "/ show conflicts in a 3-way DiffTextView ...
+ "/
+ Diff3TextView
+ openOnMergedText:(tempdir construct:checkoutName) readStream contents
+ label:'your version (checkin attempt)'
+ label:'original (base version)'
+ label:'newest repository version'.
+ ].
+
+ answer == #option2 ifTrue:[
+ "/
+ "/ allow checkin of repair version
+ "/ this is error prone ...
+ "/
+ "/
+ "/ show merged version in an editor ...
+ "/ ... accept will check it in.
+ "/
+ emphasizedText := (tempdir construct:checkoutName) readStream contents.
+ emSep := (Array with:(#color->Color black)
+ with:(#backgroundColor->Color green)).
+ emphasizedText := Diff3TextView
+ emphasizeMergedDiff3Text:emphasizedText
+ emphasize1:(Array with:(#color->Color white)
+ with:(#backgroundColor->Color blue))
+ emphasize2:(Array with:(#color->Color white)
+ with:(#backgroundColor->Color red))
+ emphasizeSep:emSep.
+
+ comment :=
'"/ ***************************************************************
"/ This text contains your current versions code (blue)
"/ merged with the conflicting code as found in the repository (red) which resulted
@@ -2414,163 +2404,159 @@
"/ unless no more green parts are present. This includes this comment at the top.
"/ ***************************************************************
'.
- comment := (Text string:comment emphasis:emSep) asStringCollection.
- emphasizedText := comment , emphasizedText.
-
- didAccept := false. checkInRepaired := true.
- [didAccept not and:[checkInRepaired]] whileTrue:[
- editor := RCSConflictEditTextView
- setupWith:emphasizedText
- title:'Resolve conflicts in ' , className , ', then accept & close to checkin'.
-
- editor acceptAction:[:dummy |
- repairedText := editor list.
- didAccept := true.
+ comment := (Text string:comment emphasis:emSep) asStringCollection.
+ emphasizedText := comment , emphasizedText.
+
+ didAccept := false. checkInRepaired := true.
+ [didAccept not and:[checkInRepaired]] whileTrue:[
+ editor := RCSConflictEditTextView
+ setupWith:emphasizedText
+ title:'Resolve conflicts in ' , className , ', then accept & close to checkin'.
+
+ editor acceptAction:[:dummy |
+ repairedText := editor list.
+ didAccept := true.
+ ].
+ didAccept := false.
+ editor topView openModal.
+
+ didAccept ifFalse:[
+ (Dialog confirm:'You did not accept the new text. Edit again ?')
+ ifFalse:[
+ checkInRepaired := false.
+ ]
+ ] ifTrue:[
+ "/ check if all green-stuff (separators) have been removed
+ (repairedText findFirst:[:line | line notNil and:[line notEmpty and:[(line emphasisAt:1) = emSep]]]) ~~ 0 ifTrue:[
+ self warn:'You have to look at ALL conflicts, and remove ALL green lines as a confirmation !!'.
+ didAccept := false.
+ ]
+ ].
+
].
- didAccept := false.
- editor topView openModal.
-
- didAccept ifFalse:[
- (Dialog confirm:'You did not accept the new text. Edit again ?')
- ifFalse:[
+
+ checkInRepaired ifTrue:[
+ [
+ out := (tempdir construct:checkoutName) writeStream.
+ out nextPutAll:(repairedText asString string).
+ didAccept := true.
+ out close.
+ ] on:FileStream openErrorSignal do:[:ex|
+ self warn:'could not write file ' , (tempdir constructString:checkoutName).
checkInRepaired := false.
- ]
- ] ifTrue:[
- "/ check if all green-stuff (separators) have been removed
- (repairedText findFirst:[:line | line notNil and:[line notEmpty and:[(line emphasisAt:1) = emSep]]]) ~~ 0 ifTrue:[
- self warn:'You have to look at ALL conflicts, and remove ALL green lines as a confirmation !!'.
- didAccept := false.
- ]
+ ].
+ ]
+ ].
+
+ answer == #option3 ifTrue:[
+ "/
+ "/ force checkin of new version
+ "/
+ "/
+ "/ show merged version in an editor ...
+ "/ ... accept will check it in.
+ "/
+ [
+ out := (tempdir construct:checkoutName) writeStream.
+ self fileOutSourceCodeOf: cls on:out.
+ out close.
+ didAccept := true.
+ checkInNew := checkInRepaired := true.
+ ] on:FileStream openErrorSignal do:[:ex|
+ self warn:'could not write file ' , (tempdir constructString:checkoutName).
].
-
].
checkInRepaired ifTrue:[
- [
- out := (tempdir construct:checkoutName) writeStream.
- out nextPutAll:(repairedText asString string).
- didAccept := true.
- out close.
- ] on:FileStream openErrorSignal do:[:ex|
- self warn:'could not write file ' , (tempdir constructString:checkoutName).
- checkInRepaired := false.
+ checkInNew ifTrue:[
+ Transcript showCR:('checking in %1 (%2) (force)...' bindWith:className with:modulePath).
+ ] ifFalse:[
+ conflictResolvedManually := true. "/ checkInRepaired and:[checkInNew not].
+ Transcript showCR:('checking in %1 (%2) (manually repaired)...' bindWith:className with:modulePath).
].
- ]
- ].
-
- answer == #option3 ifTrue:[
- "/
- "/ force checkin of new version
- "/
- "/
- "/ show merged version in an editor ...
- "/ ... accept will check it in.
- "/
- [
- out := (tempdir construct:checkoutName) writeStream.
- self fileOutSourceCodeOf: cls on:out.
- out close.
- didAccept := true.
- checkInNew := checkInRepaired := true.
- ] on:FileStream openErrorSignal do:[:ex|
- self warn:'could not write file ' , (tempdir constructString:checkoutName).
- ].
- ].
-
- checkInRepaired ifTrue:[
- checkInNew ifTrue:[
- Transcript showCR:('checking in %1 (%2) (force)...' bindWith:className with:modulePath).
] ifFalse:[
- conflictResolvedManually := true. "/ checkInRepaired and:[checkInNew not].
- Transcript showCR:('checking in %1 (%2) (manually repaired)...' bindWith:className with:modulePath).
+ Transcript showCR:'checkin of ' , className , ' aborted (conflicting changes; repository unchanged)'.
+ self reportError:'checkin of ' , className , ' aborted (conflicting changes; repository unchanged)'.
+ ^ false.
].
] ifFalse:[
- Transcript showCR:'checkin of ' , className , ' aborted (conflicting changes; repository unchanged)'.
- tempdir recursiveRemove.
- self reportError:'checkin of ' , className , ' aborted (conflicting changes; repository unchanged)'.
- ^ false.
- ].
- ] ifFalse:[
- ((whatHappened startsWith:'U ')
- or:[ (whatHappened startsWith:'P ') ]) ifTrue:[
- "/
- "/ nothing changed here, but the repository already contains
- "/ a newer version.
- "/
- tempdir recursiveRemove.
-
- self information:'nothing changed in your ''' , className , ''';
+ ((whatHappened startsWith:'U ')
+ or:[ (whatHappened startsWith:'P ') ]) ifTrue:[
+ "/
+ "/ nothing changed here, but the repository already contains
+ "/ a newer version.
+ "/
+
+ self information:'nothing changed in your ''' , className , ''';
but repository already contains a newer version (repository unchanged).'.
- ^ true.
- ] ifFalse:[
- "/
- "/ unexpected
- "/
- self warn:'unexpected message from CVS:
+ ^ true.
+ ] ifFalse:[
+ "/
+ "/ unexpected
+ "/
+ self warn:'unexpected message from CVS:
' , whatHappened , '
No checkin performed.'.
- tempdir recursiveRemove.
- self reportError:'*** cannot checkin ' , className , ' (unexpected CVS response; repository unchanged)'.
- ^ false.
+ self reportError:'*** cannot checkin ' , className , ' (unexpected CVS response; repository unchanged)'.
+ ^ false.
+ ]
]
- ]
- ].
-
-
- "/
- "/ now check it in again
- "/
- self activityNotification:'saving ' , cls name , ' in repository...'.
-
- logMsg := logMsg replChar:$" withString:'\"'.
-
- OperatingSystem isUNIXlike ifFalse:[
- "/ save the log message into another tempFile ...
- logTmp := Filename newTemporaryIn:tempdir.
- s := logTmp writeStream.
- s nextPutAll:logMsg.
- s close.
-
- cmd := 'commit -F "', logTmp baseName, '" ', checkoutName, ' >', '"' , cmdOut name , '"'.
- ] ifTrue:[
+ ].
+
+
+ "/
+ "/ now check it in again
"/
- "/ CVS up to V1.9.14 prints the 'new revision' to stderr,
- "/ CVS V1.9.16 to stdout.
- "/
- cmd := 'commit -m "', logMsg, '" ', checkoutName, ' >', '"', cmdOut name, '"' , ' 2>&1'.
- ].
- (self
- executeCVSCommand:cmd
- module:moduleDir
- inDirectory:tempdir name
- ) ifFalse:[
- (cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[
- whatHappened := cmdOut contentsOfEntireFile asString.
- ] ifFalse:[
- whatHappened := '<< no message >>'
+ self activityNotification:'saving ' , cls name , ' in repository...'.
+
+ logMsg := logMsg replChar:$" withString:'\"'.
+
+ OperatingSystem isUNIXlike ifFalse:[
+ "/ save the log message into another tempFile ...
+ logTmp := Filename newTemporaryIn:tempdir.
+ s := logTmp writeStream.
+ s nextPutAll:logMsg.
+ s close.
+
+ cmd := 'commit -F "', logTmp baseName, '" ', checkoutName, ' >', '"' , cmdOut name , '"'.
+ ] ifTrue:[
+ "/
+ "/ CVS up to V1.9.14 prints the 'new revision' to stderr,
+ "/ CVS V1.9.16 to stdout.
+ "/
+ cmd := 'commit -m "', logMsg, '" ', checkoutName, ' >', '"', cmdOut name, '"' , ' 2>&1'.
].
- self warn:'The following problem was reported by cvs:
+ (self
+ executeCVSCommand:cmd
+ module:moduleDir
+ inDirectory:tempdir name
+ ) ifFalse:[
+ (cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[
+ whatHappened := cmdOut contentsOfEntireFile asString.
+ ] ifFalse:[
+ whatHappened := '<< no message >>'
+ ].
+ self warn:'The following problem was reported by cvs:
' , whatHappened , '
The class has NOT been checked into the repository.'.
+ logTmp notNil ifTrue:[logTmp remove].
+ self reportError:'cannot checkin modified class source'.
+ ^ false.
+ ].
logTmp notNil ifTrue:[logTmp remove].
- cmdOut remove.
- tempdir recursiveRemove.
- self reportError:'cannot checkin modified class source'.
- ^ false.
+ (cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[
+ whatHappened := cmdOut contentsOfEntireFile asString.
+ ] ifFalse:[
+ whatHappened := nil
+ ].
+ ] ensure:[
+ tempdir notNil ifTrue:[ tempdir recursiveRemove ].
+ cmdOut notNil ifTrue:[ cmdOut remove ].
].
- logTmp notNil ifTrue:[logTmp remove].
- (cmdOut exists and:[cmdOut fileSize > 0]) ifTrue:[
- whatHappened := cmdOut contentsOfEntireFile asString.
- ] ifFalse:[
- whatHappened := nil
- ].
-
- tempdir recursiveRemove.
- cmdOut remove.
"/
"/ fetch the new revision nr as found in the commit commands output
@@ -2677,41 +2663,34 @@
self activityNotification:'Checking out everything in ' , dirName , '...'.
tempdir := self createTempDirectory:nil forModule:nil.
-
- cmd := 'checkout ', dirName.
- OperatingSystem isUNIXlike ifTrue:[
- "/ can redirect output
- cmdOut := Filename newTemporary.
- cmdOut exists ifTrue:[
- cmdOut remove.
+ [
+ cmd := 'checkout ', dirName.
+ OperatingSystem isUNIXlike ifTrue:[
+ "/ can redirect output
+ cmdOut := Filename newTemporary.
+ cmdOut exists ifTrue:[
+ cmdOut remove.
+ ].
+ cmd := cmd , ' > ', '"' , cmdOut name, '"' .
].
- cmd := cmd , ' > ', '"' , cmdOut name, '"' .
- ].
-
- rslt := self
- executeCVSCommand:cmd
- module:aModule
- inDirectory:tempdir name.
-
- cmdOut notNil ifTrue:[
-"/ listOfFiles := cmdOut contents.
- cmdOut remove
- ].
-
- packageDir := (tempdir construct:dirName).
- (packageDir exists and:[packageDir isDirectory]) ifFalse:[
- tempdir recursiveRemove.
- self reportError:(rslt ifTrue:['checkout failed (no dir)'] ifFalse:['failed to execute: ',cmd]).
- ^ false
- ].
-
- "/ now, invoke the block ...
- [
+
+ rslt := self
+ executeCVSCommand:cmd
+ module:aModule
+ inDirectory:tempdir name.
+
+ packageDir := (tempdir construct:dirName).
+ (packageDir exists and:[packageDir isDirectory]) ifFalse:[
+ self reportError:(rslt ifTrue:['checkout failed (no dir)'] ifFalse:['failed to execute: ',cmd]).
+ ^ false
+ ].
+
+ "/ now, invoke the block ...
aBlock value:packageDir
] ensure:[
- tempdir recursiveRemove.
+ cmdOut notNil ifTrue:[ cmdOut remove ].
+ tempdir notNil ifTrue:[ tempdir recursiveRemove ].
].
-
^ true
"Created: / 23-08-2006 / 14:07:05 / cg"
@@ -2793,7 +2772,7 @@
('CVSSourceCodeManager [error]: no tempDir - cannot checkout ' , classFileName) errorPrintCR.
^ nil
].
-
+ [
"/ tempdir := Filename newTemporaryIn:nil.
"/ tempdir exists ifTrue:[
"/ tempdir recursiveRemove.
@@ -2809,43 +2788,41 @@
"/ ^ nil.
"/ ].
- "/
- "/ check it out there
- "/
- checkoutName := fullName.
-
- checkoutNameLocal := (moduleDir asFilename construct:packageDir) constructString:(fullName asFilename baseName).
-
- (revision isNil or:[revision == #newest]) ifTrue:[
- cachedSourceFilename := classFileName.
- revisionArg := ''.
- revMsg := ''.
- ] ifFalse:[
- cachedSourceFilename := classFileName , '_' , revision.
- revisionArg := ' -r ' , revision.
- revMsg := ' (' , revision , ')'.
- ].
-
- self activityNotification:'Checking out source ' , checkoutName , revMsg.
- OperatingSystem isUNIXlike ifTrue:[
- "/ can redirect output
- cmdOut := Filename newTemporary.
- cmdOut exists ifTrue:[
- cmdOut remove.
+ "/
+ "/ check it out there
+ "/
+ checkoutName := fullName.
+
+ checkoutNameLocal := (moduleDir asFilename construct:packageDir) constructString:(fullName asFilename baseName).
+
+ (revision isNil or:[revision == #newest]) ifTrue:[
+ cachedSourceFilename := classFileName.
+ revisionArg := ''.
+ revMsg := ''.
+ ] ifFalse:[
+ cachedSourceFilename := classFileName , '_' , revision.
+ revisionArg := ' -r ' , revision.
+ revMsg := ' (' , revision , ')'.
].
- cmd := 'checkout' , revisionArg , ' ', checkoutName , ' > ' , '"' , cmdOut name, '"' .
- ] ifFalse:[
- cmd := 'checkout' , revisionArg , ' ', checkoutName.
- ].
-
- (self
- executeCVSCommand:cmd
- module:moduleDir
- inDirectory:tempdir name
- ) ifFalse:[
- cmdOut notNil ifTrue:[cmdOut remove].
- tempdir recursiveRemove.
- ('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR.
+
+ self activityNotification:'Checking out source ' , checkoutName , revMsg.
+ OperatingSystem isUNIXlike ifTrue:[
+ "/ can redirect output
+ cmdOut := Filename newTemporary.
+ cmdOut exists ifTrue:[
+ cmdOut remove.
+ ].
+ cmd := 'checkout' , revisionArg , ' ', checkoutName , ' > ' , '"' , cmdOut name, '"' .
+ ] ifFalse:[
+ cmd := 'checkout' , revisionArg , ' ', checkoutName.
+ ].
+
+ (self
+ executeCVSCommand:cmd
+ module:moduleDir
+ inDirectory:tempdir name
+ ) ifFalse:[
+ ('CVSSourceCodeManager [error]: cannot checkout ' , checkoutName) errorPrintCR.
"/ "/ see if there is CVS access at all ...
"/ (self checkForExistingModule:moduleDir) ifFalse:[
@@ -2857,61 +2834,61 @@
"/ ('CVSSourceCodeManager [warning]: disabled repository access for module ' , moduleDir) errorPrintCR.
"/ ].
- ^ nil.
- ].
-
- cmdOut notNil ifTrue:[cmdOut remove].
- fullTempName := tempdir construct:checkoutNameLocal.
- (cacheSubDir isNil) ifTrue:[
- cacheIt := false
- ] ifFalse:[
- cacheSubDir recursiveMakeDirectory.
- fullCachedName := cacheSubDir constructString:cachedSourceFilename.
- ].
- fullTempName exists ifFalse:[
- ('CVSSourceCodeManager [error]: failed to checkout ', fullTempName pathName, ' (file does not exist after cvs co)') errorPrintCR.
- tempdir recursiveRemove.
- ^ nil
- ].
-
- (cacheIt
- and:[cachedFile notNil
- and:[fullTempName exists]])
- ifTrue:[
- (OsError catch:[
- fullTempName moveTo:fullCachedName.
- self activityNotification:'Cached as ',fullCachedName asFilename baseName.
- ]) ifTrue:[
- self activityNotification:'Not cached.'.
- ('CVSSourceCodeManager [error]: failed to rename ', fullTempName pathName, ' to ', cachedSourceFilename) errorPrintCR.
- tempdir recursiveRemove.
+ ^ nil.
+ ].
+
+ fullTempName := tempdir construct:checkoutNameLocal.
+ (cacheSubDir isNil) ifTrue:[
+ cacheIt := false
+ ] ifFalse:[
+ cacheSubDir recursiveMakeDirectory.
+ fullCachedName := cacheSubDir constructString:cachedSourceFilename.
+ ].
+ fullTempName exists ifFalse:[
+ ('CVSSourceCodeManager [error]: failed to checkout ', fullTempName pathName, ' (file does not exist after cvs co)') errorPrintCR.
^ nil
].
- fullCachedName asFilename exists ifTrue:[
- stream := fullCachedName asFilename readStream.
- ].
- ] ifFalse:[
- fileName = 'extensions.st' ifTrue:[
- self activityNotification:'Not cached - please check your settings and/or the version method in the projectDefinition.'.
+
+ (cacheIt
+ and:[cachedFile notNil
+ and:[fullTempName exists]])
+ ifTrue:[
+ (OsError catch:[
+ fullTempName moveTo:fullCachedName.
+ self activityNotification:'Cached as ',fullCachedName asFilename baseName.
+ ]) ifTrue:[
+ self activityNotification:'Not cached.'.
+ ('CVSSourceCodeManager [error]: failed to rename ', fullTempName pathName, ' to ', cachedSourceFilename) errorPrintCR.
+ ^ nil
+ ].
+ fullCachedName asFilename exists ifTrue:[
+ stream := fullCachedName asFilename readStream.
+ ].
] ifFalse:[
- self activityNotification:'Not cached - please check your settings.'.
+ fileName = 'extensions.st' ifTrue:[
+ self activityNotification:'Not cached - please check your settings and/or the version method in the projectDefinition.'.
+ ] ifFalse:[
+ self activityNotification:'Not cached - please check your settings.'.
+ ].
+ OperatingSystem isUNIXlike ifFalse:[
+ "/ cannot remove files which are still open ...
+ "/ sigh - need a delete-on-close flag in FileStream.
+ "/
+ tempFile := Filename newTemporary.
+ fullTempName copyTo:tempFile.
+ stream := tempFile readStream.
+ stream notNil ifTrue:[
+ stream removeOnClose:true.
+ ].
+ ] ifTrue:[
+ stream := fullTempName readStream.
+ ]
].
- OperatingSystem isUNIXlike ifFalse:[
- "/ cannot remove files which are still open ...
- "/ sigh - need a delete-on-close flag in FileStream.
- "/
- tempFile := Filename newTemporary.
- fullTempName copyTo:tempFile.
- stream := tempFile readStream.
- stream notNil ifTrue:[
- stream removeOnClose:true.
- ].
- ] ifTrue:[
- stream := fullTempName readStream.
- ]
+ self releaseAndRemove:tempdir module:moduleDir outputTo:nil.
+ ] ensure:[
+ cmdOut notNil ifTrue:[cmdOut remove].
+ tempdir notNil ifTrue:[tempdir recursiveRemove].
].
-
- self releaseAndRemove:tempdir module:moduleDir outputTo:nil.
^ stream
"Created: / 04-11-1995 / 19:46:20 / cg"
@@ -5183,11 +5160,11 @@
!CVSSourceCodeManager class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.453 2013-05-07 18:24:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.454 2013-05-07 18:34:47 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.453 2013-05-07 18:24:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/CVSSourceCodeManager.st,v 1.454 2013-05-07 18:34:47 cg Exp $'
! !