-
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.
- Loading branch information
Showing
14 changed files
with
105 additions
and
59 deletions.
There are no files selected for viewing
6 changes: 4 additions & 2 deletions
6
....class/instance/externalPush.toRemote..st → .../instance/externalPush.toRemote.force..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,5 +1,7 @@ | ||
git porcelain - external | ||
externalPush: aCollectionOfBranchNamesAndAssociations toRemote: remoteName | ||
externalPush: aCollectionOfBranchNamesAndAssociations toRemote: remoteName force: forceBoolean | ||
aCollectionOfBranchNamesAndAssociations do: [:branch | | ||
self externalGitDo: ('push {1} {2}:{3}' format: {remoteName. branch key. branch value})]. | ||
self externalGitDo: ('push {1}{2} {3}:{4}' format: { | ||
forceBoolean ifTrue: ['-f '] ifFalse: ['']. | ||
remoteName. branch key. branch value})]. | ||
self repository changed: #allReferences. |
16 changes: 1 addition & 15 deletions
16
src/FileSystem-Git.package/FileSystemGitRepository.class/instance/push.toRemote..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,17 +1,3 @@ | ||
git porcelain | ||
push: aCollectionOfBranchNamesAndAssociations toRemote: remoteName | ||
"self push: { 'master' } toRemote: 'origin'. | ||
self push: { 'branch' -> 'remoteBranchName' } toRemote: 'origin'" | ||
GitFeatureFlags externalFetchAndPush | ||
ifTrue: [self externalPush: aCollectionOfBranchNamesAndAssociations toRemote: remoteName] | ||
ifFalse: [ | ||
[self | ||
pushToRemote: remoteName | ||
update: aCollectionOfBranchNamesAndAssociations | ||
deleteRemoteBranches: Array empty] | ||
on: ConnectionClosed | ||
do: [:exception | | ||
self | ||
handleConnectionClosed: exception | ||
whileTryingTo: 'push' | ||
ifRetry: [self push: aCollectionOfBranchNamesAndAssociations toRemote: remoteName]]] | ||
self push: aCollectionOfBranchNamesAndAssociations toRemote: remoteName force: false |
24 changes: 24 additions & 0 deletions
24
src/FileSystem-Git.package/FileSystemGitRepository.class/instance/push.toRemote.force..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,24 @@ | ||
git porcelain | ||
push: aCollectionOfBranchNamesAndAssociations toRemote: remoteName force: forceBoolean | ||
"self push: { 'master' } toRemote: 'origin'. | ||
self push: { 'branch' -> 'remoteBranchName' } toRemote: 'origin'" | ||
GitFeatureFlags externalFetchAndPush | ||
ifTrue: [self | ||
externalPush: aCollectionOfBranchNamesAndAssociations | ||
toRemote: remoteName | ||
force: forceBoolean] | ||
ifFalse: [ | ||
[self | ||
pushToRemote: remoteName | ||
update: aCollectionOfBranchNamesAndAssociations | ||
deleteRemoteBranches: Array empty | ||
force: forceBoolean] | ||
on: ConnectionClosed | ||
do: [:exception | | ||
self | ||
handleConnectionClosed: exception | ||
whileTryingTo: 'push' | ||
ifRetry: [self | ||
push: aCollectionOfBranchNamesAndAssociations | ||
toRemote: remoteName | ||
force: forceBoolean]]] |
32 changes: 5 additions & 27 deletions
32
...ckage/FileSystemGitRepository.class/instance/pushToRemote.update.deleteRemoteBranches..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,29 +1,7 @@ | ||
git porcelain | ||
pushToRemote: remoteName update: aCollectionOfBranchNamesAndAssociations deleteRemoteBranches: aCollectionOfRemoteBranchNames | ||
| remote url protocol updateRefs deleteRefs report | | ||
remote := self unitOfWork remoteNamed: remoteName. | ||
url := remote url. | ||
updateRefs := aCollectionOfBranchNamesAndAssociations collect: [:each | | ||
each value == each | ||
ifTrue: [(self unitOfWork expandRef: each) -> (self unitOfWork objectReferenced: each)] | ||
ifFalse: [(self expandRemoteRef: each value) "remote name" -> (self unitOfWork objectReferenced: each key "local name")]]. | ||
(updateRefs detect: [:each | each value isNil] ifNone: []) ifNotNil: | ||
[:badUpdate | GitRefDoesNotExistYet new | ||
repository: repository; | ||
missingRef: badUpdate key; | ||
signal: 'Nothing to push for ', badUpdate key asString]. | ||
deleteRefs := aCollectionOfRemoteBranchNames collect: [:each | self expandRemoteRef: each]. | ||
protocol := GitAbstractProtocol url: url. | ||
protocol remote: remote. | ||
report := protocol pushReferences: updateRefs of: repository deleting: deleteRefs. | ||
updateRefs do: [:refAndCommit | | ||
(report successes includes: refAndCommit key) ifTrue: | ||
[self unitOfWork | ||
updateRef: refAndCommit key | ||
ofRemote: remoteName | ||
to: refAndCommit value hexHash | ||
message: 'update by push']]. | ||
deleteRefs do: [:each | | ||
(report successes includes: each) ifTrue: | ||
[self unitOfWork deleteRef: | ||
(self unitOfWork refName: each forRemote: remoteName)]]. | ||
^ self | ||
pushToRemote: remoteName | ||
update: aCollectionOfBranchNamesAndAssociations | ||
deleteRemoteBranches: aCollectionOfRemoteBranchNames | ||
force: false |
34 changes: 34 additions & 0 deletions
34
...FileSystemGitRepository.class/instance/pushToRemote.update.deleteRemoteBranches.force..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,34 @@ | ||
git porcelain | ||
pushToRemote: remoteName update: aCollectionOfBranchNamesAndAssociations deleteRemoteBranches: aCollectionOfRemoteBranchNames force: forceBoolean | ||
| remote url protocol updateRefs deleteRefs pushBlock report | | ||
remote := self unitOfWork remoteNamed: remoteName. | ||
url := remote url. | ||
updateRefs := aCollectionOfBranchNamesAndAssociations collect: [:each | | ||
each value == each | ||
ifTrue: [(self unitOfWork expandRef: each) -> (self unitOfWork objectReferenced: each)] | ||
ifFalse: [(self expandRemoteRef: each value) "remote name" -> (self unitOfWork objectReferenced: each key "local name")]]. | ||
(updateRefs detect: [:each | each value isNil] ifNone: []) ifNotNil: | ||
[:badUpdate | GitRefDoesNotExistYet new | ||
repository: repository; | ||
missingRef: badUpdate key; | ||
signal: 'Nothing to push for ', badUpdate key asString]. | ||
deleteRefs := aCollectionOfRemoteBranchNames collect: [:each | self expandRemoteRef: each]. | ||
protocol := GitAbstractProtocol url: url. | ||
protocol remote: remote. | ||
pushBlock := [protocol pushReferences: updateRefs of: repository deleting: deleteRefs]. | ||
report := forceBoolean | ||
ifTrue: [pushBlock | ||
on: GitNonFastForwardPushUpdatesDetected | ||
do: [:notification | notification proceedWithForcedPush]] | ||
ifFalse: [pushBlock value]. | ||
updateRefs do: [:refAndCommit | | ||
(report successes includes: refAndCommit key) ifTrue: | ||
[self unitOfWork | ||
updateRef: refAndCommit key | ||
ofRemote: remoteName | ||
to: refAndCommit value hexHash | ||
message: 'update by push']]. | ||
deleteRefs do: [:each | | ||
(report successes includes: each) ifTrue: | ||
[self unitOfWork deleteRef: | ||
(self unitOfWork refName: each forRemote: remoteName)]]. |
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
4 changes: 2 additions & 2 deletions
4
...eakWorkingCopy.class/instance/pushRef..st → ...kingCopy.class/instance/pushRef.force..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,7 +1,7 @@ | ||
git-operations | ||
pushRef: aString | ||
pushRef: aString force: forceBoolean | ||
| remoteAndRef | | ||
remoteAndRef := self upstreamRemoteNameAndRefFor: aString. | ||
remoteAndRef ifNil: [^ self]. | ||
self handleCredentialsDuring: [ | ||
self fsgitRepository push: {aString -> remoteAndRef value} toRemote: remoteAndRef key] | ||
self fsgitRepository push: {aString -> remoteAndRef value} toRemote: remoteAndRef key force: forceBoolean] |
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
5 changes: 5 additions & 0 deletions
5
src/Squot.package/SquotBrowser.class/instance/actionForcePush..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,5 @@ | ||
actions | ||
actionForcePush: refString | ||
(self confirm: 'Do you really want to force push? This might discard commits made by other members of your team.') | ||
ifFalse: [^ self]. | ||
^ self actionPush: refString force: true |
4 changes: 4 additions & 0 deletions
4
src/Squot.package/SquotBrowser.class/instance/actionForcePush.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,4 @@ | ||
actions | ||
actionForcePush | ||
self activeWorkingCopyIfNilInformAnd: [^ self]. | ||
self actionForcePush: (self currentBranchIfNilInformAnd: [^ self]). |
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,9 +1,3 @@ | ||
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. | ||
^ self actionPush: refString force: false |
9 changes: 9 additions & 0 deletions
9
src/Squot.package/SquotBrowser.class/instance/actionPush.force..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,9 @@ | ||
actions | ||
actionPush: refString force: aBoolean | ||
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 force: aBoolean. |
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
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