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
Tatuya Kamada
gitlab-ce
Commits
ab06313c
Commit
ab06313c
authored
Dec 16, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Project#gitea_import?
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
e046e4c1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
5 deletions
+21
-5
app/models/project.rb
app/models/project.rb
+4
-0
lib/gitlab/github_import/importer.rb
lib/gitlab/github_import/importer.rb
+3
-3
lib/gitlab/github_import/milestone_formatter.rb
lib/gitlab/github_import/milestone_formatter.rb
+1
-1
spec/lib/gitlab/github_import/importer_spec.rb
spec/lib/gitlab/github_import/importer_spec.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+12
-0
No files found.
app/models/project.rb
View file @
ab06313c
...
...
@@ -533,6 +533,10 @@ class Project < ActiveRecord::Base
import_type
==
'gitlab_project'
end
def
gitea_import?
import_type
==
'gitea'
end
def
check_limit
unless
creator
.
can_create_project?
or
namespace
.
kind
==
'group'
projects_limit
=
creator
.
projects_limit
...
...
lib/gitlab/github_import/importer.rb
View file @
ab06313c
...
...
@@ -22,7 +22,7 @@ module Gitlab
opts
=
{}
# Gitea plan to be GitHub compliant
if
project
.
import_type
==
'gitea'
if
project
.
gitea_import?
uri
=
URI
.
parse
(
project
.
import_url
)
host
=
"
#{
uri
.
scheme
}
://
#{
uri
.
host
}
:
#{
uri
.
port
}#{
uri
.
path
}
"
.
sub
(
%r{/?[
\w
-]+/[
\w
-]+
\.
git
\z
}
,
''
)
opts
=
{
...
...
@@ -53,7 +53,7 @@ module Gitlab
# Gitea doesn't have a Release API yet
# See https://github.com/go-gitea/gitea/issues/330
unless
project
.
import_type
==
'gitea'
unless
project
.
gitea_import?
import_releases
end
...
...
@@ -141,7 +141,7 @@ module Gitlab
merge_request
=
gh_pull_request
.
create!
# Gitea doesn't return PR in the Issue API endpoint, so labels must be assigned at this stage
if
project
.
import_type
==
'gitea'
if
project
.
gitea_import?
apply_labels
(
merge_request
,
raw
)
end
rescue
=>
e
...
...
lib/gitlab/github_import/milestone_formatter.rb
View file @
ab06313c
...
...
@@ -23,7 +23,7 @@ module Gitlab
end
def
number
if
project
.
import_type
==
'gitea'
if
project
.
gitea_import?
raw_data
.
id
else
raw_data
.
number
...
...
spec/lib/gitlab/github_import/importer_spec.rb
View file @
ab06313c
...
...
@@ -192,7 +192,7 @@ describe Gitlab::GithubImport::Importer, lib: true do
]
}
unless
project
.
import_type
==
'gitea'
unless
project
.
gitea_import?
error
[
:errors
]
<<
{
type: :release
,
url:
"
#{
api_root
}
/repos/octocat/Hello-World/releases/2"
,
errors:
"Validation failed: Description can't be blank"
}
end
...
...
spec/models/project_spec.rb
View file @
ab06313c
...
...
@@ -1458,6 +1458,18 @@ describe Project, models: true do
end
end
describe
'#gitlab_project_import?'
do
subject
(
:project
)
{
build
(
:project
,
import_type:
'gitlab_project'
)
}
it
{
expect
(
project
.
gitlab_project_import?
).
to
be
true
}
end
describe
'#gitea_import?'
do
subject
(
:project
)
{
build
(
:project
,
import_type:
'gitea'
)
}
it
{
expect
(
project
.
gitea_import?
).
to
be
true
}
end
describe
'#lfs_enabled?'
do
let
(
:project
)
{
create
(
:project
)
}
...
...
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