Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
heptapod
heptapod
Commits
f6d3cd87b230
Commit
d65f0db4
authored
Dec 09, 2020
by
Raphaël Gomès
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remote-mirror: only pull protected branches on Mercurial repositories
--HG-- branch : heptapod
parent
5798b9dd0713
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
app/services/projects/update_remote_mirror_service.rb
app/services/projects/update_remote_mirror_service.rb
+10
-1
No files found.
app/services/projects/update_remote_mirror_service.rb
View file @
f6d3cd87
...
...
@@ -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:"
...
...
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