Class: GitProc::Syncer
- Inherits:
-
Object
- Object
- GitProc::Syncer
- Defined in:
- lib/git-process/syncer.rb
Class Method Summary collapse
- .do_sync(gitlib, opts) ⇒ Object
- .merge_sync(gitlib, force, local) ⇒ Object
- .rebase_sync(gitlib, stay_local) ⇒ Object
Class Method Details
.do_sync(gitlib, opts) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/git-process/syncer.rb', line 26 def do_sync(gitlib, opts) if !opts[:merge].nil? and opts[:merge] == opts[:rebase] raise ArgumentError.new(":merge = #{opts[:merge]} and :rebase = #{opts[:rebase]}") end local = opts[:local] branch_name = opts[:branch_name] checkout_branch(gitlib, branch_name) unless branch_name.nil? if do_rebase?(gitlib, opts) rebase_sync(gitlib, local) else merge_sync(gitlib, opts[:force], local) end end |
.merge_sync(gitlib, force, local) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/git-process/syncer.rb', line 44 def merge_sync(gitlib, force, local) gitlib.logger.info 'Doing merge-based sync' gitlib.proc_merge(gitlib.config.integration_branch) current_branch = gitlib.branches.current remote_branch = "#{gitlib.remote.name}/#{current_branch}" runner = lambda { merge_sync(gitlib, force, local) } push_to_server(gitlib, current_branch, remote_branch, force, local, runner) end |
.rebase_sync(gitlib, stay_local) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/git-process/syncer.rb', line 56 def rebase_sync(gitlib, stay_local) gitlib.logger.info 'Doing rebase-based sync' current_branch = gitlib.branches.current remote_branch = "#{gitlib.remote.name}/#{current_branch}" runner = lambda { rebase_sync(gitlib, stay_local) } # if the remote branch has changed, bring in those changes in remote_sha = gitlib.previous_remote_sha(current_branch, remote_branch) if remote_sha.nil? gitlib.logger.debug 'There were no changes on the remote branch.' else handle_remote_rebase_changes(current_branch, gitlib, remote_branch, remote_sha, runner, stay_local) end gitlib.proc_rebase(gitlib.config.integration_branch) push_to_server(gitlib, current_branch, remote_branch, true, stay_local, runner) end |