Skip to content

Commit

Permalink
Merge pull request #1035 from pharo-vcs/859-set-upstream
Browse files Browse the repository at this point in the history
859-set-upstream
  • Loading branch information
guillep authored Oct 29, 2018
2 parents a0a0567 + f787222 commit a924866
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
private-pushing
basicPushTo: aRemote
| gitRemote |

gitRemote := (LGitRemote of: self repositoryHandle named: aRemote name) lookup.
[
| pushProgress |
pushProgress := IcePushTransferProgress new.
"Push branch"
self
pushBranchToRemote: aRemote
gitRemote: gitRemote
progress: pushProgress.
"Push tags"
self
pushTagsToRemote: aRemote
gitRemote: gitRemote
progress: pushProgress.

"Verify we have an stream"
self setUpstreamIfMissing: aRemote ]
on: LGit_GIT_ENONFASTFORWARD
do: [ :e |
e resignalAs: (IceRemoteDesynchronized new
remote: aRemote;
yourself) ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
private-pushing
pushBranchToRemote: aRemote gitRemote: gitRemote progress: pushProgress

gitRemote
pushWithRefSpec: (LGitRefSpec new
source: self fullname;
destination: self fullname;
yourself)
pushOptions: (LGitPushOptions defaults
callbacks: ((LGitRemoteCallbacks withProvider: (IceCredentialsProvider defaultForRemote: aRemote))
pushTransferProgress: pushProgress;
yourself);
yourself)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
private-pushing
pushTag: tag toRemote: aRemote gitRemote: gitRemote progress: pushProgress

gitRemote
pushWithRefSpec: (LGitRefSpec new
source: 'refs/tags/' , tag name;
destination: 'refs/tags/' , tag name;
yourself)
pushOptions: (LGitPushOptions defaults
callbacks: ((LGitRemoteCallbacks withProvider: (IceCredentialsProvider defaultForRemote: aRemote))
pushTransferProgress: pushProgress;
yourself);
yourself)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
private-pushing
pushTagsToRemote: aRemote gitRemote: gitRemote progress: pushProgress

self tags do: [ :tag |
self
pushTag: tag
toRemote: aRemote
gitRemote: gitRemote
progress: pushProgress ]
44 changes: 2 additions & 42 deletions Iceberg-Libgit.package/IceGitLocalBranch.class/instance/pushTo..st
Original file line number Diff line number Diff line change
@@ -1,45 +1,5 @@
API-remotes
pushTo: aRemote

repository
handleLibgitError: [ | gitRemote |
gitRemote := (LGitRemote of: self repositoryHandle named: aRemote name) lookup.
[
| pushProgress |
pushProgress := IcePushTransferProgress new.
gitRemote
pushWithRefSpec:
(LGitRefSpec new
source: self fullname;
destination: self fullname;
yourself)
pushOptions:
(LGitPushOptions defaults
callbacks: ((LGitRemoteCallbacks withProvider: (IceCredentialsProvider defaultForRemote: aRemote))
pushTransferProgress: pushProgress;
yourself );
yourself).

"Push tags!"
self tags
do: [ :tag |
| tagProgress |
gitRemote
pushWithRefSpec:
(LGitRefSpec new
source: 'refs/tags/' , tag name;
destination: 'refs/tags/' , tag name;
yourself)
pushOptions:
(LGitPushOptions defaults
callbacks: ((LGitRemoteCallbacks withProvider: (IceCredentialsProvider defaultForRemote: aRemote))
pushTransferProgress: pushProgress;
yourself);
yourself) ] ]
on: LGit_GIT_ENONFASTFORWARD
do: [ :e |
e
resignalAs:
(IceRemoteDesynchronized new
remote: aRemote;
yourself) ] ]
repository handleLibgitError: [
self basicPushTo: aRemote ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
private-pushing
setUpstreamIfMissing: aRemote

self hasUpstream ifTrue: [ ^ self ].
self setUpstream: (aRemote remoteBranchNamed: self gitRef)

0 comments on commit a924866

Please sign in to comment.