Auto-merge: implemented lock file
This commit is contained in:
parent
a8e4f3ed88
commit
5abbada41e
1 changed files with 13 additions and 8 deletions
|
@ -28,6 +28,9 @@ class GitlabMerge
|
||||||
end
|
end
|
||||||
|
|
||||||
def pull
|
def pull
|
||||||
|
File.open(File.join(Rails.root, "tmp", "merge_repo", "#{project.path}.lock"), "w+") do |f|
|
||||||
|
f.flock(File::LOCK_EX)
|
||||||
|
|
||||||
self.project.repo.git.clone({:branch => merge_request.target_branch}, project.url_to_repo, merge_path)
|
self.project.repo.git.clone({:branch => merge_request.target_branch}, project.url_to_repo, merge_path)
|
||||||
#TODO When user do not have permissions then raise exception
|
#TODO When user do not have permissions then raise exception
|
||||||
Dir.chdir(merge_path) do
|
Dir.chdir(merge_path) do
|
||||||
|
@ -37,5 +40,7 @@ class GitlabMerge
|
||||||
output = merge_repo.git.pull({}, "--no-ff", "origin", merge_request.source_branch)
|
output = merge_repo.git.pull({}, "--no-ff", "origin", merge_request.source_branch)
|
||||||
yield(merge_repo, output)
|
yield(merge_repo, output)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue