Skip to content

Commit

Permalink
WIP: Turn ref list into ref tree
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDoe committed Oct 13, 2024
1 parent 8ea5deb commit 54424ba
Show file tree
Hide file tree
Showing 83 changed files with 316 additions and 145 deletions.
8 changes: 0 additions & 8 deletions src/GitS-Core.package/GSBrowser.class/class/gitIcon.st

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
actions
actionRefreshRefTree
self changed: #refTreeRoots.
7 changes: 0 additions & 7 deletions src/GitS-Core.package/GSBrowser.class/instance/activeRef..st

This file was deleted.

4 changes: 3 additions & 1 deletion src/GitS-Core.package/GSBrowser.class/instance/activeRef.st
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
accessing
activeRef
^ activeRef
^ (self activeRefTreeMember ifNil: [^ nil]) isRef
ifTrue: [self activeRefTreeMember ref]
ifFalse: [nil]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
accessing
activeRefTreeMember: aRefTreeMember
self basicActiveRefTreeMember: aRefTreeMember.
self activeRefCommit ifNotNil: [:commit | self activeCommit: commit].
self
changed: #activeRefTreeMember;
changed: #commitList.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
activeRefTreeMember
^ activeRefTreeMember

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
basicActiveRefTreeMember: aRefTreeMember
activeRefTreeMember := aRefTreeMember
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ toolbuilder
buildProjectsAndRefsPanel: builder
^ GSGUIUtilities buildVerticalSplit: 0.5
of: (self buildProjectList: builder)
and: (self buildRefList: builder)
and: (self buildRefTree: builder)
with: builder
10 changes: 0 additions & 10 deletions src/GitS-Core.package/GSBrowser.class/instance/buildRefList..st

This file was deleted.

