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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c0a78957
Commit
c0a78957
authored
Dec 01, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds skip_branch method to remote mirror update service
parent
cf6fbda0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
14 deletions
+7
-14
ee/app/services/projects/update_mirror_service.rb
ee/app/services/projects/update_mirror_service.rb
+1
-1
ee/app/services/projects/update_remote_mirror_service.rb
ee/app/services/projects/update_remote_mirror_service.rb
+4
-6
spec/lib/gitlab/background_migration/populate_fork_networks_range_spec.rb
...background_migration/populate_fork_networks_range_spec.rb
+1
-6
spec/services/projects/update_mirror_service_spec.rb
spec/services/projects/update_mirror_service_spec.rb
+1
-1
No files found.
ee/app/services/projects/update_mirror_service.rb
View file @
c0a78957
...
...
@@ -102,7 +102,7 @@ module Projects
end
def
skip_branch?
(
name
)
project
.
only_mirror_protected_branches
&&
!
ProtectedBranch
.
protected?
(
project
,
name
)
project
.
only_mirror_protected_branches
&&
!
ProtectedBranch
.
protected?
(
project
,
name
)
end
end
end
ee/app/services/projects/update_remote_mirror_service.rb
View file @
c0a78957
...
...
@@ -31,9 +31,7 @@ module Projects
def
local_branches
@local_branches
||=
repository
.
local_branches
.
each_with_object
({})
do
|
branch
,
branches
|
next
if
mirror
.
only_protected_branches?
&&
!
protected_branch?
(
branch
.
name
)
branches
[
branch
.
name
]
=
branch
branches
[
branch
.
name
]
=
branch
unless
skip_branch?
(
branch
.
name
)
end
end
...
...
@@ -115,7 +113,7 @@ module Projects
remote_refs
.
each_with_object
([])
do
|
(
name
,
remote_ref
),
refs_to_delete
|
next
if
local_refs
[
name
]
# skip if branch or tag exist in local repo
next
if
type
==
:branches
&&
mirror
.
only_protected_branches?
&&
!
protected
_branch?
(
name
)
next
if
type
==
:branches
&&
skip
_branch?
(
name
)
remote_ref_id
=
remote_ref
.
dereferenced_target
.
try
(
:id
)
...
...
@@ -125,8 +123,8 @@ module Projects
end
end
def
protected
_branch?
(
name
)
ProtectedBranch
.
protected?
(
project
,
name
)
def
skip
_branch?
(
name
)
mirror
.
only_protected_branches?
&&
!
ProtectedBranch
.
protected?
(
project
,
name
)
end
end
end
spec/lib/gitlab/background_migration/populate_fork_networks_range_spec.rb
View file @
c0a78957
...
...
@@ -63,14 +63,9 @@ describe Gitlab::BackgroundMigration::PopulateForkNetworksRange, :migration, sch
expect
(
base2_membership
).
not_to
be_nil
end
<<<<<<<
HEAD
it
'creates a fork network for the fork of which the source was deleted'
do
fork
=
create
(
:project
)
fork
=
projects
.
create
forked_project_links
.
create
(
id:
6
,
forked_from_project_id:
99999
,
forked_to_project_id:
fork
.
id
)
=======
it
'skips links that had their source project deleted'
do
forked_project_links
.
create
(
id:
6
,
forked_from_project_id:
99999
,
forked_to_project_id:
projects
.
create
.
id
)
>>>>>>>
Create
models
directly
in
migration
specs
migration
.
perform
(
5
,
8
)
...
...
spec/services/projects/update_mirror_service_spec.rb
View file @
c0a78957
...
...
@@ -74,7 +74,7 @@ describe Projects::UpdateMirrorService do
expect
(
project
.
repository
.
branch_names
).
to
include
(
new_protected_branch_name
)
end
it
'does not create a unprotected branch'
do
it
'does not create a
n
unprotected branch'
do
stub_fetch_mirror
(
project
)
described_class
.
new
(
project
,
project
.
owner
).
execute
...
...
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