BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ce35dcbc
Commit
ce35dcbc
authored
Mar 08, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor some code
parent
4a0cf269
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
pull_request_formatter.rb
lib/gitlab/github_import/pull_request_formatter.rb
+6
-2
pull_request_formatter_spec.rb
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
+18
-0
No files found.
lib/gitlab/github_import/pull_request_formatter.rb
View file @
ce35dcbc
...
...
@@ -38,8 +38,8 @@ module Gitlab
def
source_branch_name
@source_branch_name
||=
begin
if
source_branch
.
repo
.
id
!=
target_branch
.
repo
.
id
"pull/
#{
number
}
/
#{
source_branch
.
repo
.
full_name
}
/
#{
source_branch_ref
}
"
if
cross_project?
"pull/
#{
number
}
/
#{
source_branch
_
repo
.
full_name
}
/
#{
source_branch_ref
}
"
else
source_branch_exists?
?
source_branch_ref
:
"pull/
#{
number
}
/
#{
source_branch_ref
}
"
end
...
...
@@ -56,6 +56,10 @@ module Gitlab
end
end
def
cross_project?
source_branch
.
repo
.
id
!=
target_branch
.
repo
.
id
end
private
def
state
...
...
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
View file @
ce35dcbc
...
...
@@ -281,6 +281,24 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
end
end
describe
'#cross_project?'
do
context
'when source and target repositories are different'
do
let
(
:raw_data
)
{
double
(
base_data
.
merge
(
head:
forked_branch
))
}
it
'returns true'
do
expect
(
pull_request
.
cross_project?
).
to
eq
true
end
end
context
'when source and target repositories are the same'
do
let
(
:raw_data
)
{
double
(
base_data
.
merge
(
head:
source_branch
))
}
it
'returns false'
do
expect
(
pull_request
.
cross_project?
).
to
eq
false
end
end
end
describe
'#url'
do
let
(
:raw_data
)
{
double
(
base_data
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment