Skip to content

Commit

Permalink
Revert "Revert "Make repair detached display the current branch""
Browse files Browse the repository at this point in the history
  • Loading branch information
guillep authored Jan 18, 2024
1 parent d65991e commit e0f320f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
14 changes: 10 additions & 4 deletions Iceberg-TipUI/IceTipExistingBranchPanel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,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 @@ -81,6 +81,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/IceTipMergeBranchDialog.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,20 @@ IceTipMergeBranchDialog >> beSwitchAndMerge [
IceTipMergeBranchDialog >> 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

0 comments on commit e0f320f

Please sign in to comment.