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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
64c39055
Commit
64c39055
authored
May 31, 2016
by
James Lopez
Committed by
Robert Speicher
Jun 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some refactoring and fixing spec
parent
b2b3e0e6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
app/models/project.rb
app/models/project.rb
+5
-0
app/workers/repository_fork_worker.rb
app/workers/repository_fork_worker.rb
+2
-4
app/workers/repository_import_worker.rb
app/workers/repository_import_worker.rb
+1
-2
No files found.
app/models/project.rb
View file @
64c39055
...
@@ -1017,4 +1017,9 @@ class Project < ActiveRecord::Base
...
@@ -1017,4 +1017,9 @@ class Project < ActiveRecord::Base
builds
.
running_or_pending
.
count
(
:all
)
builds
.
running_or_pending
.
count
(
:all
)
end
end
end
end
def
mark_import_as_failed
(
error_message
)
import_fail
update_column
(
:import_error
,
Gitlab
::
UrlSanitizer
.
sanitize
(
error_message
))
end
end
end
app/workers/repository_fork_worker.rb
View file @
64c39055
...
@@ -15,8 +15,7 @@ class RepositoryForkWorker
...
@@ -15,8 +15,7 @@ class RepositoryForkWorker
result
=
gitlab_shell
.
fork_repository
(
source_path
,
target_path
)
result
=
gitlab_shell
.
fork_repository
(
source_path
,
target_path
)
unless
result
unless
result
logger
.
error
(
"Unable to fork project
#{
project_id
}
for repository
#{
source_path
}
->
#{
target_path
}
"
)
logger
.
error
(
"Unable to fork project
#{
project_id
}
for repository
#{
source_path
}
->
#{
target_path
}
"
)
project
.
update
(
import_error:
"The project could not be forked."
)
project
.
mark_import_as_failed
(
'The project could not be forked.'
)
project
.
import_fail
return
return
end
end
...
@@ -24,8 +23,7 @@ class RepositoryForkWorker
...
@@ -24,8 +23,7 @@ class RepositoryForkWorker
unless
project
.
valid_repo?
unless
project
.
valid_repo?
logger
.
error
(
"Project
#{
project_id
}
had an invalid repository after fork"
)
logger
.
error
(
"Project
#{
project_id
}
had an invalid repository after fork"
)
project
.
update
(
import_error:
"The forked repository is invalid."
)
project
.
mark_import_as_failed
(
'The forked repository is invalid.'
)
project
.
import_fail
return
return
end
end
...
...
app/workers/repository_import_worker.rb
View file @
64c39055
...
@@ -13,8 +13,7 @@ class RepositoryImportWorker
...
@@ -13,8 +13,7 @@ class RepositoryImportWorker
result
=
Projects
::
ImportService
.
new
(
project
,
current_user
).
execute
result
=
Projects
::
ImportService
.
new
(
project
,
current_user
).
execute
if
result
[
:status
]
==
:error
if
result
[
:status
]
==
:error
project
.
update
(
import_error:
Gitlab
::
UrlSanitizer
.
sanitize
(
result
[
:message
]))
project
.
mark_import_as_failed
(
Gitlab
::
UrlSanitizer
.
sanitize
(
result
[
:message
]))
project
.
import_fail
return
return
end
end
...
...
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