Skip to content

Commit

Permalink
Set upstream branch when creating a branch from a remote-tracking branch
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDoe committed Dec 8, 2023
1 parent 42534e8 commit bebe72c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
upstream
setUpstreamRemoteNameAndRef: aStringAssociation for: aString
self
setUpstreamRemoteName: aStringAssociation key
andRef: aStringAssociation value
for: aString.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
"requestUnmappedPathWithTitle:initialAnswer:" : "mad 11/21/2023 14:31",
"serializeChangeSets:onCommit:" : "mad 9/20/2023 12:45",
"setUpstreamRemoteName:andRef:for:" : "mad 9/18/2023 20:01",
"setUpstreamRemoteNameAndRef:for:" : "mad 12/8/2023 19:31",
"splitRemoteRef:" : "mad 12/8/2023 19:28",
"unitOfWork" : "mad 6/3/2023 14:15",
"unmappedReferencesIn:do:" : "mad 10/21/2023 23:37",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
actions
actionCreateBranchAtActiveCommitFromRef: aStringOrNil
| name |
| name branch |
self activeWorkingCopyIfNilInformAnd: [^ nil].
self activeCommit ifNil: [^ self inform: 'Please select a commit first.'].
name := self requestBranchNameFor: 'a branch' fromRef: aStringOrNil.
name isEmptyOrNil ifTrue: [^ self].
^ self activeWorkingCopy createBranchNamed: name at: self activeCommit
branch := self activeWorkingCopy createBranchNamed: name at: self activeCommit.
self checkSetUpstreamForCreatedBranch: branch to: aStringOrNil.
^ branch
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ actionCreateGitBranchAtActiveCommitFromRef: aStringOrNil
updateRef: gitRef
to: commit
message: 'export from squeak'.
aStringOrNil ifNotNil: [self checkSetUpstreamForCreatedBranch: gitRef to: aStringOrNil].
^ gitRef
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
actions
checkSetUpstreamForCreatedBranch: aString to: anotherString
(self activeWorkingCopy isRemoteRef: anotherString) ifFalse: [^ self].
(self confirm:
('You created a branch ''{1}'' from the remote-tracking branch ''{2}''. ',
'Do you want to set the upstream branch of ''{1}'' to ''{2}''?'
format: ({aString. anotherString} collect: [:each | GitReference shortName: each])))
ifFalse: [^ self].
self activeWorkingCopy
setUpstreamRemoteNameAndRef: (self activeWorkingCopy splitRemoteRef: anotherString)
for: aString.
5 changes: 3 additions & 2 deletions src/Squot.package/SquotBrowser.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"actionCompareActiveCommitToParent" : "mad 10/22/2023 00:57",
"actionCreateBranchAtActiveCommit" : "mad 11/29/2023 16:11",
"actionCreateBranchAtActiveCommitAndSwitchToIt" : "mad 11/29/2023 16:35",
"actionCreateBranchAtActiveCommitFromRef:" : "mad 11/29/2023 16:31",
"actionCreateBranchAtActiveCommitFromRef:" : "mad 12/8/2023 19:16",
"actionCreateBranchAtActiveRef" : "mad 11/29/2023 16:13",
"actionCreateBranchAtActiveRefAndSwitchToIt" : "mad 11/29/2023 16:36",
"actionCreateGitBranchAtActiveCommit" : "mad 11/29/2023 16:32",
"actionCreateGitBranchAtActiveCommitFromRef:" : "mad 11/29/2023 16:31",
"actionCreateGitBranchAtActiveCommitFromRef:" : "mad 12/8/2023 19:41",
"actionCreateGitBranchAtActiveRef" : "mad 11/29/2023 16:32",
"actionDeleteActiveRef" : "mad 10/16/2023 22:43",
"actionFetchAll" : "mad 9/19/2023 12:29",
Expand Down Expand Up @@ -68,6 +68,7 @@
"buildUpperLayout:" : "mad 9/19/2023 12:12",
"buildWindow:" : "mad 9/15/2023 16:22",
"buildWith:" : "mad 9/1/2023 14:44",
"checkSetUpstreamForCreatedBranch:to:" : "mad 12/8/2023 19:33",
"commitList" : "mad 11/30/2023 17:11",
"commitListMenu:" : "mad 11/29/2023 15:58",
"commitListStartingCommits" : "mad 9/19/2023 12:32",
Expand Down

0 comments on commit bebe72c

Please sign in to comment.