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

Swa UI #343

Draft
wants to merge 20 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion src/BaselineOfSquot.package/.squot-contents
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SquotTrackedObjectMetadata {
#objectClassName : #PackageInfo,
#slotOverrides : { },
#objectsReplacedByNames : true,
#slotOverrides : IdentityDictionary { },
#serializer : #SquotCypressCodeSerializer
}
2 changes: 1 addition & 1 deletion src/FileSystem-Git.package/.squot-contents
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SquotTrackedObjectMetadata {
#objectClassName : #PackageInfo,
#slotOverrides : { },
#objectsReplacedByNames : true,
#slotOverrides : IdentityDictionary { },
#serializer : #SquotCypressCodeSerializer
}
2 changes: 1 addition & 1 deletion src/Squit.package/.squot-contents
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SquotTrackedObjectMetadata {
#objectClassName : #PackageInfo,
#slotOverrides : { },
#objectsReplacedByNames : true,
#slotOverrides : IdentityDictionary { },
#serializer : #SquotCypressCodeSerializer
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
toolbuilder
buildButtonBar: builder
| buttonBar commitButton pullButton pushButton |
buttonBar := builder pluggablePanelSpec new
layout: #horizontal;
"spacing: -1;"
children: OrderedCollection new;
frame: (LayoutFrame new leftFraction: 0 offset: 0;
topFraction: 0.6 offset: -25;
rightFraction: 1 offset: 0;
bottomFraction: 0.6 offset: 0)
yourself.

commitButton := builder pluggableActionButtonSpec new.
commitButton
model: self;
label: 'Commit';
enabled: #hasProjectSelection;
action: #actionCommit;
help: 'Commit your current changes.'.

pullButton := builder pluggableActionButtonSpec new.
pullButton
model: self;
label: 'Pull';
enabled: #hasBranchSelection;
action: #actionPull;
help: 'Pull commits into the active branch from its tracked remote branch.'.

pushButton := builder pluggableActionButtonSpec new.
pushButton
model: self;
label: 'Push';
enabled: #hasBranchSelection;
action: #actionPush;
help: 'Push commits to a remote.'.

buttonBar children addAll: {
commitButton. pushButton. pullButton}.
^ buttonBar
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
toolbuilder
buildCloneButton: builder

| buttonBar cloneButton |
buttonBar := builder pluggablePanelSpec new
layout: #horizontal;
"spacing: -1;"
children: OrderedCollection new;
frame: (LayoutFrame new leftFraction: 0 offset: 0;
topFraction: 0 offset: 0;
rightFraction: 1 offset: 0;
bottomFraction: 0.1 offset: 0)
yourself.

cloneButton := builder pluggableActionButtonSpec new.
cloneButton
model: self;
label: 'Clone';
action: #actionProjectClone;
help: 'Clone a new project.'.

buttonBar children addAll: {cloneButton}.
^ buttonBar
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
toolbuilder
buildCommitList: builder
^ builder pluggableTreeSpec new
model: self;
hScrollBarPolicy: #whenNeeded;
roots: #commitList;
nodeClass: SquitVersionWrapper;
getSelected: #commitSelection;
setSelected: #commitSelection:;
menu: #commitListMenu:;
dragItem: #dragFromCommitList:;
dropAccept: #wantsCommitListDrop:type:from:;
dropItem: #dropOnCommitList:on:copyIndicated:;
keyPress: #commitListKey:from:;
columns: {
[:listMorph | (listMorph filteredItems collect: [:item |
item preferredWidthOfColumn: 1]) max].
[:listMorph | (listMorph filteredItems collect: [:item |
item preferredWidthOfColumn: 2]) max].
nil "take all the space"};
frame: (LayoutFrame new leftFraction: 0 offset: 0;
topFraction: 0 offset: 0;
rightFraction: 1 offset: 0;
bottomFraction: 1 offset: 0)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
toolbuilder
buildCommitSearchPanel: builder
^ builder pluggablePanelSpec new
wantsResizeHandles: true;
model: self;
children: {self buildCommitList: builder".
self buildSearchPanel: builder"};
frame: (LayoutFrame new leftFraction: 0.2 offset: 0;
topFraction: 0 offset: 0;
rightFraction: 1 offset: 0;
bottomFraction: 0.6 offset: -25)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
as yet unclassified
buildObjectList: builder
^ builder pluggableListSpec new
model: self;
list: #objectList;
getIndex: #objectIndex;
setIndex: #objectIndex:;
dragItem: #dragFromObjectList:;
dropAccept: #wantsObjectListDrop:type:from:;
dropItem: #dropOnObjectList:at:copyIndicated:;
frame: ([email protected] corner: 1@1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
toolbuilder
buildProjectBranchPanel: builder
^ builder pluggablePanelSpec new
wantsResizeHandles: true;
model: self;
children: {self buildProjectList: builder.
self buildCloneButton: builder".
self buildBranchList: builder"};
frame: (LayoutFrame new leftFraction: 0 offset: 0;
topFraction: 0 offset: 0;
rightFraction: 0.2 offset: 0;
bottomFraction: 0.6 offset: -25)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
toolbuilder
buildProjectList: builder
^ builder pluggableListSpec new
model: self;
list: #projectList;
getIndex: #projectIndex;
setIndex: #projectIndex:;
dragItem: #dragFromProjectList:;
dropAccept: #wantsProjectListDrop:type:from:;
dropItem: #dropOnProjectList:at:copyIndicated:;
menu: #projectListMenu:;
frame: ([email protected] corner: 1@1)
8 changes: 8 additions & 0 deletions src/Squit.package/SwaSquitBrowser.class/instance/clone.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
actions on working copies
clone
| operation |
operation := SwaSquitInteractiveClone new.
[operation clone]
on: SquitBadRemote do:
[:e | e retry].
Project current addDeferredUIMessage: [self refresh].
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
commitListMenu: aMenu
^ self menu: aMenu for: #(swaMenuCommitList)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
actions
offerToAddFirstProject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
projectListMenu: aMenu
^ self menu: aMenu for: #(swaMenuProjectList)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
as yet unclassified
swaMenuCommitListHook: aMenu
<swaMenuCommitList>
| activeBranchName isMenuOnActiveBranch onlyOnInactiveBranch commands |
self hasProjectSelection ifFalse: [^ aMenu].
aMenu addTitle: (self commitSelection printStringLimitedTo: 50).
self withUnitOfWork:
[activeBranchName := self projectSelection loadedHistorian shortName.
isMenuOnActiveBranch := selectedHistorian = self projectSelection loadedHistorian.
onlyOnInactiveBranch := selectedHistorian ~= self projectSelection loadedHistorian.
commands := {
{'Checkout objects'. #actionCommitSelectionCheckout. 'Checkout objects from this commit. You will be able to select what will actually be loaded.', String cr, 'NOTE: unless you change the selection, your uncommitted changes will be reverted, so that what is loaded matches the objects in this commit!'}.
{'Merge objects'. #actionCommitMergeIntoMemory. 'Merge objects from this commit with the loaded ones. You may use this to pick objects or changes from this commit without discarding your uncommitted changes.'}.
'-'.
{'Compare with parent commit'. #actionCommitDiffWithParent}.
{'Compare with next selected commit'. #actionCommitDiffWithNextSelected. 'The next commit you select will be the origin of a diff against this commit.'}.
{'Compare with working copy'. #actionCommitDiffWithWorkingCopy}.
}.
self buildMenu: aMenu from: commands].
^ aMenu
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
as yet unclassified
swaMenuProjectListHook: aMenu
<swaMenuProjectList>
<menuPriority: 100>
| submenu |
self projectSelection
ifNil: [submenu := aMenu]
ifNotNil: [submenu := aMenu class new
defaultTarget: aMenu defaultTarget;
yourself].
^ aMenu
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
as yet unclassified
swaMenuProjectListWorkingCopyHook: aMenu
<swaMenuProjectList>
<menuPriority: 50>
self projectSelection ifNil: [^ aMenu].
aMenu addTitle: 'Working copy of ', self projectSelection name.
aMenu addList: {
{'Rename project'. #actionProjectRename}.
{'Remove project'. #actionProjectRemove}.
}.
aMenu addLine.
aMenu
addList: {
{'Add or remove packages'. #actionAddOrRemoveTrackedPackages. 'Add or remove packages for this project.'}
}.
aMenu addLine.
aMenu addList: {
{'Edit credentials for project'. #actionCredentialsEdit}.
{'Edit project-level git user name/email'. #actionGitUserEdit}
}.
^ aMenu
18 changes: 18 additions & 0 deletions src/Squit.package/SwaSquitBrowser.class/methodProperties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"class" : {
},
"instance" : {
"buildButtonBar:" : "ek 7/17/2021 12:07",
"buildCloneButton:" : "ek 7/17/2021 11:32",
"buildCommitList:" : "ek 7/17/2021 11:11",
"buildCommitSearchPanel:" : "ek 7/17/2021 11:09",
"buildObjectList:" : "ek 7/17/2021 13:20",
"buildProjectBranchPanel:" : "ek 7/17/2021 11:25",
"buildProjectList:" : "ek 7/17/2021 11:30",
"clone" : "ek 7/17/2021 11:50",
"commitListMenu:" : "ek 7/17/2021 13:04",
"offerToAddFirstProject" : "ek 7/17/2021 11:37",
"projectListMenu:" : "ek 7/17/2021 13:11",
"swaMenuCommitListHook:" : "ek 7/17/2021 13:04",
"swaMenuProjectListHook:" : "ek 7/17/2021 13:18",
"swaMenuProjectListWorkingCopyHook:" : "ek 7/17/2021 13:19" } }
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"category" : "SquotTonel-Tests",
"category" : "Squit-Hackday",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "SquotTonelSerializerTest",
"name" : "SwaSquitBrowser",
"pools" : [
],
"super" : "TestCase",
"super" : "SquitBrowser",
"type" : "normal" }
3 changes: 3 additions & 0 deletions src/Squit.package/SwaSquitBrowserNew.class/class/open.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
open
ToolBuilder open: self new
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
as yet unclassified
actionCloneAndMerge

| operation |
operation := SwaSquitInteractiveClone new.
[operation clone] on: SquitBadRemote do: [:e | e retry].
self changed: #repositoryList.
self selectRepository: operation repository.
self actionMergeInteractive: false.
Project current addDeferredUIMessage: [self refresh].
self browseRepository.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
actions
actionCommitAndPush

self actionCommitAndThenDo: [self actionPush].
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
as yet unclassified
actionCommitAndThenDo: aBlock

| workingCopy |
self hasSelectedRepository ifFalse: [^ self].

workingCopy := self selectedRepository.
self withUnitOfWork: [
[SquotGUI waitFor:
((workingCopy newInteractiveSaveOperation
title: 'Select changes and message for the new version';
applyToWorkingCopy)
then: [:result | self refresh. aBlock value]
ifRejected: [:reason | nil])]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recently fixed an issue here in the original method. See #341

on: BrokenPromise do: [:e | e ifNotError: []]].
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions
actionFetch

| workingCopy |
workingCopy := self selectedRepository.
self withUnitOfWork: [self fetch: workingCopy].
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions
actionFetchAndMerge

self
actionFetch;
actionMerge.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
actions
actionMerge

^ self actionMergeInteractive: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
actions
actionMergeInteractive: aBoolean

self withUnitOfWork: [
self selectedRepository
loadVersion: self selectedCommit
interactive: aBoolean].
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadVersion does not merge, it is rather like checkout or reset. Did you intend to use some flavor of mergeVersion instead?

13 changes: 13 additions & 0 deletions src/Squit.package/SwaSquitBrowserNew.class/instance/actionPush.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
as yet unclassified
actionPush

self withUnitOfWork: [
| historian |
historian := self selectedRepository loadedHistorian.
[[(SquitInteractivePushToUpstream historian: historian) push]
on: SquitBadRemote do:
[:e |
Project current addDeferredUIMessage: [self error: 'bad remote: ' , e remote].
e resume]]
on: SquotCannotExportEmptyHistory do:
[self inform: 'No commits to push on ', historian shortName, ' yet.'].].
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
as yet unclassified
addRepository

| operation |
operation := SwaSquitInteractiveClone new.
[operation clone] on: SquitBadRemote do: [:e | e retry].
Project current addDeferredUIMessage: [self refresh]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
browseRepository

((self selectedRepository ifNil: [^ self]) store artifacts collect: #object) detect: [:artifact | artifact isKindOf: PackageInfo] ifFound: #browse
Loading