BrowserView.st
changeset 2574 24eae517f560
parent 2568 24854141205c
child 2583 11528e3ccf36
--- a/BrowserView.st	Wed Feb 02 13:42:20 2000 +0100
+++ b/BrowserView.st	Wed Feb 02 13:44:06 2000 +0100
@@ -4177,46 +4177,78 @@
 
     self doClassMenu:[:currentClass |
         |aStream comparedSource currentSource v rev revString thisRevString mgr
-         nm msg comparedChangeSet currentChangeSet rev2 newestRev|
+         nm msg comparedChangeSet currentChangeSet rev2 newestRev
+         containerModule containerPackage containerFile rslt|
 
         nm := currentClass name.
+        mgr := currentClass sourceCodeManager.
 
         rev := currentClass binaryRevision.
         rev2 := currentClass revision.
         rev isNil ifTrue:[
             rev := rev2
         ].
-
-        mgr := currentClass sourceCodeManager.
-        newestRev := mgr newestRevisionOf:currentClass.
-
-        msg := resources string:'compare to revision: (empty for newest)'.
-        rev notNil ifTrue:[
-            msg := msg , '\\' , (resources string:'Current %1 is based upon rev %2.'
-                                           with:nm asText allBold with:rev).
-            (rev2 notNil and:[rev2 ~= rev]) ifTrue:[
-                msg := msg , '\' , (resources string:'And has been checked into the repository as %1.'
-                                               with:rev2)
-            ]
-        ].
-        newestRev notNil ifTrue:[
-            msg := msg , '\' , (resources string:'Newest in reporitory is %1.'
-                                           with:newestRev)
-        ].
-
-        self normalLabel.
-        rev := Dialog request:msg withCRs onCancel:nil.
-
-        rev notNil ifTrue:[
-            rev withoutSpaces isEmpty ifTrue:[
-                msg := 'extracting newest %1 (' , (newestRev ? '???') , ')'.
-                "/ aStream := mgr getMostRecentSourceStreamForClassNamed:nm.
-                aStream := mgr getSourceStreamFor:currentClass revision:newestRev.
-                revString := '(newest: ' , (newestRev ? '???') , ')'.
+        rev isNil ifTrue:[
+            "/
+            "/ class not in repository - allow compare against any other containers newest contents
+            "/
+            self normalLabel.
+
+            containerModule := lastModule ? Project current repositoryModule.
+            containerPackage := lastPackage ? Project current package.
+            rslt := SourceCodeManagerUtilities
+                askForContainer:(resources string:'The class seems to have no repository information.\\Do you want to compare it against an existing containers contents ?')
+                title:'Container to compare' note:nil 
+                initialModule:containerModule 
+                initialPackage:containerPackage 
+                initialFileName:(currentClass name , '.st').
+            rslt isNil ifTrue:[
+                "/ canel
+                ^ self
+            ].
+            containerModule := lastModule := rslt at:#module.
+            containerPackage := lastPackage := rslt at:#package.
+            containerFile := rslt at:#fileName.
+        ] ifFalse:[
+            "/
+            "/ class in repository - ask for revision
+            "/
+            newestRev := mgr newestRevisionOf:currentClass.
+
+            msg := resources string:'compare to revision: (empty for newest)'.
+            rev notNil ifTrue:[
+                msg := msg , '\\' , (resources string:'Current %1 is based upon rev %2.'
+                                               with:nm asText allBold with:rev).
+                (rev2 notNil and:[rev2 ~= rev]) ifTrue:[
+                    msg := msg , '\' , (resources string:'And has been checked into the repository as %1.'
+                                                   with:rev2)
+                ]
+            ].
+            newestRev notNil ifTrue:[
+                msg := msg , '\' , (resources string:'Newest in reporitory is %1.'
+                                               with:newestRev)
+            ].
+
+            self normalLabel.
+            rev := Dialog request:msg withCRs onCancel:nil.
+        ].
+
+        (rev notNil or:[containerFile notNil]) ifTrue:[
+            rev notNil ifTrue:[
+                rev withoutSpaces isEmpty ifTrue:[
+                    msg := 'extracting newest %1 (' , (newestRev ? '???') , ')'.
+                    "/ aStream := mgr getMostRecentSourceStreamForClassNamed:nm.
+                    aStream := mgr getSourceStreamFor:currentClass revision:newestRev.
+                    revString := '(newest: ' , (newestRev ? '???') , ')'.
+                ] ifFalse:[
+                    msg := 'extracting previous %1'.
+                    aStream := mgr getSourceStreamFor:currentClass revision:rev.
+                    revString := rev
+                ].
             ] ifFalse:[
-                msg := 'extracting previous %1'.
-                aStream := mgr getSourceStreamFor:currentClass revision:rev.
-                revString := rev
+                msg := 'extracting newest version from ' , containerModule , '/' , containerPackage, '/' , containerFile.
+                aStream := mgr streamForClass:nil fileName:containerFile revision:#newest directory:containerPackage module:containerModule cache:false.
+                revString := '???'
             ].
             self busyLabel:msg with:nm.
 
@@ -13693,6 +13725,6 @@
 !BrowserView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.589 2000-02-01 12:18:41 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.590 2000-02-02 12:44:06 cg Exp $'
 ! !
 BrowserView initialize!