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
Boxiang Sun
gitlab-ce
Commits
bb060393
Commit
bb060393
authored
Jul 17, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some formatting cleanup
parent
c16cbed9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
lib/gitlab/bitbucket_server_import/importer.rb
lib/gitlab/bitbucket_server_import/importer.rb
+4
-7
lib/gitlab/bitbucket_server_import/project_creator.rb
lib/gitlab/bitbucket_server_import/project_creator.rb
+1
-2
No files found.
lib/gitlab/bitbucket_server_import/importer.rb
View file @
bb060393
...
@@ -230,9 +230,7 @@ module Gitlab
...
@@ -230,9 +230,7 @@ module Gitlab
def
create_diff_note
(
merge_request
,
comment
,
position
,
discussion_id
=
nil
)
def
create_diff_note
(
merge_request
,
comment
,
position
,
discussion_id
=
nil
)
attributes
=
pull_request_comment_attributes
(
comment
)
attributes
=
pull_request_comment_attributes
(
comment
)
attributes
.
merge!
(
attributes
.
merge!
(
position:
position
,
type:
'DiffNote'
)
position:
position
,
type:
'DiffNote'
)
attributes
[
:discussion_id
]
=
discussion_id
if
discussion_id
attributes
[
:discussion_id
]
=
discussion_id
if
discussion_id
note
=
merge_request
.
notes
.
build
(
attributes
)
note
=
merge_request
.
notes
.
build
(
attributes
)
...
@@ -242,16 +240,15 @@ module Gitlab
...
@@ -242,16 +240,15 @@ module Gitlab
return
note
return
note
end
end
# Fallback to a regular comment
# Bitbucket Server supports the ability to comment on any line, not just the
# line in the diff. If we can't add the note as a DiffNote, fallback to creating
# a regular note.
create_fallback_diff_note
(
merge_request
,
comment
)
create_fallback_diff_note
(
merge_request
,
comment
)
rescue
StandardError
=>
e
rescue
StandardError
=>
e
errors
<<
{
type: :pull_request
,
id:
comment
.
id
,
errors:
e
.
message
}
errors
<<
{
type: :pull_request
,
id:
comment
.
id
,
errors:
e
.
message
}
nil
nil
end
end
# Bitbucket Server supports the ability to comment on any line, not just the
# line in the diff. If we can't add the note as a DiffNote, fallback to creating
# a regular note.
def
create_fallback_diff_note
(
merge_request
,
comment
)
def
create_fallback_diff_note
(
merge_request
,
comment
)
attributes
=
pull_request_comment_attributes
(
comment
)
attributes
=
pull_request_comment_attributes
(
comment
)
attributes
[
:note
]
=
"Comment on file:
#{
comment
.
file_path
}
, old position:
#{
comment
.
old_pos
}
, new_position:
#{
comment
.
new_pos
}
\n\n
"
+
attributes
[
:note
]
attributes
[
:note
]
=
"Comment on file:
#{
comment
.
file_path
}
, old position:
#{
comment
.
old_pos
}
, new_position:
#{
comment
.
new_pos
}
\n\n
"
+
attributes
[
:note
]
...
...
lib/gitlab/bitbucket_server_import/project_creator.rb
View file @
bb060393
...
@@ -26,8 +26,7 @@ module Gitlab
...
@@ -26,8 +26,7 @@ module Gitlab
import_url:
repo
.
clone_url
,
import_url:
repo
.
clone_url
,
import_data:
{
import_data:
{
credentials:
session_data
,
credentials:
session_data
,
data:
{
project_key:
project_key
,
data:
{
project_key:
project_key
,
repo_slug:
repo_slug
}
repo_slug:
repo_slug
}
},
},
skip_wiki:
true
skip_wiki:
true
).
execute
).
execute
...
...
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