Skip to content

Commit

Permalink
Add menu items for (un)setting the upstream branch
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDoe committed Dec 13, 2023
1 parent bc724c7 commit 1c2ab02
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
upstream
requestAndRememberRemoteNameAndRefFor: aString
| remoteNameAndRef |
remoteNameAndRef := self requestRemoteNameAndRefFor: aString.
(UIManager default confirm: 'Remember the remote branch for this branch?')
ifTrue: [self setUpstreamRemoteNameAndRef: remoteNameAndRef for: aString].
^ remoteNameAndRef
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ requestRemoteNameAndRefFor: aString
initialAnswer: (self initialRemoteRefNameFor: aString).
ref isEmptyOrNil ifTrue: [^ nil].
ref := self fsgitRepository expandRemoteRef: ref.
(UIManager default confirm: 'Remember the remote branch for this branch?')
ifTrue: [self setUpstreamRemoteName: remoteName andRef: ref for: aString].
^ remoteName -> ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
upstream
setUpstreamRemoteNameAndRefFor: aString
self
setUpstreamRemoteNameAndRef:
((self requestRemoteNameAndRefFor: aString) ifNil: [^ self])
for: aString.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
upstream
upstreamRemoteNameAndRefFor: aString
(self isSqueakBranchRef: aString) ifTrue: [^ self upstreamRemoteNameAndRefForBranch: aString].
^ self requestRemoteNameAndRefFor: aString
^ self requestAndRememberRemoteNameAndRefFor: aString
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ upstreamRemoteNameAndRefForBranch: aString
| remoteName ref |
remoteName := self unitOfWork upstreamRemoteOfBranchNamed: aString.
ref := self unitOfWork upstreamRefOfBranchNamed: aString.
(remoteName isNil or: [ref isNil]) ifTrue: [^ self requestRemoteNameAndRefFor: aString].
(remoteName isNil or: [ref isNil]) ifTrue: [^ self requestAndRememberRemoteNameAndRefFor: aString].
^ remoteName -> ref
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@
"rename" : "mad 12/8/2023 20:04",
"repository" : "mad 11/30/2023 17:02",
"repositoryExists" : "mad 11/30/2023 17:03",
"requestAndRememberRemoteNameAndRefFor:" : "mad 12/13/2023 19:00",
"requestCredentialsFor:ifCanceled:" : "mad 9/18/2023 12:49",
"requestRemoteNameAndRefFor:" : "mad 9/18/2023 20:04",
"requestRemoteNameAndRefFor:" : "mad 12/13/2023 18:59",
"requestUnmappedPathWithTitle:initialAnswer:" : "mad 11/21/2023 14:31",
"serializeChangeSets:onCommit:" : "mad 9/20/2023 12:45",
"setUpstreamRemoteName:andRef:for:" : "mad 12/13/2023 18:28",
"setUpstreamRemoteNameAndRef:for:" : "mad 12/8/2023 19:31",
"setUpstreamRemoteNameAndRefFor:" : "mad 12/13/2023 19:07",
"splitRemoteRef:" : "mad 12/8/2023 19:45",
"unitOfWork" : "mad 6/3/2023 14:15",
"unmappedReferencesIn:do:" : "mad 10/21/2023 23:37",
Expand All @@ -143,6 +145,6 @@
"updateHeadTo:" : "mad 6/9/2023 18:52",
"updateHeadToCommit:" : "mad 6/10/2023 15:00",
"updateHeadToRef:" : "mad 9/13/2023 21:36",
"upstreamRemoteNameAndRefFor:" : "mad 9/18/2023 20:01",
"upstreamRemoteNameAndRefForBranch:" : "mad 9/18/2023 20:02",
"upstreamRemoteNameAndRefFor:" : "mad 12/13/2023 19:01",
"upstreamRemoteNameAndRefForBranch:" : "mad 12/13/2023 19:02",
"withUnitOfWork:" : "mad 8/31/2023 12:58" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
actions
actionSetUpstreamOfActiveBranch
self activeRef ifNil: [^ self inform: 'Please select a branch first.'].
self activeWorkingCopy setUpstreamRemoteNameAndRefFor: self activeRef.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
actions
actionUnsetUpstreamOfActiveBranch
self activeRef ifNil: [^ self inform: 'Please select a branch first.'].
self unitOfWork unsetUpstreamOfBranchNamed: self activeRef.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ refListMenu: aMenu
aMenu
add: ('Delete this {1}' format: {refTypeName}) action: #actionDeleteActiveRef;
addLine.
self commitMenu: aMenu forRef: self activeRef].
self commitMenu: aMenu forRef: self activeRef.
isBranch ifTrue: [
aMenu
addLine;
add: 'Set the remote branch of this branch' action: #actionSetUpstreamOfActiveBranch;
add: 'Unset the remote branch of this branch' action: #actionUnsetUpstreamOfActiveBranch]].
aMenu target: self.
aMenu hasItems ifTrue: [aMenu addLine].
aMenu
Expand Down
4 changes: 3 additions & 1 deletion src/Squot.package/SquotBrowser.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@
"actionResetToActiveCommit" : "mad 11/29/2023 16:38",
"actionResetToActiveCommitAndRestoreIt" : "mad 11/29/2023 16:39",
"actionSelfUpdate" : "mad 10/16/2023 23:03",
"actionSetUpstreamOfActiveBranch" : "mad 12/13/2023 19:04",
"actionSwitchToActiveBranch" : "mad 11/29/2023 16:34",
"actionSwitchToActiveCommit" : "mad 10/22/2023 00:43",
"actionSwitchToBranch:" : "mad 11/29/2023 16:35",
"actionSwitchToCommit:displayName:updateHeadTo:" : "mad 11/7/2023 15:12",
"actionUnsetUpstreamOfActiveBranch" : "mad 12/13/2023 18:57",
"activeCommit" : "mad 9/14/2023 15:24",
"activeCommit:" : "mad 9/14/2023 19:26",
"activeCommitInfo" : "mad 9/14/2023 19:29",
Expand Down Expand Up @@ -97,7 +99,7 @@
"projectListMenu:" : "mad 12/8/2023 17:24",
"refChanged:" : "mad 9/15/2023 11:04",
"refList" : "mad 11/30/2023 21:44",
"refListMenu:" : "mad 11/29/2023 16:16",
"refListMenu:" : "mad 12/13/2023 19:10",
"refTypeName:" : "mad 11/29/2023 15:59",
"requestBranchNameFor:fromRef:" : "mad 11/29/2023 16:11",
"showGitRefs" : "mad 10/16/2023 21:39",
Expand Down

0 comments on commit 1c2ab02

Please sign in to comment.