diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-07-16 15:57:41 +0200 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-07-16 17:07:49 +0200 |
commit | 2ef455078e2c6a49a21797c5012dc9d16ddb2be6 (patch) | |
tree | dd4d8857bcda8aecac7b3f1a4f9dbf35c74b6a95 /lib/gitlab/satellite/compare_action.rb | |
parent | de582ab375a1fd04b63ea351aabbff5b31bcad6b (diff) | |
download | gitlab-ce-2ef455078e2c6a49a21797c5012dc9d16ddb2be6.tar.gz |
Gitlab::Git::Compare in Satellite::CompareAction
Diffstat (limited to 'lib/gitlab/satellite/compare_action.rb')
-rw-r--r-- | lib/gitlab/satellite/compare_action.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/gitlab/satellite/compare_action.rb b/lib/gitlab/satellite/compare_action.rb index 9c9e69e3515..6de8a7ab979 100644 --- a/lib/gitlab/satellite/compare_action.rb +++ b/lib/gitlab/satellite/compare_action.rb @@ -17,11 +17,7 @@ module Gitlab in_locked_and_timed_satellite do |target_repo| prepare_satellite!(target_repo) update_satellite_source_and_target!(target_repo) - common_commit = target_repo.git.native(:merge_base, default_options, ["origin/#{@target_branch}", "source/#{@source_branch}"]).strip - #this method doesn't take default options - diffs = target_repo.diff(common_commit, "source/#{@source_branch}") - diffs = diffs.map { |diff| Gitlab::Git::Diff.new(diff) } - diffs + compare(target_repo).diffs end rescue Grit::Git::CommandFailed => ex raise BranchesWithoutParent @@ -32,9 +28,7 @@ module Gitlab in_locked_and_timed_satellite do |target_repo| prepare_satellite!(target_repo) update_satellite_source_and_target!(target_repo) - commits = target_repo.commits_between("origin/#{@target_branch}", "source/#{@source_branch}") - commits = commits.map { |commit| Gitlab::Git::Commit.new(commit, nil) } - commits + compare(target_repo).commits end rescue Grit::Git::CommandFailed => ex handle_exception(ex) @@ -46,10 +40,13 @@ module Gitlab def update_satellite_source_and_target!(target_repo) target_repo.remote_add('source', @source_project.repository.path_to_repo) target_repo.remote_fetch('source') - target_repo.git.checkout(default_options({b: true}), @target_branch, "origin/#{@target_branch}") rescue Grit::Git::CommandFailed => ex handle_exception(ex) end + + def compare(repo) + @compare ||= Gitlab::Git::Compare.new(Gitlab::Git::Repository.new(repo.path), "origin/#{@target_branch}", "source/#{@source_branch}") + end end end end |