Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow repair detached by "merging" into the current branch on disk #1792

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Iceberg-TipUI/IceTipExistingBranchPanel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ IceTipExistingBranchPanel >> initializeBranchesList [

branchesList
hideColumnHeaders;
addColumn: (SpStringTableColumn evaluated: #shortDescription);
addColumn: (SpStringTableColumn evaluated: [: branch | self shortDescriptionFor: branch ]);
items: self model branchModels.

self model branchModels
detect: #isHead
ifFound: [ :head | branchesList selectItem: head ]
ifNone: [ self model hasBranches ifTrue: [ branchesList selectIndex: 1 ] ].

self flag: #pharoTodo. "Instead of detecting 'isHead', we would prefer to select 'self model defaultBranchSelection' but we have a bug with the caches. The reason is that #branchModels returns the same cache used by the list but not #defaultBranchSelection."
ifNone: [
self model hasBranches ifTrue: [ branchesList selectIndex: 1 ] ].

self flag: #pharoTodo "Instead of detecting 'isHead', we would prefer to select 'self model defaultBranchSelection' but we have a bug with the caches. The reason is that #branchModels returns the same cache used by the list but not #defaultBranchSelection."
]

{ #category : 'initialization' }
Expand All @@ -83,6 +83,12 @@ IceTipExistingBranchPanel >> selectedBranch [
^ self branchesList selection selectedItem
]

{ #category : 'initialization' }
IceTipExistingBranchPanel >> shortDescriptionFor: aBranch [
aBranch isHead ifFalse: [ ^aBranch shortDescription ].
^aBranch shortDescription , ' (current)'
]

{ #category : 'initialization' }
IceTipExistingBranchPanel >> titleForWindow [

Expand Down
26 changes: 12 additions & 14 deletions Iceberg-TipUI/IceTipMergeBranchDialogPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,20 @@ IceTipMergeBranchDialogPresenter >> beSwitchAndMerge [
IceTipMergeBranchDialogPresenter >> createMergeBranchTypes [

| allTypes |
"Collect types local+remotes"
allTypes := {
(IceTipMergeBranchPanel on: self model)
titleForWindow: 'Local';
withoutHead;
icon: (self iconNamed: #branch);
yourself },
(self model remoteModels collect: [ :each |
(IceTipMergeBranchPanel on: each)
titleForWindow: each name;
icon: (self iconNamed: #remote);
yourself ]).

"Collect types local+remotes"
allTypes := { ((IceTipMergeBranchPanel on: self model)
titleForWindow: 'Local';
icon: (self iconNamed: #branch);
yourself) }
, (self model remoteModels collect: [ :each |
(IceTipMergeBranchPanel on: each)
titleForWindow: each name;
icon: (self iconNamed: #remote);
yourself ]).

"Doing this because I can trigger the accept inside the panels."
allTypes do: [ :each | each onAccept: [ self closeWindow ] ].

^ allTypes
]

Expand Down
Loading