Skip to content

Commit

Permalink
Merge pull request #142 from hpi-swa-teaching/105b-more-doits
Browse files Browse the repository at this point in the history
105b more doits
  • Loading branch information
AbdullatifGhajar committed Jun 11, 2021
2 parents 58ad7aa + b937503 commit 1fa1b4b
Show file tree
Hide file tree
Showing 59 changed files with 373 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ utils
getChangeListItemsFrom: anOrderedCollectionOfChangeRecords

^ (anOrderedCollectionOfChangeRecords
select: [:each | each isMethod or: each isClassComment])
reject: [:each | each isMisc])
collect: [:each | CRChangeListItem new changeRecord: each]
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ getChangeRecordsMissingInImageFrom: aMultiByteFileStream
saveOrQuitIndex := (startupIndex to: changeRecords size) detect: [:i | (changeRecords at: i) isSaveOrQuit]
ifNone: [^ OrderedCollection new].

^ changeRecords copyFrom: startupIndex to: saveOrQuitIndex
^ changeRecords copyFrom: startupIndex to: saveOrQuitIndex
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ utils
retrieveChangeRecordsFrom: aMultiByteFileStream

| changesFileCopy start end |

changesFileCopy := aMultiByteFileStream readOnlyCopy.
changesFileCopy setConverterForCode.
end := changesFileCopy size.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"defaultBrowserHeight" : "SV 8/7/2020 12:58",
"defaultBrowserWidth" : "SV 8/7/2020 12:58",
"extent" : "SV 8/7/2020 15:37",
"getChangeListItemsFrom:" : "SV 8/1/2020 15:40",
"getChangeRecordsMissingInImageFrom:" : "TS 6/9/2021 16:11",
"getChangeListItemsFrom:" : "abd 6/11/2021 14:36",
"getChangeRecordsMissingInImageFrom:" : "abd 6/1/2021 17:26",
"newWith:" : "uh 6/21/2020 21:32",
"numberOfBytesToLoadChangesFrom" : "gf 5/20/2020 10:43",
"open" : "gf 7/25/2020 20:59",
"open" : "abd 5/31/2021 16:53",
"openWith:" : "gf 7/5/2020 13:58",
"retrieveChangeRecordsFrom:" : "mg 7/4/2020 21:02" },
"retrieveChangeRecordsFrom:" : "abd 5/31/2021 16:58" },
"instance" : {
"askToSave" : "anonym-HPI 5/24/2021 13:13",
"buildButtonSpecWith:label:action:help:enabled:" : "mg 8/7/2020 14:19",
Expand All @@ -36,7 +36,7 @@
"hasSelectedChangeListItem" : "SV 7/13/2020 16:15",
"hasSelectedMethodChangeListItem" : "JA 5/20/2021 17:16",
"hasValidChangeListSelectionIndex" : "gf 7/10/2020 12:33",
"initializeChangeListItemsWith:" : "SV 8/7/2020 15:17",
"initializeChangeListItemsWith:" : "abd 5/31/2021 16:34",
"initializeWith:" : "gf 7/25/2020 21:01",
"isLoadButtonEnabled" : "mg 8/6/2020 11:27",
"isPickButtonEnabled" : "gf 7/25/2020 20:09",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
accessing
description

| plainDescription |
plainDescription := (self type , ': ' , self nameOfAffectedClass , ' ' , self methodSelector , ' ' , self stamp) asText.
| plainDescription |
plainDescription := (CRChangeRecordDescriber descriptionFor: self) asText.
self isPicked ifFalse: [self addUnpickedAttributes: plainDescription].
^ plainDescription

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
"addUnpickedAttributes:" : "TS 5/20/2021 11:12",
"changeRecord" : "SV 5/29/2020 22:13",
"changeRecord:" : "SV 5/29/2020 22:14",
"description" : "TS 5/26/2021 15:56",
"description" : "abd 6/2/2021 08:09",
"doesNotUnderstand:" : "gf 6/15/2020 23:22",
"hash" : "SV 8/7/2020 22:07",
"initialize" : "gf 7/15/2020 10:48",
"isPicked" : "SV 7/13/2020 16:05",
"isPicked:" : "SV 7/13/2020 16:05",
"nameOfAffectedClass" : "SV 7/13/2020 15:52",
"pick" : "gf 7/15/2020 10:45",
"togglePickStatus" : "mg 8/7/2020 22:33",
"unpick" : "gf 7/15/2020 10:45" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A CRChangeRecordDescriber is the class that returns a description for a ChangeListItem.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it descriptions
categoryCreatedDescriptionOf: anRxMatcher

^ 'categoryCreated: #', (anRxMatcher subexpression: 4), ' in #', (anRxMatcher subexpression: 2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it regex
categoryCreatedRegex

^ '^([^ ]+) (class )?organization addCategory\: #(.+)$' asRegex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it descriptions
categoryRemovedDescriptionOf: anRxMatcher

^ 'categoryRemoved: #', (anRxMatcher subexpression: 4), ' from #', (anRxMatcher subexpression: 2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it regex
categoryRemovedRegex

^ '^([^ ]+) (class )?organization removeCategory\: #(.+)$' asRegex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it descriptions
categoryRenamedDescriptionOf: anRxMatcher

^ 'categoryRenamed: #', (anRxMatcher subexpression: 4), ' -> #', (anRxMatcher subexpression: 5), ' in #', (anRxMatcher subexpression: 2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it regex
categoryRenamedRegex

^ '^([^ ]+) (class )?organization renameCategory\: #(.+) toBe\: #(.+)$' asRegex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
changeString: anObject

changeString := anObject.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
changeString

^ changeString ifNil: ''
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
main
classCommentDescriptionFor: aChangeListItem

^ 'classComment: ', aChangeListItem commentClass name , ' ', aChangeListItem stamp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it descriptions
classCreatedDescriptionOf: anRxMatcher

^ 'classCreated: #', (anRxMatcher subexpression: 2), ' in #', (anRxMatcher subexpression: 3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it regex
classCreatedRegex

^ '^[^ ]+ subclass\: #([\S]+).*category\: ''([^'']+)''$' asRegex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it descriptions
classRemovedDescriptionOf: anRxMatcher

^ 'classRemoved: #', (anRxMatcher subexpression: 2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it regex
classRemovedRegex

^ '^Smalltalk removeClassNamed\: #([^ ]+)$' asRegex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it descriptions
classRenamedDescriptionOf: anRxMatcher

^ 'classRenamed: #', (anRxMatcher subexpression: 2), ' -> #', (anRxMatcher subexpression: 3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it regex
classRenamedRegex

^ '^Smalltalk renameClassNamed\: #([^ ]+) as\: #([^ ]+)$' asRegex
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
main
descriptionFor: aChangeListItem
aChangeListItem type caseOf: {
[#method] -> [^ self methodDescriptionFor: aChangeListItem].
[#classComment] -> [^ self classCommentDescriptionFor: aChangeListItem].
[#doIt] -> [^ self doItDescriptionFor: aChangeListItem].
}
"otherwise: [^ 'MISC should be removed ']"
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
main
doItDescriptionFor: aChangeListItem

self changeString: aChangeListItem string.

"packages"
self if: self packageCreatedRegex matchesChangeString: [:matcher | ^ self packageCreatedDescriptionOf: matcher].
self if: self packageRemovedRegex matchesChangeString: [:matcher | ^ self packageRemovedDescriptionOf: matcher].
self if: self packageRenamedRegex matchesChangeString: [:matcher | ^ self packageRenamedDescriptionOf: matcher].

"classes"
self if: self classCreatedRegex matchesChangeString: [:matcher | ^ self classCreatedDescriptionOf: matcher].
self if: self classRemovedRegex matchesChangeString: [:matcher | ^ self classRemovedDescriptionOf: matcher].
self if: self classRenamedRegex matchesChangeString: [:matcher | ^ self classRenamedDescriptionOf: matcher].

"categories"
self if: self categoryCreatedRegex matchesChangeString: [:matcher | ^ self categoryCreatedDescriptionOf: matcher].
self if: self categoryRemovedRegex matchesChangeString: [:matcher | ^ self categoryRemovedDescriptionOf: matcher].
self if: self categoryRenamedRegex matchesChangeString: [:matcher | ^ self categoryRenamedDescriptionOf: matcher].

"methods"
self if: self methodRemovedRegex matchesChangeString: [:matcher | ^ self methodRemovedDescriptionOf: matcher].
self if: self methodRecategorizedRegex matchesChangeString: [:matcher | ^ self methodRecategorizedDescriptionOf: matcher].

"otherwise"
^ 'doIt: ', changeString
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
main
if: anMatcher matchesChangeString: aBlock

^ (anMatcher matches: self changeString) ifTrue: [^ aBlock value: anMatcher]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
main
methodDescriptionFor: aChangeListItem

^ 'method: ', aChangeListItem methodClassName , ' ' , aChangeListItem methodSelector, ' ', aChangeListItem stamp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it descriptions
methodRecategorizedDescriptionOf: anRxMatcher

^ 'methodRecategorize: #', (anRxMatcher subexpression: 4), ' to #', (anRxMatcher subexpression: 5)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it regex
methodRecategorizedRegex

^ '^([^ ]+) (class )?organization classify\: #(.+) under\: #(.+)$' asRegex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it descriptions
methodRemovedDescriptionOf: anRxMatcher

^ 'methodRemoved: #', (anRxMatcher subexpression: 4), ' from #', (anRxMatcher subexpression: 2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it regex
methodRemovedRegex

^ '^([^ ]+) (class )?removeSelector\: #([^ ]+)$' asRegex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
do it descriptions
packageCreatedDescriptionOf: anRxMatcher

^ 'packageCreated: #', (anRxMatcher subexpression: 2)

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it regex
packageCreatedRegex

^ '^SystemOrganization addCategory\: #(.+)$' asRegex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it descriptions
packageRemovedDescriptionOf: anRxMachter

^ 'packageRemoved: #', (anRxMachter subexpression: 2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it regex
packageRemovedRegex

^ '^SystemOrganization removeSystemCategory\: #(.+)$' asRegex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it descriptions
packageRenamedDescriptionOf: anRxMatcher

^ 'packageRenamed: #', (anRxMatcher subexpression: 2), ' -> #', (anRxMatcher subexpression: 3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
do it regex
packageRenamedRegex

^ '^SystemOrganization renameCategory\: #(.+) toBe\: #(.+)$' asRegex
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"class" : {
"categoryCreatedDescriptionOf:" : "abd 6/7/2021 17:39",
"categoryCreatedRegex" : "abd 6/8/2021 19:51",
"categoryRemovedDescriptionOf:" : "FK 6/10/2021 20:42",
"categoryRemovedRegex" : "abd 6/8/2021 19:50",
"categoryRenamedDescriptionOf:" : "abd 6/7/2021 17:39",
"categoryRenamedRegex" : "abd 6/8/2021 19:51",
"changeString" : "abd 6/8/2021 20:02",
"changeString:" : "abd 6/8/2021 19:58",
"classCommentDescriptionFor:" : "abd 6/2/2021 08:23",
"classCreatedDescriptionOf:" : "abd 6/7/2021 17:39",
"classCreatedRegex" : "FK 6/10/2021 20:41",
"classRemovedDescriptionOf:" : "abd 6/7/2021 17:38",
"classRemovedRegex" : "anonym-HPI 6/5/2021 15:29",
"classRenamedDescriptionOf:" : "abd 6/7/2021 17:38",
"classRenamedRegex" : "anonym-HPI 6/5/2021 15:29",
"descriptionFor:" : "abd 6/7/2021 17:18",
"doItDescriptionFor:" : "abd 6/8/2021 20:07",
"if:matchesChangeString:" : "abd 6/8/2021 20:08",
"methodDescriptionFor:" : "abd 6/2/2021 08:23",
"methodRecategorizedDescriptionOf:" : "abd 6/7/2021 17:40",
"methodRecategorizedRegex" : "abd 6/8/2021 19:51",
"methodRemovedDescriptionOf:" : "abd 6/7/2021 17:40",
"methodRemovedRegex" : "anonym-HPI 6/5/2021 16:13",
"packageCreatedDescriptionOf:" : "abd 6/7/2021 17:37",
"packageCreatedRegex" : "abd 6/8/2021 19:51",
"packageRemovedDescriptionOf:" : "abd 6/7/2021 17:37",
"packageRemovedRegex" : "abd 6/8/2021 19:54",
"packageRenamedDescriptionOf:" : "abd 6/7/2021 17:37",
"packageRenamedRegex" : "abd 6/8/2021 19:52" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "ChangesReloaded-Core",
"classinstvars" : [
"changeString" ],
"classvars" : [
],
"commentStamp" : "abd 6/2/2021 08:52",
"instvars" : [
],
"name" : "CRChangeRecordDescriber",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ isInImage
class ifNil: [^ false].
class organization commentStamp ifNil: [^ false].
^ (TimeStamp fromAuthorStamp: class organization commentStamp) >= self timeStamp].

"TODO: doIt"

"FIXME"
^ (self type = #doIt) not
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*ChangesReloaded-Core
isMisc

^ self string beginsWith: '----'
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
},
"instance" : {
"isClassComment" : "gf 7/10/2020 13:03",
"isInImage" : "JA 6/4/2021 18:36",
"isInImage" : "abd 6/1/2021 17:27",
"isMethod" : "gf 6/5/2020 10:29",
"isMisc" : "abd 6/11/2021 20:58",
"isSaveOrQuit" : "TS 6/9/2021 16:25",
"isStartup" : "TS 6/9/2021 16:26",
"modifiesClass" : "SV 6/22/2020 21:45" } }
Loading

0 comments on commit 1fa1b4b

Please sign in to comment.