Skip to content

Commit

Permalink
Push current branch instead of active ref
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDoe committed Sep 26, 2023
1 parent 0f0b0ce commit b51334d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
8 changes: 2 additions & 6 deletions src/Squot.package/SquotBrowser.class/instance/actionPull.st
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
actions
actionPull
| headRef branch remoteNameAndRef remoteName remoteRef remote trackingRef |
| branch remoteNameAndRef remoteName remoteRef remote trackingRef |
self activeWorkingCopyIfNilInformAnd: [^ self].
headRef := self activeWorkingCopy headRef.
(headRef isSymbolic and: [
branch := headRef targetRef.
self activeWorkingCopy isSqueakBranchRef: branch])
ifFalse: [^ self inform: 'Cannot pull when not on a branch.'].
branch := self currentBranchIfNilInformAnd: [^ self].
remoteNameAndRef := self activeWorkingCopy upstreamRemoteNameAndRefFor: branch.
remoteNameAndRef ifNil: [^ self].
remoteName := remoteNameAndRef key.
Expand Down
9 changes: 9 additions & 0 deletions src/Squot.package/SquotBrowser.class/instance/actionPush..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
actions
actionPush: refString
self activeWorkingCopyIfNilInformAnd: [^ self].
(self activeWorkingCopy isSqueakBranchRef: refString) ifFalse: [
(UIManager default confirm:
('The active ref ''{1}'' is not a branch. Push anyway?'
format: {refString}))
ifFalse: [^ self]].
self activeWorkingCopy pushRef: refString.
8 changes: 1 addition & 7 deletions src/Squot.package/SquotBrowser.class/instance/actionPush.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
actions
actionPush
self activeWorkingCopyIfNilInformAnd: [^ self].
self activeRef ifNil: [^ self inform: 'Select a ref first.'].
(self activeWorkingCopy isSqueakBranchRef: self activeRef) ifFalse: [
(UIManager default confirm:
('The active ref ''{1}'' is not a branch. Push anyway?'
format: {self activeRef}))
ifFalse: [^ self]].
self activeWorkingCopy pushRef: self activeRef.
self actionPush: (self currentBranchIfNilInformAnd: [^ self]).
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
accessing
currentBranchIfNilInformAnd: aBlock
| branch headRef |
headRef := self activeWorkingCopy headRef.
(headRef isSymbolic and: [
branch := headRef targetRef.
self activeWorkingCopy isSqueakBranchRef: branch])
ifFalse: [self inform: 'Please switch to a branch first.'. ^ aBlock value].
^ branch
6 changes: 4 additions & 2 deletions src/Squot.package/SquotBrowser.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"actionMergeActiveCommit" : "mad 9/21/2023 13:46",
"actionMergeActiveRef" : "mad 9/21/2023 13:45",
"actionNewProject" : "mad 9/21/2023 11:43",
"actionPull" : "mad 9/19/2023 12:29",
"actionPush" : "mad 9/19/2023 12:30",
"actionPull" : "mad 9/26/2023 16:54",
"actionPush" : "mad 9/26/2023 16:58",
"actionPush:" : "mad 9/26/2023 16:57",
"actionRemoveActiveProject" : "mad 9/21/2023 11:55",
"actionResetToActiveCommit" : "mad 9/21/2023 15:40",
"actionSwitchToActiveBranch" : "mad 9/19/2023 12:31",
Expand Down Expand Up @@ -53,6 +54,7 @@
"commitListMenu:" : "mad 9/15/2023 12:15",
"commitListStartingCommits" : "mad 9/19/2023 12:32",
"commitMenu:" : "mad 9/21/2023 16:11",
"currentBranchIfNilInformAnd:" : "mad 9/26/2023 16:56",
"doesRef:comeBeforeRef:" : "mad 9/19/2023 14:45",
"mergeCommitIntoHead:" : "mad 9/21/2023 13:47",
"mergeCommitIntoHead:displayName:" : "mad 9/26/2023 14:10",
Expand Down

0 comments on commit b51334d

Please sign in to comment.