Skip to content

Commit

Permalink
Merge pull request #1792 from guillep/redo-1753
Browse files Browse the repository at this point in the history
Allow repair detached by "merging" into the current branch on disk
  • Loading branch information
guillep authored Jan 18, 2024
2 parents bca617d + b7984e9 commit 4d88639
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 @@ -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

0 comments on commit 4d88639

Please sign in to comment.