Commit d65f0db4 authored by Raphaël Gomès's avatar Raphaël Gomès

remote-mirror: only pull protected branches on Mercurial repositories

--HG--
branch : heptapod
parent 5798b9dd0713
......@@ -42,7 +42,16 @@ def update_mirror(remote_mirror)
# LFS objects must be sent first, or the push has dangling pointers
send_lfs_objects!(remote_mirror) unless project.mercurial?
response = remote_mirror.update_repository
branch_names = nil
if project.mercurial?
# For now only pull protected branches to prevent pulling topics.
# Later on, this will become a (non-default?) option.
branch_names = project.repository.branches.map {|b| b.name}.select do |name|
ProtectedBranch.protected?(project, name)
end
end
response = remote_mirror.update_repository(gitlab_branches: branch_names)
if response.divergent_refs.any?
message = "Some refs have diverged and have not been updated on the remote:"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment