From 39ba934c0a65f571214998e056e925b61f389360 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 3 Jan 2013 21:09:18 +0200 Subject: REpostiry, Team models --- lib/extracts_path.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') 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? -- cgit v1.2.1 From dccd8b6eaa8b2e98b0245262a8e39df8fb8ae634 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 4 Jan 2013 08:43:25 +0200 Subject: Continue refactoring. Use repostory and team --- lib/gitlab/backend/gitolite_config.rb | 8 ++++---- lib/gitlab/markdown.rb | 2 +- lib/gitlab/satellite/merge_action.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') 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 -- cgit v1.2.1 From afbdbb0c959affbdb8725eafb8169025a8aede1e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 4 Jan 2013 18:50:31 +0200 Subject: Rspec fixes --- lib/api/notes.rb | 4 ++-- lib/api/projects.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') 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 -- cgit v1.2.1 From e16cebac3eaadc0df93576358f60ae4a498ce15f Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sat, 5 Jan 2013 00:35:38 +0200 Subject: Fixed styles, ProjectHook specs etc --- lib/static_model.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.1