diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-09 02:24:40 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-09 02:24:40 +0300 |
commit | 0a1535a9f44b12accdf3d6585ff7fee53737da51 (patch) | |
tree | d193ab1319244394859a880cb78a3899b68cc815 /lib/gitlab/github_import/pull_request_formatter.rb | |
parent | 44a196f8bc978ec09256abdc67c7e331b07cb7c3 (diff) |
Prefixes removed branches name with PR number when importing PR from GH
Diffstat (limited to 'lib/gitlab/github_import/pull_request_formatter.rb')
-rw-r--r-- | lib/gitlab/github_import/pull_request_formatter.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/gitlab/github_import/pull_request_formatter.rb b/lib/gitlab/github_import/pull_request_formatter.rb index f7f8a4ce984..b84538a090a 100644 --- a/lib/gitlab/github_import/pull_request_formatter.rb +++ b/lib/gitlab/github_import/pull_request_formatter.rb @@ -1,8 +1,8 @@ module Gitlab module GithubImport class PullRequestFormatter < BaseFormatter - delegate :exists?, :name, :project, :repo, :sha, to: :source_branch, prefix: true - delegate :exists?, :name, :project, :repo, :sha, to: :target_branch, prefix: true + delegate :exists?, :project, :ref, :repo, :sha, to: :source_branch, prefix: true + delegate :exists?, :project, :ref, :repo, :sha, to: :target_branch, prefix: true def attributes { @@ -40,10 +40,22 @@ module Gitlab @source_branch ||= BranchFormatter.new(project, raw_data.head) end + def source_branch_name + @source_branch_name ||= begin + source_branch_exists? ? source_branch_ref : "pull/#{number}/#{source_branch_ref}" + end + end + def target_branch @target_branch ||= BranchFormatter.new(project, raw_data.base) end + def target_branch_name + @target_branch_name ||= begin + target_branch_exists? ? target_branch_ref : "pull/#{number}/#{target_branch_ref}" + end + end + private def assigned? |