Skip to content
Snippets Groups Projects
Commit eded4bfa authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Raise exception and show message to user if repo missing satellite

parent eaa8cd28
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -69,6 +69,8 @@ class MergeRequestsController < ProjectResourceController
@merge_request.check_if_can_be_merged
end
render json: {state: @merge_request.human_state}
rescue Gitlab::SatelliteNotExistError
render json: {state: :no_satellite}
end
 
def automerge
Loading
Loading
Loading
Loading
@@ -23,6 +23,11 @@
.clearfix
 
 
.automerge_widget.no_satellite{style: "display:none"}
.alert.alert-error
%span
%strong This repository does not have satellite. Ask administrator to fix this issue
.automerge_widget.cannot_be_merged{style: "display:none"}
.alert.alert-info
%span
Loading
Loading
module Gitlab
class SatelliteNotExistError < StandardError; end
module Satellite
class Satellite
PARKING_BRANCH = "__parking_branch"
Loading
Loading
@@ -9,8 +11,12 @@ module Gitlab
@project = project
end
 
def raise_no_satellite
raise SatelliteNotExistError.new("Satellite doesn't exist")
end
def clear_and_update!
raise "Satellite doesn't exist" unless exists?
raise_no_satellite unless exists?
 
delete_heads!
clear_working_dir!
Loading
Loading
@@ -35,7 +41,7 @@ module Gitlab
# * Changes the current directory to the satellite's working dir
# * Yields
def lock
raise "Satellite doesn't exist" unless exists?
raise_no_satellite unless exists?
 
File.open(lock_file, "w+") do |f|
f.flock(File::LOCK_EX)
Loading
Loading
@@ -55,7 +61,7 @@ module Gitlab
end
 
def repo
raise "Satellite doesn't exist" unless exists?
raise_no_satellite unless exists?
 
@repo ||= Grit::Repo.new(path)
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment