diff --git a/Iceberg-TipUI.package/IceTipBranchModel.class/instance/printOn..st b/Iceberg-TipUI.package/IceTipBranchModel.class/instance/printOn..st new file mode 100644 index 0000000000..6dd85814ad --- /dev/null +++ b/Iceberg-TipUI.package/IceTipBranchModel.class/instance/printOn..st @@ -0,0 +1,7 @@ +printing +printOn: aStream + super printOn: aStream. + aStream + nextPut: $[; + nextPutAll: self name; + nextPut: $] \ No newline at end of file diff --git a/Iceberg-TipUI.package/IceTipCachedModel.class/instance/printOn..st b/Iceberg-TipUI.package/IceTipCachedModel.class/instance/printOn..st new file mode 100644 index 0000000000..0960be97ea --- /dev/null +++ b/Iceberg-TipUI.package/IceTipCachedModel.class/instance/printOn..st @@ -0,0 +1,6 @@ +printing +printOn: aStream + super printOn: aStream. + aStream nextPut: $(. + self realObject printOn: aStream. + aStream nextPut: $) \ No newline at end of file diff --git a/Iceberg-TipUI.package/IceTipExistingBranchPanel.class/instance/initializeBranchesList.st b/Iceberg-TipUI.package/IceTipExistingBranchPanel.class/instance/initializeBranchesList.st index a6016e81f8..8b66dae49d 100644 --- a/Iceberg-TipUI.package/IceTipExistingBranchPanel.class/instance/initializeBranchesList.st +++ b/Iceberg-TipUI.package/IceTipExistingBranchPanel.class/instance/initializeBranchesList.st @@ -1,7 +1,15 @@ initialization initializeBranchesList + | dataSource | branchesList widget addColumn: (IceTipTableColumn newAction: #shortDescriptionWithDecoration); - dataSource: self newBranchListDataSource; + dataSource: (dataSource := self newBranchListDataSource); bindKeyCombination: Character cr toAction: [ self accept ]; - onAnnouncement: FTStrongSelectionChanged do: [ self accept ] \ No newline at end of file + onAnnouncement: FTStrongSelectionChanged do: [ self accept ]. + + " + We would prefere to have this implementation but for now we have a bug with the caches because #branchModels return the same cache used by the datasource but not #defaultBranchSelection. If we correct that later we can clean the code bellow. + + self model defaultBranchSelection ifNotNil: [ :branchModel | branchesList widget selectRowIndex: (dataSource elements indexOf: branchModel) ]." + + self model branchModels detect: #isHead ifFound: [ :head | branchesList widget selectRowIndex: (dataSource elements indexOf: head) ] ifNone: [ self model hasBranches ifTrue: [ branchesList widget selectFirstVisibleRow ] ] \ No newline at end of file diff --git a/Iceberg-TipUI.package/IceTipExistingBranchPanel.class/instance/validate.st b/Iceberg-TipUI.package/IceTipExistingBranchPanel.class/instance/validate.st index 215ea766d0..57b4adb358 100644 --- a/Iceberg-TipUI.package/IceTipExistingBranchPanel.class/instance/validate.st +++ b/Iceberg-TipUI.package/IceTipExistingBranchPanel.class/instance/validate.st @@ -1,5 +1,3 @@ accessing validate - self - assert: self selectedBranch isNotNil - description: 'Please select a branch to checkout.' \ No newline at end of file + self selectedBranch ifNil: [ IceError signal: 'Please select a branch to checkout.' ] \ No newline at end of file diff --git a/Iceberg-TipUI.package/IceTipMergeBranchPanel.class/instance/doAccept.st b/Iceberg-TipUI.package/IceTipMergeBranchPanel.class/instance/doAccept.st index 9db03e2b6a..7da18a1d13 100644 --- a/Iceberg-TipUI.package/IceTipMergeBranchPanel.class/instance/doAccept.st +++ b/Iceberg-TipUI.package/IceTipMergeBranchPanel.class/instance/doAccept.st @@ -1,6 +1,7 @@ actions doAccept - + self validate. + IceTipStandardAction new repository: self model entity; message: ('Verifying merge from {1}' format: { self selectedBranch name }); diff --git a/Iceberg-TipUI.package/IceTipRemoteModel.class/instance/branchModels.st b/Iceberg-TipUI.package/IceTipRemoteModel.class/instance/branchModels.st deleted file mode 100644 index ca8b3521bc..0000000000 --- a/Iceberg-TipUI.package/IceTipRemoteModel.class/instance/branchModels.st +++ /dev/null @@ -1,8 +0,0 @@ -accessing -branchModels - ^ self entity branches - collect: [ :each | - (IceTipBranchModel - repositoryModel: self repositoryModel - on: each) - beCached ] \ No newline at end of file diff --git a/Iceberg-TipUI.package/IceTipRemoteModel.class/instance/branches.st b/Iceberg-TipUI.package/IceTipRemoteModel.class/instance/branches.st new file mode 100644 index 0000000000..f3aeecdebe --- /dev/null +++ b/Iceberg-TipUI.package/IceTipRemoteModel.class/instance/branches.st @@ -0,0 +1,3 @@ +accessing +branches + ^ self entity branches \ No newline at end of file diff --git a/Iceberg-TipUI.package/IceTipRemoteModel.class/properties.json b/Iceberg-TipUI.package/IceTipRemoteModel.class/properties.json index 3500808877..b3ff676998 100644 --- a/Iceberg-TipUI.package/IceTipRemoteModel.class/properties.json +++ b/Iceberg-TipUI.package/IceTipRemoteModel.class/properties.json @@ -1,11 +1,13 @@ { + "classtraitcomposition" : "TWithBranchModel classTrait", + "classvars" : [ ], + "instvars" : [ ], + "name" : "IceTipRemoteModel", "commentStamp" : "EstebanLorenzano 5/30/2018 14:33", "super" : "IceTipEntityModel", - "category" : "Iceberg-TipUI-Model", + "traitcomposition" : "TWithBranchModel", + "type" : "normal", "classinstvars" : [ ], "pools" : [ ], - "classvars" : [ ], - "instvars" : [ ], - "name" : "IceTipRemoteModel", - "type" : "normal" + "category" : "Iceberg-TipUI-Model" } \ No newline at end of file diff --git a/Iceberg-TipUI.package/IceTipRepositoryModel.class/instance/branchModels.st b/Iceberg-TipUI.package/IceTipRepositoryModel.class/instance/branchModels.st deleted file mode 100644 index d6b0263bfa..0000000000 --- a/Iceberg-TipUI.package/IceTipRepositoryModel.class/instance/branchModels.st +++ /dev/null @@ -1,8 +0,0 @@ -accessing -branchModels - ^ self entity localBranches - collect: [ :each | - (IceTipBranchModel - repositoryModel: self - on: each) - beCached ] \ No newline at end of file diff --git a/Iceberg-TipUI.package/IceTipRepositoryModel.class/instance/branches.st b/Iceberg-TipUI.package/IceTipRepositoryModel.class/instance/branches.st new file mode 100644 index 0000000000..1ff3ac3084 --- /dev/null +++ b/Iceberg-TipUI.package/IceTipRepositoryModel.class/instance/branches.st @@ -0,0 +1,3 @@ +accessing +branches + ^ self entity localBranches \ No newline at end of file diff --git a/Iceberg-TipUI.package/IceTipRepositoryModel.class/properties.json b/Iceberg-TipUI.package/IceTipRepositoryModel.class/properties.json index fe3e2f37c5..e75e9bc745 100644 --- a/Iceberg-TipUI.package/IceTipRepositoryModel.class/properties.json +++ b/Iceberg-TipUI.package/IceTipRepositoryModel.class/properties.json @@ -1,11 +1,11 @@ { - "classtraitcomposition" : "TIceCopyCommitId classTrait", + "classtraitcomposition" : "TIceCopyCommitId classTrait + TWithBranchModel classTrait", "classvars" : [ ], "instvars" : [ ], "name" : "IceTipRepositoryModel", "commentStamp" : "EstebanLorenzano 5/30/2018 14:33", "super" : "IceTipEntityModel", - "traitcomposition" : "TIceCopyCommitId", + "traitcomposition" : "TIceCopyCommitId + TWithBranchModel", "type" : "normal", "classinstvars" : [ ], "pools" : [ ], diff --git a/Iceberg-TipUI.package/TWithBranchModel.trait/README.md b/Iceberg-TipUI.package/TWithBranchModel.trait/README.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Iceberg-TipUI.package/TWithBranchModel.trait/instance/branchModels.st b/Iceberg-TipUI.package/TWithBranchModel.trait/instance/branchModels.st new file mode 100644 index 0000000000..6552295b18 --- /dev/null +++ b/Iceberg-TipUI.package/TWithBranchModel.trait/instance/branchModels.st @@ -0,0 +1,3 @@ +branches +branchModels + ^ self branches collect: [ :each | (IceTipBranchModel repositoryModel: self repositoryModel on: each) beCached ] \ No newline at end of file diff --git a/Iceberg-TipUI.package/TWithBranchModel.trait/instance/branches.st b/Iceberg-TipUI.package/TWithBranchModel.trait/instance/branches.st new file mode 100644 index 0000000000..871f67324a --- /dev/null +++ b/Iceberg-TipUI.package/TWithBranchModel.trait/instance/branches.st @@ -0,0 +1,3 @@ +branches +branches + ^ self explicitRequirement \ No newline at end of file diff --git a/Iceberg-TipUI.package/TWithBranchModel.trait/instance/defaultBranchSelection.st b/Iceberg-TipUI.package/TWithBranchModel.trait/instance/defaultBranchSelection.st new file mode 100644 index 0000000000..3a659f18e0 --- /dev/null +++ b/Iceberg-TipUI.package/TWithBranchModel.trait/instance/defaultBranchSelection.st @@ -0,0 +1,6 @@ +accessing +defaultBranchSelection + ^ self branchModels + detect: #isHead + ifNone: [ self hasBranches + ifTrue: [ self branchModels ifNotEmpty: #anyOne ] ] \ No newline at end of file diff --git a/Iceberg-TipUI.package/TWithBranchModel.trait/instance/hasBranches.st b/Iceberg-TipUI.package/TWithBranchModel.trait/instance/hasBranches.st new file mode 100644 index 0000000000..011d9c50c8 --- /dev/null +++ b/Iceberg-TipUI.package/TWithBranchModel.trait/instance/hasBranches.st @@ -0,0 +1,3 @@ +testing +hasBranches + ^ self branches isNotEmpty \ No newline at end of file diff --git a/Iceberg-TipUI.package/TWithBranchModel.trait/instance/repositoryModel.st b/Iceberg-TipUI.package/TWithBranchModel.trait/instance/repositoryModel.st new file mode 100644 index 0000000000..00a8786cc5 --- /dev/null +++ b/Iceberg-TipUI.package/TWithBranchModel.trait/instance/repositoryModel.st @@ -0,0 +1,3 @@ +accessing +repositoryModel + ^ self explicitRequirement \ No newline at end of file diff --git a/Iceberg-TipUI.package/TWithBranchModel.trait/properties.json b/Iceberg-TipUI.package/TWithBranchModel.trait/properties.json new file mode 100644 index 0000000000..b549fd0b4e --- /dev/null +++ b/Iceberg-TipUI.package/TWithBranchModel.trait/properties.json @@ -0,0 +1,7 @@ +{ + "commentStamp" : "", + "classinstvars" : [ ], + "category" : "Iceberg-TipUI-Model", + "instvars" : [ ], + "name" : "TWithBranchModel" +} \ No newline at end of file diff --git a/Iceberg.package/IceRemote.class/instance/hasBranches.st b/Iceberg.package/IceRemote.class/instance/hasBranches.st new file mode 100644 index 0000000000..e40d825f33 --- /dev/null +++ b/Iceberg.package/IceRemote.class/instance/hasBranches.st @@ -0,0 +1,3 @@ +testing +hasBranches + ^ self branches isNotEmpty \ No newline at end of file