Module: GitlabLocal::CodeReview

Included in:
GitlabLocalRepository
Defined in:
lib/git/gitlab/local/codereview.rb

Instance Method Summary collapse

Instance Method Details

#review(title, source, target, remote) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/git/gitlab/local/codereview.rb', line 9

def review(title ,source, target, remote)
  status = @repository.status
  is_modified = status.added.count > 0  ||
    status.changed.count >0 ||
    status.deleted.count >0
  if is_modified
    raise GitlabApi::Error::ReviewError, `git status`
  end

  puts(`git fetch #{remote}`)
  puts(`git checkout -b #{title} #{remote}/#{target}`)
  puts(`git merge --no-ff --no-commit #{remote}/#{source}`)
end