-
-
Notifications
You must be signed in to change notification settings - Fork 353
/
ClyCommitMCPackageCommand.class.st
73 lines (63 loc) · 2.45 KB
/
ClyCommitMCPackageCommand.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"
I am a command to commit given packages.
I use Iceberg if it is repository of package.
Otherwise I use Komitter.
"
Class {
#name : #ClyCommitMCPackageCommand,
#superclass : #SycPackageCommand,
#category : #'Calypso-SystemPlugins-Monticello-Browser'
}
{ #category : #testing }
ClyCommitMCPackageCommand class >> canBeExecutedInContext: aToolContext [
"if no packages are selected then command will commit all changes in image"
^true
]
{ #category : #activation }
ClyCommitMCPackageCommand class >> fullBrowserMenuActivation [
<classAnnotation>
^CmdContextMenuActivation byRootGroupItemOrder: 10000 for: ClyPackageContextOfFullBrowser
]
{ #category : #activation }
ClyCommitMCPackageCommand class >> fullBrowserShortcutActivation [
<classAnnotation>
^CmdShortcutActivation by: $s meta for: ClyGlobalContextOfFullBrowser
]
{ #category : #accessing }
ClyCommitMCPackageCommand >> defaultMenuIconName [
^#monticelloPackage
]
{ #category : #accessing }
ClyCommitMCPackageCommand >> defaultMenuItemName [
^'Commit'
]
{ #category : #execution }
ClyCommitMCPackageCommand >> execute [
| repoBrowser commitBrowser repos targetRepo |
repoBrowser := self class environment at: #IceTipRepositoriesBrowser ifAbsent: [ ^ self inform: 'Iceberg 0.7 and higher is required' ].
commitBrowser := self class environment at: #IceTipCommitBrowser ifAbsent: [ ^ self inform: 'Iceberg 0.7 and higher is required' ].
packages ifEmpty: [ ^ repoBrowser new openWithSpec ].
repos := IceRepository registry select: [ :repo | packages anySatisfy: [ :each | repo includesPackageNamed: each name ] ].
repos ifEmpty: [ ^ self inform: 'Selected packages are not managed by Iceberg' ].
targetRepo := repos size = 1 ifTrue: [ repos first ] ifFalse: [ UIManager default chooseFrom: (repos collect: [:each | each name]) values: repos title: 'Choose repository' ].
targetRepo ifNil: [ ^ self ].
(targetRepo isMissing or: [
targetRepo isCodeMissing or: [
targetRepo workingCopy isDetached or: [
targetRepo head isDetached or: [
targetRepo workingCopy project isUnborn ] ] ] ])
ifTrue: [ UIManager default
alert:
'The ' , targetRepo name
,
' repository is not operational to commit.
Causes can be:
- The local repository is missing
- The code directory is missing
- The project is in detached head state
- Metadatas are missing.
You can fix this problem using the Iceberg tool.'
title: 'Error'.
^ self ].
(commitBrowser onRepository: targetRepo) openWithSpec
]