# HG changeset patch # User Claus Gittinger # Date 964183298 -7200 # Node ID 42412093a6177f4599b482c079db002ca5b42d98 # Parent 90eb8be47ac42ca2ba3a307264d09be1565bc191 present list of existing versions in "load revision" menu-function diff -r 90eb8be47ac4 -r 42412093a617 BrowserView.st --- a/BrowserView.st Fri Jul 21 14:41:05 2000 +0200 +++ b/BrowserView.st Fri Jul 21 14:41:38 2000 +0200 @@ -4405,7 +4405,7 @@ self normalLabel. rev := SourceCodeManagerUtilities - askForRevisionToCompare:msg + askForExistingRevision:msg title:'Compare with repository' class:currentClass @@ -4633,51 +4633,55 @@ upgrade a class to the newest revision" currentClass isLoaded ifFalse:[ - self warn:'cannot load specific releases of autoloaded classes.'. - ^ self. + self warn:'cannot load specific releases of autoloaded classes.'. + ^ self. ]. self doClassMenu:[:currentClass | - |aStream comparedSource currentSource v rev revString what mgr keep className - newClass prevCategory ok| - - rev := Dialog request:'load which revision: (empty for newest)' onCancel:nil. - rev notNil ifTrue:[ - className := currentClass name. - (className includesString:'_rev_') ifTrue:[ - self warn:'select the original class and try again.'. - ^ self - ]. - - mgr := currentClass sourceCodeManager. - ok := false. - - rev withoutSpaces isEmpty ifTrue:[ - what := className , '(newest)'. - self busyLabel:'extracting %1' with:what. - aStream := mgr getMostRecentSourceStreamForClassNamed:className. - revString := 'newest'. - keep := false. - ] ifFalse:[ - what := className , '(' , rev , ')'. - self busyLabel:'extracting %1' with:what. - aStream := mgr getSourceStreamFor:currentClass revision:rev. - revString := rev. - keep := true. - ]. - - aStream isNil ifTrue:[ - self warn:'cannot find classes source.'. - ^ self. - ]. - - self busyLabel:'loading %1' with:what . - - [ - Class withoutUpdatingChangesDo:[ - |saveIt prevSkip| - - saveIt := Dialog confirmWithCancel:'Keep a save-copy of the existing class ? + |aStream comparedSource currentSource v rev revString what mgr keep className + newClass prevCategory ok| + + rev := SourceCodeManagerUtilities + askForExistingRevision:'load which revision:' + title:'Load from repository' + class:currentClass. + "/ rev := Dialog request:'load which revision: (empty for newest)' onCancel:nil. + rev notNil ifTrue:[ + className := currentClass name. + (className includesString:'_rev_') ifTrue:[ + self warn:'select the original class and try again.'. + ^ self + ]. + + mgr := currentClass sourceCodeManager. + ok := false. + + rev withoutSpaces isEmpty ifTrue:[ + what := className , '(newest)'. + self busyLabel:'extracting %1' with:what. + aStream := mgr getMostRecentSourceStreamForClassNamed:className. + revString := 'newest'. + keep := false. + ] ifFalse:[ + what := className , '(' , rev , ')'. + self busyLabel:'extracting %1' with:what. + aStream := mgr getSourceStreamFor:currentClass revision:rev. + revString := rev. + keep := true. + ]. + + aStream isNil ifTrue:[ + self warn:'cannot find classes source.'. + ^ self. + ]. + + self busyLabel:'loading %1' with:what . + + [ + Class withoutUpdatingChangesDo:[ + |saveIt prevSkip| + + saveIt := Dialog confirmWithCancel:'Keep a save-copy of the existing class ? Enter ''yes'', to have the existing class be renamed before the fileIn is performed. @@ -4690,66 +4694,66 @@ In this case, methods from the repository version will be merged with methods of the class in your running image.)' default:false. - saveIt isNil ifTrue:[^ self]. - saveIt ifTrue:[ - "/ rename the current class - for backup - prevCategory := currentClass category. - currentClass category:'* obsolete *'. - Smalltalk renameClass:currentClass to:className , '_saved'. - ]. - - prevSkip := ClassCategoryReader skipUnchangedMethods. - ClassCategoryReader skipUnchangedMethods:false. - - Class nameSpaceQuerySignal answer:currentClass nameSpace - do:[ - Class packageQuerySignal answer:currentClass package - do:[ - lockUpdates := true. - [ - aStream fileIn. - ] valueNowOrOnUnwindDo:[ - ClassCategoryReader skipUnchangedMethods:prevSkip. - lockUpdates := false. - ]. - ]. - ]. - - "/ did that work ? - newClass := Smalltalk at:className ifAbsent:nil. - newClass isNil ifTrue:[ - saveIt ifTrue:[ - self warn:'fileIn failed - undoing changes ...'. - Smalltalk renameClass:currentClass to:className. - currentClass category:prevCategory. - ] ifFalse:[ - self warn:'fileIn failed - cannot recover class'. - ] - ] ifFalse:[ - "/ - "/ if we loaded an old version, rename that one and fix the name of the - "/ current class - "/ - keep ifTrue:[ - saveIt ifTrue:[ - Smalltalk renameClass:newClass to:(className , '_rev_' , rev). - newClass category:'* old versions *'. - Smalltalk renameClass:currentClass to:className. - currentClass category:prevCategory. - ] - ]. - ok := true. - ] - ]. - ] valueNowOrOnUnwindDo:[ - aStream close. - self normalLabel. - Smalltalk changed. - ]. - ok ifTrue:[ - self switchToClassNamed:newClass name. - ] - ] + saveIt isNil ifTrue:[^ self]. + saveIt ifTrue:[ + "/ rename the current class - for backup + prevCategory := currentClass category. + currentClass category:'* obsolete *'. + Smalltalk renameClass:currentClass to:className , '_saved'. + ]. + + prevSkip := ClassCategoryReader skipUnchangedMethods. + ClassCategoryReader skipUnchangedMethods:false. + + Class nameSpaceQuerySignal answer:currentClass nameSpace + do:[ + Class packageQuerySignal answer:currentClass package + do:[ + lockUpdates := true. + [ + aStream fileIn. + ] valueNowOrOnUnwindDo:[ + ClassCategoryReader skipUnchangedMethods:prevSkip. + lockUpdates := false. + ]. + ]. + ]. + + "/ did that work ? + newClass := Smalltalk at:className ifAbsent:nil. + newClass isNil ifTrue:[ + saveIt ifTrue:[ + self warn:'fileIn failed - undoing changes ...'. + Smalltalk renameClass:currentClass to:className. + currentClass category:prevCategory. + ] ifFalse:[ + self warn:'fileIn failed - cannot recover class'. + ] + ] ifFalse:[ + "/ + "/ if we loaded an old version, rename that one and fix the name of the + "/ current class + "/ + keep ifTrue:[ + saveIt ifTrue:[ + Smalltalk renameClass:newClass to:(className , '_rev_' , rev). + newClass category:'* old versions *'. + Smalltalk renameClass:currentClass to:className. + currentClass category:prevCategory. + ] + ]. + ok := true. + ] + ]. + ] valueNowOrOnUnwindDo:[ + aStream close. + self normalLabel. + Smalltalk changed. + ]. + ok ifTrue:[ + self switchToClassNamed:newClass name. + ] + ] ] "Created: / 14.11.1995 / 16:43:15 / cg" @@ -14135,6 +14139,6 @@ !BrowserView class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.624 2000-07-14 10:22:07 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.625 2000-07-21 12:41:38 cg Exp $' ! ! BrowserView initialize!