Skip to content

Commit

Permalink
Add initial rebase implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDoe committed Jan 8, 2024
1 parent bbc8de0 commit 9a49d5b
Show file tree
Hide file tree
Showing 110 changed files with 585 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
actions
actionRebaseOntoActiveCommit
| commits |
self activeWorkingCopyIfNilInformAnd: [^ self].
self activeCommit ifNil: [^ self inform: 'Please select a commit first.'].
commits := GitHistoryWalker new
excludeAncestorsOf: self activeCommit;
startingFrom: self activeWorkingCopy headCommit.
(SquotInteractiveRebase newWithCommits: commits) open.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ commitMenu: aMenu forRef: aStringOrNil
resetLabel := 'Reset branch ''{1}'' to this ', refTypeName format: {GitReference shortName: branch}.
aMenu
add: resetLabel action: #actionResetToActiveCommit;
add: resetLabel, ' and restore it' action: #actionResetToActiveCommitAndRestoreIt].
add: resetLabel, ' and restore it' action: #actionResetToActiveCommitAndRestoreIt;
add: ('Rebase branch ''{1}'' onto this ', refTypeName format: {GitReference shortName: branch})
action: #actionRebaseOntoActiveCommit].
aMenu
addLine;
add: 'Compare this ', refTypeName, ' to its parent commit' action: #actionCompareActiveCommitToParent;
Expand Down
3 changes: 2 additions & 1 deletion src/Squot.package/SquotBrowser.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"actionPull" : "mad 12/13/2023 18:03",
"actionPush" : "mad 9/26/2023 16:58",
"actionPush:" : "mad 9/26/2023 16:57",
"actionRebaseOntoActiveCommit" : "mad 12/5/2023 21:48",
"actionRefreshRefList" : "mad 10/24/2023 19:54",
"actionRemoveActiveProject" : "mad 9/21/2023 11:55",
"actionRenameActiveProject" : "mad 12/8/2023 18:46",
Expand Down Expand Up @@ -74,7 +75,7 @@
"commitList" : "mad 11/30/2023 17:11",
"commitListMenu:" : "mad 11/29/2023 15:58",
"commitListStartingCommits" : "mad 9/19/2023 12:32",
"commitMenu:forRef:" : "mad 11/29/2023 16:49",
"commitMenu:forRef:" : "mad 12/5/2023 21:45",
"currentBranchIfNilInformAnd:" : "mad 9/26/2023 16:56",
"doesRef:comeBeforeRef:" : "mad 9/19/2023 14:45",
"ifRepositoryDoesNotExist:" : "mad 11/30/2023 17:08",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
newWithCommits: aCollection
^ self newWithOperations: (aCollection collect: [:each | SquotRebaseOperationPick newWithCommit: each])
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
newWithOperations: aCollection
^ self new
addAll: aCollection;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
running
actionChangeOperation
self activeOperation ifNil: [^ self inform: 'Please select an operation first.'].
self todoList
at: (self todoList indexOf: self activeOperation)
put: (self activeOperation changeOperation ifNil: [^ self]).
self changed: #todoList.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
running
actionRun
self runNextOperation.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
activeOperation: aRebaseOperation
self assert: (aRebaseOperation isNil or: [self todoList includes: aRebaseOperation]).
activeOperation := aRebaseOperation.
self changed: #activeOperation.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
activeOperation
^ activeOperation
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
addAll: aCollection
self todoList addAll: aCollection.
self changed: #todoList.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
toolbuilder
buildButtons: builder
^ SquotGUIUtilities buildButtons: {
self buildChangeOperationButton: builder.
self buildRunButton: builder.
} with: builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
toolbuilder
buildChangeOperationButton: builder
^ builder pluggableActionButtonSpec new
model: self;
action: #actionChangeOperation;
label: 'Change';
help: 'Change the operation type of the active operation.';
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
toolbuilder
buildLayout: builder
^ SquotGUIUtilities buildVerticalLayout: {
self buildMainLayout: builder.
self buildButtons: builder.
} with: builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
toolbuilder
buildMainLayout: builder
^ self buildTodoList: builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
toolbuilder
buildRunButton: builder
^ builder pluggableActionButtonSpec new
model: self;
action: #actionRun;
label: 'Run';
help: 'Run the next operation.';
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
toolbuilder
buildTodoList: builder
^ builder pluggableTreeSpec new
model: self;
roots: #todoList;
nodeClass: SquotRebaseOperationWrapper;
getSelected: #activeOperation;
setSelected: #activeOperation:;
columns: {
[:listMorph | (listMorph filteredItems collect: [:item |
item preferredWidthOfColumn: 1]) max].
[:listMorph | (listMorph filteredItems collect: [:item |
item preferredWidthOfColumn: 2]) max].
nil.
};
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
toolbuilder
buildWindow: builder
^ builder pluggableWindowSpec new
model: self;
label: #windowTitle;
children: (SquotGUIUtilities windowChild: (self buildLayout: builder));
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
toolbuilder
buildWith: builder
^ builder build: (self buildWindow: builder)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
initialize
super initialize.
self todoList: OrderedCollection new.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
nextOperation
^ self todoList first
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
toolbuilder
open
^ ToolBuilder open: self
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
removeNextOperation
self todoList removeFirst.
self changed: #todoList.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
running
runNextOperation
self nextOperation run.
self removeNextOperation.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
todoList: anOrderedCollection
todoList := anOrderedCollection
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
todoList
^ todoList
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
toolbuilder
windowTitle
^ 'Interactive Rebase'
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"class" : {
"newWithCommits:" : "mad 12/5/2023 21:40",
"newWithOperations:" : "mad 12/5/2023 21:39" },
"instance" : {
"actionChangeOperation" : "mad 12/5/2023 22:18",
"actionRun" : "mad 12/5/2023 21:19",
"activeOperation" : "mad 12/5/2023 21:49",
"activeOperation:" : "mad 12/5/2023 22:18",
"addAll:" : "mad 12/5/2023 22:14",
"buildButtons:" : "mad 12/5/2023 22:08",
"buildChangeOperationButton:" : "mad 12/5/2023 22:08",
"buildLayout:" : "mad 12/5/2023 21:18",
"buildMainLayout:" : "mad 12/5/2023 21:49",
"buildRunButton:" : "mad 12/5/2023 21:19",
"buildTodoList:" : "mad 12/5/2023 21:22",
"buildWindow:" : "mad 12/5/2023 21:17",
"buildWith:" : "mad 12/5/2023 21:17",
"initialize" : "mad 12/5/2023 21:38",
"nextOperation" : "mad 12/5/2023 21:16",
"open" : "mad 12/5/2023 21:44",
"removeNextOperation" : "mad 12/5/2023 21:16",
"runNextOperation" : "mad 12/5/2023 21:16",
"todoList" : "mad 12/5/2023 21:16",
"todoList:" : "mad 12/5/2023 21:38",
"windowTitle" : "mad 12/5/2023 21:18" } }
15 changes: 15 additions & 0 deletions src/Squot.package/SquotInteractiveRebase.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"category" : "Squot-Mapper-Rebase",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"todoList",
"activeOperation" ],
"name" : "SquotInteractiveRebase",
"pools" : [
],
"super" : "Model",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
accessing
chooseCompatibleOperationClass
| classes |
classes := self compatibleOperationClasses.
^ UIManager default
chooseFrom: (classes collect: #operationName)
values: classes
title: 'Choose the new operation type:'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
compatibleOperationClasses
self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
operationName
self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
changeOperation
^ (self class chooseCompatibleOperationClass ifNil: [^ nil]) new
copyFrom: self;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
keepsCommit
^ true
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
operationName
^ self class operationName
4 changes: 4 additions & 0 deletions src/Squot.package/SquotRebaseOperation.class/instance/run.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
run
"TODO"
"self subclassResponsibility."
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
textIcon
^ self keepsCommit ifTrue: ['o'] ifFalse: ['|']
11 changes: 11 additions & 0 deletions src/Squot.package/SquotRebaseOperation.class/methodProperties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"class" : {
"chooseCompatibleOperationClass" : "mad 12/5/2023 22:00",
"compatibleOperationClasses" : "mad 12/5/2023 22:00",
"operationName" : "mad 12/5/2023 21:51" },
"instance" : {
"changeOperation" : "mad 12/5/2023 22:07",
"keepsCommit" : "mad 12/5/2023 21:29",
"operationName" : "mad 12/5/2023 21:51",
"run" : "mad 12/5/2023 21:28",
"textIcon" : "mad 12/5/2023 21:32" } }
14 changes: 14 additions & 0 deletions src/Squot.package/SquotRebaseOperation.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Squot-Mapper-Rebase",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "SquotRebaseOperation",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
operationName
^ 'break'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
keepsCommit
^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
label
^ ''
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"class" : {
"operationName" : "mad 12/5/2023 21:52" },
"instance" : {
"keepsCommit" : "mad 12/5/2023 21:30",
"label" : "mad 12/5/2023 22:02" } }
14 changes: 14 additions & 0 deletions src/Squot.package/SquotRebaseOperationBreak.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Squot-Mapper-Rebase",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "SquotRebaseOperationBreak",
"pools" : [
],
"super" : "SquotRebaseOperation",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
operationName
^ 'drop'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
keepsCommit
^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
"operationName" : "mad 12/5/2023 21:53" },
"instance" : {
"keepsCommit" : "mad 12/5/2023 21:30" } }
14 changes: 14 additions & 0 deletions src/Squot.package/SquotRebaseOperationDrop.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Squot-Mapper-Rebase",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "SquotRebaseOperationDrop",
"pools" : [
],
"super" : "SquotRebaseOperationWithCommit",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
operationName
^ 'edit'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
"operationName" : "mad 12/5/2023 21:54" },
"instance" : {
} }
Loading

0 comments on commit 9a49d5b

Please sign in to comment.