'From Squeak3.1alpha of 6 February 2001 [latest update: #4347] on 27 September 2001 at 8:33:42 pm'! "Change Set: chgSetForVersion-dew Date: 7 September 2001 Author: Doug Way Adds a 'find original change set' menu item for the Versions Browser, which locates the single changeset (or sources file) which originally contained the selected method version. It does this by matching the file pointers stored in the ChangeRecord and ChangeSet."! !ChangeRecord methodsFor: 'access' stamp: 'dew 9/7/2001 00:27'! originalChangeSetForSelector: methodSelector "Returns the original changeset which contained this method version. If it is contained in the .sources file, return #sources. If it is in neither (e.g. its changeset was deleted), return nil. (The selector is passed in purely as an optimization.)" | likelyChangeSets originalChangeSet | (file localName findTokens: '.') last = 'sources' ifTrue: [^ #sources]. likelyChangeSets _ ChangeSorter allChangeSets select: [:cs | (cs atSelector: methodSelector class: self methodClass) ~~ #none]. originalChangeSet _ likelyChangeSets detect: [:cs | cs containsMethodAtPosition: position] ifNone: [nil]. ^ originalChangeSet "(still need to check for sources file)"! ! !ChangeSet methodsFor: 'testing' stamp: 'dew 9/6/2001 23:54'! containsMethodAtPosition: aFilePosition "class: aClassSymbol" "(need class parameter to speed up?)" changeRecords values do: [:classChangeRecord | classChangeRecord methodChanges values do: [:methodChangeRecord | | changeType | changeType _ methodChangeRecord changeType. (changeType == #add or: [changeType == #change]) and: [methodChangeRecord currentMethod filePosition = aFilePosition ifTrue: [^ true]]]]. ^ false! ! !VersionsBrowser methodsFor: 'menu' stamp: 'dew 9/7/2001 00:29'! findOriginalChangeSet | changeSet | self currentChange ifNil: [^ self]. changeSet _ self currentChange originalChangeSetForSelector: self selectedMessageName. changeSet = #sources ifTrue: [^ self inform: 'This version is in the .sources file.']. changeSet ifNil: [^ self inform: 'This version was not found in any changeset nor in the .sources file.']. (ChangeSorter new myChangeSet: changeSet) open! ! !VersionsBrowser methodsFor: 'menu' stamp: 'dew 9/6/2001 02:47'! versionsMenu: aMenu "Fill aMenu with menu items appropriate to the receiver" Smalltalk isMorphic ifTrue: [aMenu title: 'versions'. aMenu addStayUpItemSpecial]. ^ aMenu addList: #( ('compare to current' compareToCurrentVersion 'compare selected version to the current version') ('revert to selected version' fileInSelections 'resubmit the selected version, so that it becomes the current version') ('remove from changes' removeMethodFromChanges 'remove this method from the current change set, if present') ('edit current method (O)' openSingleMessageBrowser 'open a single-message browser on the current version of this method') ('find original change set' findOriginalChangeSet 'locate the changeset which originally contained this version') - ('toggle diffing (D)' toggleDiffing 'toggle whether or not diffs should be shown here') ('update list' reformulateList 'reformulate the list of versions, in case it somehow got out of synch with reality') - ('senders (n)' browseSenders 'browse all senders of this selector') ('implementors (m)' browseImplementors 'browse all implementors of this selector') - ('help...' offerVersionsHelp 'provide an explanation of the use of this tool')) ! !