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
8b54b723
Commit
8b54b723
authored
Jan 28, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Async perform for add/remove team members
parent
1c5876eb
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
11 deletions
+35
-11
app/models/protected_branch.rb
app/models/protected_branch.rb
+1
-1
app/models/users_project.rb
app/models/users_project.rb
+10
-2
lib/gitlab/backend/gitolite.rb
lib/gitlab/backend/gitolite.rb
+19
-7
spec/lib/gitolite_spec.rb
spec/lib/gitolite_spec.rb
+1
-1
spec/support/stubbed_repository.rb
spec/support/stubbed_repository.rb
+4
-0
No files found.
app/models/protected_branch.rb
View file @
8b54b723
...
...
@@ -22,7 +22,7 @@ class ProtectedBranch < ActiveRecord::Base
after_destroy
:update_repository
def
update_repository
gitolite
.
update_repository
(
project
)
project
.
update_repository
end
def
commit
...
...
app/models/users_project.rb
View file @
8b54b723
...
...
@@ -82,9 +82,13 @@ class UsersProject < ActiveRecord::Base
users_project
.
save
end
end
Gitlab
::
Gitolite
.
new
.
update_repositories
(
Project
.
where
(
id:
project_ids
))
end
GitoliteWorker
.
perform_async
(
:update_repositories
,
project_ids
)
true
rescue
false
...
...
@@ -97,9 +101,13 @@ class UsersProject < ActiveRecord::Base
users_project
.
skip_git
=
true
users_project
.
destroy
end
Gitlab
::
Gitolite
.
new
.
update_repositories
(
Project
.
where
(
id:
project_ids
))
end
GitoliteWorker
.
perform_async
(
:update_repositories
,
project_ids
)
true
rescue
false
...
...
lib/gitlab/backend/gitolite.rb
View file @
8b54b723
...
...
@@ -22,7 +22,12 @@ module Gitlab
end
end
def
update_repository
project_id
# Update project config in gitolite by project id
#
# Ex.
# update_repository(23)
#
def
update_repository
(
project_id
)
project
=
Project
.
find
(
project_id
)
config
.
update_project!
(
project
)
end
...
...
@@ -45,6 +50,19 @@ module Gitlab
config
.
destroy_project!
(
name
)
end
# Update projects configs in gitolite by project ids
#
# Ex.
# update_repositories([1, 4, 6])
#
def
update_repositories
(
project_ids
)
projects
=
Project
.
where
(
id:
project_ids
)
config
.
apply
do
|
config
|
config
.
update_projects
(
projects
)
end
end
def
url_to_repo
path
Gitlab
.
config
.
gitolite
.
ssh_path_prefix
+
"
#{
path
}
.git"
end
...
...
@@ -53,12 +71,6 @@ module Gitlab
config
.
admin_all_repo!
end
def
update_repositories
projects
config
.
apply
do
|
config
|
config
.
update_projects
(
projects
)
end
end
alias_method
:create_repository
,
:update_repository
end
end
spec/lib/gitolite_spec.rb
View file @
8b54b723
...
...
@@ -20,6 +20,6 @@ describe Gitlab::Gitolite do
it
"should call config update"
do
gitolite_config
.
should_receive
(
:update_project!
)
gitolite
.
update_repository
project
gitolite
.
update_repository
(
project
.
id
)
end
end
spec/support/stubbed_repository.rb
View file @
8b54b723
...
...
@@ -21,6 +21,10 @@ class Project
true
end
def
destroy
true
end
def
create
true
end
...
...
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