Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
fb98496f
Commit
fb98496f
authored
Aug 06, 2018
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trigger iid logic from GitHub importer for merge requests.
parent
358675d0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
lib/gitlab/github_import/importer/pull_request_importer.rb
lib/gitlab/github_import/importer/pull_request_importer.rb
+7
-1
spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb
...tlab/github_import/importer/pull_request_importer_spec.rb
+10
-0
No files found.
lib/gitlab/github_import/importer/pull_request_importer.rb
View file @
fb98496f
...
@@ -76,7 +76,13 @@ module Gitlab
...
@@ -76,7 +76,13 @@ module Gitlab
merge_request_id
=
GithubImport
merge_request_id
=
GithubImport
.
insert_and_return_id
(
attributes
,
project
.
merge_requests
)
.
insert_and_return_id
(
attributes
,
project
.
merge_requests
)
[
project
.
merge_requests
.
find
(
merge_request_id
),
false
]
merge_request
=
project
.
merge_requests
.
find
(
merge_request_id
)
# We use .insert_and_return_id which effectively disables all callbacks.
# Trigger iid logic here to make sure we track internal id values consistently.
merge_request
.
ensure_target_project_iid!
[
merge_request
,
false
]
end
end
rescue
ActiveRecord
::
InvalidForeignKey
rescue
ActiveRecord
::
InvalidForeignKey
# It's possible the project has been deleted since scheduling this
# It's possible the project has been deleted since scheduling this
...
...
spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb
View file @
fb98496f
...
@@ -111,6 +111,16 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi
...
@@ -111,6 +111,16 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi
expect
(
mr
).
to
be_instance_of
(
MergeRequest
)
expect
(
mr
).
to
be_instance_of
(
MergeRequest
)
expect
(
exists
).
to
eq
(
false
)
expect
(
exists
).
to
eq
(
false
)
end
end
it
'triggers internal_id functionality to track greatest iids'
do
mr
=
build_stubbed
(
:merge_request
,
source_project:
project
,
target_project:
project
)
allow
(
Gitlab
::
GithubImport
).
to
receive
(
:insert_and_return_id
).
and_return
(
mr
.
id
)
allow
(
project
.
merge_requests
).
to
receive
(
:find
).
with
(
mr
.
id
).
and_return
(
mr
)
expect
(
mr
).
to
receive
(
:ensure_target_project_iid!
)
importer
.
create_merge_request
end
end
end
context
'when the author could not be found'
do
context
'when the author could not be found'
do
...
...
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