-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set upstream branch when creating a branch from a remote-tracking branch
- Loading branch information
Showing
6 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/Squot.package/SqueakWorkingCopy.class/instance/setUpstreamRemoteNameAndRef.for..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
src/Squot.package/SquotBrowser.class/instance/actionCreateBranchAtActiveCommitFromRef..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/Squot.package/SquotBrowser.class/instance/checkSetUpstreamForCreatedBranch.to..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters