diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-05 00:49:58 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-05 00:49:58 +0200 |
commit | 0a94640e328ab30dcf90e65ba79242bc1aa77a57 (patch) | |
tree | 49599acd6e4dbc50de0491ff174588b1fbf0cf8e /lib | |
parent | e6c0673ef1108a93928c4d88ba273e12616b836b (diff) | |
parent | de6fa5dd520244e9802b5b486ce9d437556baf31 (diff) | |
download | gitlab-ce-0a94640e328ab30dcf90e65ba79242bc1aa77a57.tar.gz |
Merge branch 'refactoring/backend'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/notes.rb | 4 | ||||
-rw-r--r-- | lib/api/projects.rb | 6 | ||||
-rw-r--r-- | lib/extracts_path.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/backend/gitolite_config.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/markdown.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/satellite/merge_action.rb | 2 | ||||
-rw-r--r-- | lib/static_model.rb | 2 |
7 files changed, 15 insertions, 15 deletions
diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 4875ac4c03e..4613db54578 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -13,7 +13,7 @@ module Gitlab # Example Request: # GET /projects/:id/notes get ":id/notes" do - @notes = user_project.common_notes + @notes = user_project.notes.common present paginate(@notes), with: Entities::Note end @@ -25,7 +25,7 @@ module Gitlab # Example Request: # GET /projects/:id/notes/:note_id get ":id/notes/:note_id" do - @note = user_project.common_notes.find(params[:note_id]) + @note = user_project.notes.common.find(params[:note_id]) present @note, with: Entities::Note end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index c71fd64838b..55c81f3158a 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -257,7 +257,7 @@ module Gitlab per_page = params[:per_page] || 20 ref = params[:ref_name] || user_project.try(:default_branch) || 'master' - commits = user_project.commits(ref, nil, per_page, page * per_page) + commits = user_project.repository.commits(ref, nil, per_page, page * per_page) present CommitDecorator.decorate(commits), with: Entities::RepoCommit end @@ -375,10 +375,10 @@ module Gitlab ref = params[:sha] - commit = user_project.commit ref + commit = user_project.repository.commit ref not_found! "Commit" unless commit - tree = Tree.new commit.tree, user_project, ref, params[:filepath] + tree = Tree.new commit.tree, ref, params[:filepath] not_found! "File" unless tree.try(:tree) content_type tree.mime_type diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb index 0b7a0d47caf..5c96eac02e7 100644 --- a/lib/extracts_path.rb +++ b/lib/extracts_path.rb @@ -68,7 +68,7 @@ module ExtractsPath id = input id += '/' unless id.ends_with?('/') - valid_refs = @project.ref_names + valid_refs = @project.repository.ref_names valid_refs.select! { |v| id.start_with?("#{v}/") } if valid_refs.length != 1 @@ -114,9 +114,9 @@ module ExtractsPath @id = File.join(@ref, @path) - @commit = CommitDecorator.decorate(@project.commit(@ref)) + @commit = CommitDecorator.decorate(@project.repository.commit(@ref)) - @tree = Tree.new(@commit.tree, @project, @ref, @path) + @tree = Tree.new(@commit.tree, @ref, @path) @tree = TreeDecorator.new(@tree) raise InvalidPathError if @tree.invalid? diff --git a/lib/gitlab/backend/gitolite_config.rb b/lib/gitlab/backend/gitolite_config.rb index a2bc4ca8d74..10e527eac73 100644 --- a/lib/gitlab/backend/gitolite_config.rb +++ b/lib/gitlab/backend/gitolite_config.rb @@ -82,7 +82,7 @@ module Gitlab end def destroy_project(project) - FileUtils.rm_rf(project.path_to_repo) + FileUtils.rm_rf(project.repository.path_to_repo) conf.rm_repo(project.path_with_namespace) end @@ -138,9 +138,9 @@ module Gitlab ::Gitolite::Config::Repo.new(repo_name) end - name_readers = project.repository_readers - name_writers = project.repository_writers - name_masters = project.repository_masters + name_readers = project.team.repository_readers + name_writers = project.team.repository_writers + name_masters = project.team.repository_masters pr_br = project.protected_branches.map(&:name).join("$ ") diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index 859184b6c3a..59249a229eb 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -170,7 +170,7 @@ module Gitlab end def reference_commit(identifier) - if @project.valid_repo? && commit = @project.commit(identifier) + if @project.valid_repo? && commit = @project.repository.commit(identifier) link_to(identifier, project_commit_path(@project, commit), html_options.merge(title: CommitDecorator.new(commit).link_title, class: "gfm gfm-commit #{html_options[:class]}")) end end diff --git a/lib/gitlab/satellite/merge_action.rb b/lib/gitlab/satellite/merge_action.rb index 832db6621c4..556a1e2d52f 100644 --- a/lib/gitlab/satellite/merge_action.rb +++ b/lib/gitlab/satellite/merge_action.rb @@ -31,7 +31,7 @@ module Gitlab merge_repo.git.push({raise: true, timeout: true}, :origin, merge_request.target_branch) # remove source branch - if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch) + if merge_request.should_remove_source_branch && !project.repository.root_ref?(merge_request.source_branch) # will raise CommandFailed when push fails merge_repo.git.push({raise: true, timeout: true}, :origin, ":#{merge_request.source_branch}") end diff --git a/lib/static_model.rb b/lib/static_model.rb index 5b64be1f041..185921d8fbe 100644 --- a/lib/static_model.rb +++ b/lib/static_model.rb @@ -38,7 +38,7 @@ module StaticModel end def ==(other) - if other.is_a? StaticModel + if other.is_a? ::StaticModel id == other.id else super |