10 changes: 10 additions & 0 deletions src/GitS-Core.package/GSBrowser.class/instance/buildRefTree..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
toolbuilder
buildRefTree: builder
^ builder pluggableTreeSpec new
model: self;
roots: #refTreeRoots;
getSelected: #activeRefTreeMember;
setSelected: #activeRefTreeMember:;
nodeClass: GSRefTreeMemberWrapper;
menu: #refListMenu:;
yourself

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
accessing
ensureActiveRefTreeMemberIdentityIn: aCollection
"PluggableTreeMorph uses == to find the morph corresponding to the activeRef.
since the refList might reload the refs sometimes (producing new object identities for the
same ref name strings), ensure that activeRef is (identity-)included in refList (given as aCollection)"
self activeRefTreeMember ifNil: [^ self].
self activeRefTreeMember isRef ifFalse: [^ self activeRefTreeMember: nil].
aCollection
detect: [:each | each ref = self activeRefTreeMember ref]
ifFound: [:member | self basicActiveRefTreeMember: member]
ifNone: [self activeRefTreeMember: nil].
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ updating
everythingChanged
self
changed: #activeWorkingCopy;
changed: #refList;
changed: #refTreeRoots;
changed: #commitList;
activeRef: nil;
activeRefTreeMember: nil;
activeCommit: (self activeWorkingCopy ifNotNil: #headCommit).
10 changes: 0 additions & 10 deletions src/GitS-Core.package/GSBrowser.class/instance/refList.st

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ refListMenu: aMenu
addLine;

add: 'Refresh refs'
action: #actionRefreshRefList;

add: (self showGitRefs ifTrue: ['<yes>'] ifFalse: ['<no>']), 'Show git refs'
action: #toggleShowGitRefs.
action: #actionRefreshRefTree.

^ aMenu
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ui
refTreeRoots
| roots |
roots := self activeWorkingCopy ifNotNil: #refTreeRoots ifNil: [^ {}].
self ensureActiveRefTreeMemberIdentityIn: roots.
^ roots
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ updating
refsChanged
self
changed: #commitList;
changed: #refList.
changed: #refTreeRoots.

This file was deleted.

3 changes: 0 additions & 3 deletions src/GitS-Core.package/GSBrowser.class/instance/showGitRefs.st

This file was deleted.

This file was deleted.

28 changes: 12 additions & 16 deletions src/GitS-Core.package/GSBrowser.class/methodProperties.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"class" : {
"errorOutdated" : "mad 10/9/2024 17:56",
"gitIcon" : "mad 9/19/2023 15:03",
"initialize" : "mad 9/21/2023 18:47",
"open" : "mad 9/19/2023 12:44",
"registerInWorldMenu" : "mad 10/18/2023 15:14",
Expand Down Expand Up @@ -41,7 +40,7 @@
"actionPush:" : "mad 5/18/2024 11:31",
"actionPush:force:" : "mad 5/18/2024 11:31",
"actionRebaseOntoCommit:" : "mad 10/13/2024 21:41",
"actionRefreshRefList" : "mad 10/24/2023 19:54",
"actionRefreshRefTree" : "mad 10/10/2024 00:22",
"actionRemoveActiveProject" : "mad 9/21/2023 11:55",
"actionRenameActiveProject" : "mad 12/8/2023 18:46",
"actionResetToCommit:" : "mad 10/4/2024 15:04",
Expand All @@ -59,15 +58,16 @@
"activeCommit:" : "mad 5/15/2024 21:42",
"activeCommitIfNilInformAnd:" : "mad 4/5/2024 19:07",
"activeCommitInfo" : "mad 9/14/2023 19:29",
"activeRef" : "mad 9/14/2023 19:19",
"activeRef:" : "mad 5/15/2024 21:40",
"activeRef" : "mad 10/10/2024 01:00",
"activeRefCommit" : "mad 9/14/2023 19:24",
"activeRefTreeMember" : "mad 10/10/2024 01:00",
"activeRefTreeMember:" : "mad 10/10/2024 01:00",
"activeWorkingCopy" : "mad 9/19/2023 12:38",
"activeWorkingCopy:" : "mad 4/10/2024 19:17",
"activeWorkingCopyIfNilInformAnd:" : "mad 4/5/2024 19:05",
"addMappersProjectListMenu:" : "mad 10/9/2024 16:01",
"basicActiveCommit:" : "mad 5/15/2024 21:42",
"basicActiveRef:" : "mad 5/15/2024 21:40",
"basicActiveRefTreeMember:" : "mad 10/10/2024 01:01",
"buildBranchButton:" : "mad 9/14/2023 19:42",
"buildButtons:" : "mad 10/9/2024 16:01",
"buildCommitButton:" : "mad 9/1/2023 14:07",
Expand All @@ -79,10 +79,10 @@
"buildMainLayout:" : "mad 10/9/2024 16:01",
"buildOtherButton:" : "mad 10/18/2023 15:38",
"buildProjectList:" : "mad 10/9/2024 16:01",
"buildProjectsAndRefsPanel:" : "mad 10/9/2024 16:01",
"buildProjectsAndRefsPanel:" : "mad 10/10/2024 00:56",
"buildPullButton:" : "mad 9/18/2023 16:19",
"buildPushButton:" : "mad 9/18/2023 14:11",
"buildRefList:" : "mad 10/9/2024 16:01",
"buildRefTree:" : "mad 10/10/2024 01:20",
"buildUpperLayout:" : "mad 10/9/2024 16:01",
"buildWindow:" : "mad 10/9/2024 16:01",
"buildWith:" : "mad 9/1/2023 14:44",
Expand All @@ -92,12 +92,11 @@
"commitListStartingCommits" : "mad 9/19/2023 12:32",
"commitReferencedBy:to:" : "mad 4/5/2024 19:45",
"currentBranchIfNilInformAnd:" : "mad 9/26/2023 16:56",
"doesRef:comeBeforeRef:" : "mad 9/19/2023 14:45",
"emptyCommit" : "mad 4/4/2024 23:07",
"ensureActiveCommitIdentityIn:" : "mad 5/15/2024 21:55",
"ensureActiveRefIdentityIn:" : "mad 5/15/2024 21:54",
"ensureActiveRefTreeMemberIdentityIn:" : "mad 10/10/2024 01:03",
"ensureHeadCommitMaterializedTo:" : "mad 10/9/2024 16:01",
"everythingChanged" : "mad 12/22/2023 17:59",
"everythingChanged" : "mad 10/10/2024 01:03",
"ifRepositoryDoesNotExist:" : "mad 11/30/2023 17:08",
"menu:forCommit:" : "mad 4/5/2024 20:19",
"menu:forCommit:ref:" : "mad 8/13/2024 18:05",
Expand Down Expand Up @@ -126,14 +125,11 @@
"parentForPick:" : "mad 4/5/2024 14:44",
"projectListMenu:" : "mad 10/9/2024 16:01",
"refChanged:" : "mad 5/15/2024 20:47",
"refList" : "mad 5/15/2024 21:43",
"refListMenu:" : "mad 4/5/2024 18:55",
"refListMenu:" : "mad 10/10/2024 00:22",
"refTreeRoots" : "mad 10/10/2024 00:21",
"refTypeName:" : "mad 11/29/2023 15:59",
"refsChanged" : "mad 5/15/2024 20:47",
"refsChanged" : "mad 10/10/2024 00:22",
"requestBranchNameFor:at:fromRef:" : "mad 4/5/2024 19:29",
"showGitRefs" : "mad 10/16/2023 21:39",
"showGitRefs:" : "mad 10/16/2023 21:50",
"toggleShowGitRefs" : "mad 10/16/2023 21:50",
"unitOfWork" : "mad 9/19/2023 12:37",
"update:" : "mad 5/15/2024 20:47",
"validateDialogHasNoConflicts:before:" : "mad 9/27/2023 16:11",
Expand Down
3 changes: 1 addition & 2 deletions src/GitS-Core.package/GSBrowser.class/properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"instvars" : [
"activeWorkingCopy",
"activeCommit",
"activeRef",
"showGitRefs" ],
"activeRefTreeMember" ],
"name" : "GSBrowser",
"pools" : [
],
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ref-tree
newRefTreeWithLabel: labelString ref: refString
^ GSRefTree new
workingCopy: self;
label: labelString;
ref: refString;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ref-tree
refTreeRoots
| other roots |
roots := {
'local branches' -> self branchesBaseName.
}, (self remoteNames collect: [:each |
('remote branches on {1}' format: {each printString})
-> (self remoteRefBaseName, each, $/)]), {
'external branches' -> self gitBranchesBaseName.
'tags' -> 'refs/tags/'.
} collect: [:each | self newRefTreeWithLabel: each key ref: each value].
other := self newRefTreeWithLabel: 'other refs' ref: ''.
self allReferences do: [:ref |
self flag: #todo. "handle HEAD refs and refs from other squeak images"
roots
detect: [:each | ref beginsWith: each ref]
ifFound: [:root | root add: (ref allButFirst: root ref size)]
ifNone: [other add: ref]].
roots := roots copyWith: other.
roots do: #compressChildren.
^ roots reject: #isEmpty
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
"initialize" : "mad 10/6/2024 21:15",
"initializeHead" : "mad 11/30/2023 13:17",
"isGitBranchRef:" : "mad 5/23/2024 18:37",
"isHeadDetached" : "mad 11/30/2023 13:17",
"isImageClean" : "mad 10/9/2024 16:01",
"isReferencedByHead:" : "mad 10/16/2023 22:52",
"isRemoteRef:" : "mad 12/8/2023 19:47",
Expand All @@ -92,9 +91,11 @@
"materializeChangeSets:" : "mad 10/2/2024 18:35",
"materializeCommit:" : "mad 9/6/2023 19:27",
"moveToNewRepositoryLocation:" : "mad 12/22/2023 17:50",
"newRefTreeWithLabel:ref:" : "mad 10/10/2024 00:55",
"pushRef:force:" : "mad 5/18/2024 11:31",
"refChanged:" : "mad 5/15/2024 21:20",
"refName:" : "mad 6/3/2023 14:17",
"refTreeRoots" : "mad 10/10/2024 01:14",
"refsBaseName" : "mad 11/28/2023 15:33",
"refsBaseNameForHash:" : "mad 11/28/2023 15:32",
"refsChanged" : "mad 5/15/2024 21:21",
Expand Down
Empty file.
5 changes: 5 additions & 0 deletions src/GitS-Core.package/GSRefTree.class/instance/add..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
adding
add: aString
(aString includes: $/)
ifTrue: [self addInTree: aString]
ifFalse: [self addRef: aString].
6 changes: 6 additions & 0 deletions src/GitS-Core.package/GSRefTree.class/instance/addInTree..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
adding
addInTree: aString
| split |
split := aString indexOf: $/.
(self getTree: (aString first: split - 1))
add: (aString allButFirst: split).
3 changes: 3 additions & 0 deletions src/GitS-Core.package/GSRefTree.class/instance/addRef..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
adding
addRef: aString
^ self children add: (self createRef: aString)
3 changes: 3 additions & 0 deletions src/GitS-Core.package/GSRefTree.class/instance/addTree..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
adding
addTree: aString
^ self children add: (self createTree: aString)
3 changes: 3 additions & 0 deletions src/GitS-Core.package/GSRefTree.class/instance/children..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
children: anObject
children := anObject
3 changes: 3 additions & 0 deletions src/GitS-Core.package/GSRefTree.class/instance/children.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
children
^ children
9 changes: 9 additions & 0 deletions src/GitS-Core.package/GSRefTree.class/instance/compress.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
compressing
compress
self compressChildren.
self children ifEmpty: [^ nil].
self children size = 1 ifTrue: [
^ self children first
prefixLabel: self label, $/;
yourself].
^ self
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
compressing
compressChildren
self children:
((self children
collect: [:each | each compress]
thenSelect: #notNil)
sorted: #label ascending).
Loading

0 comments on commit 54424ba

Please sign in to comment.