add hidden repository function

This commit is contained in:
yanxd 2013-11-12 10:27:36 +08:00
parent 5fb29c150b
commit 98ccc97b27
9 changed files with 459 additions and 440 deletions

View File

@ -208,6 +208,13 @@ class RepositoriesController < ApplicationController
end end
def show def show
if !User.current.member_of?(@project)
if @project.hidden_repo
render_403
return -1
end
end
#if( !User.current.member_of?(@project) || @project.hidden_repo)
@repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty? @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
@entries = @repository.entries(@path, @rev) @entries = @repository.entries(@path, @rev)

View File

@ -702,6 +702,7 @@ class Project < ActiveRecord::Base
'description', 'description',
'homepage', 'homepage',
'is_public', 'is_public',
'hidden_repo',
'identifier', 'identifier',
'custom_field_values', 'custom_field_values',
'custom_fields', 'custom_fields',

View File

@ -1,438 +1,438 @@
# Redmine - project management software # Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2006-2013 Jean-Philippe Lang
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2 # as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. # of the License, or (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class ScmFetchError < Exception; end class ScmFetchError < Exception; end
class Repository < ActiveRecord::Base class Repository < ActiveRecord::Base
include Redmine::Ciphering include Redmine::Ciphering
include Redmine::SafeAttributes include Redmine::SafeAttributes
# Maximum length for repository identifiers # Maximum length for repository identifiers
IDENTIFIER_MAX_LENGTH = 255 IDENTIFIER_MAX_LENGTH = 255
belongs_to :project belongs_to :project
has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC" has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC"
has_many :filechanges, :class_name => 'Change', :through => :changesets has_many :filechanges, :class_name => 'Change', :through => :changesets
serialize :extra_info serialize :extra_info
before_save :check_default before_save :check_default
# Raw SQL to delete changesets and changes in the database # Raw SQL to delete changesets and changes in the database
# has_many :changesets, :dependent => :destroy is too slow for big repositories # has_many :changesets, :dependent => :destroy is too slow for big repositories
before_destroy :clear_changesets before_destroy :clear_changesets
validates_length_of :password, :maximum => 255, :allow_nil => true validates_length_of :password, :maximum => 255, :allow_nil => true
validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? } validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
# donwcase letters, digits, dashes, underscores but not digits only # donwcase letters, digits, dashes, underscores but not digits only
validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :allow_blank => true validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :allow_blank => true
# Checks if the SCM is enabled when creating a repository # Checks if the SCM is enabled when creating a repository
validate :repo_create_validation, :on => :create validate :repo_create_validation, :on => :create
safe_attributes 'identifier', safe_attributes 'identifier',
'login', 'login',
'password', 'password',
'path_encoding', 'path_encoding',
'log_encoding', 'log_encoding',
'is_default' 'is_default'
safe_attributes 'url', safe_attributes 'url',
:if => lambda {|repository, user| repository.new_record?} :if => lambda {|repository, user| repository.new_record?}
def repo_create_validation def repo_create_validation
unless Setting.enabled_scm.include?(self.class.name.demodulize) unless Setting.enabled_scm.include?(self.class.name.demodulize)
errors.add(:type, :invalid) errors.add(:type, :invalid)
end end
end end
def self.human_attribute_name(attribute_key_name, *args) def self.human_attribute_name(attribute_key_name, *args)
attr_name = attribute_key_name.to_s attr_name = attribute_key_name.to_s
if attr_name == "log_encoding" if attr_name == "log_encoding"
attr_name = "commit_logs_encoding" attr_name = "commit_logs_encoding"
end end
super(attr_name, *args) super(attr_name, *args)
end end
# Removes leading and trailing whitespace # Removes leading and trailing whitespace
def url=(arg) def url=(arg)
write_attribute(:url, arg ? arg.to_s.strip : nil) write_attribute(:url, arg ? arg.to_s.strip : nil)
end end
# Removes leading and trailing whitespace # Removes leading and trailing whitespace
def root_url=(arg) def root_url=(arg)
write_attribute(:root_url, arg ? arg.to_s.strip : nil) write_attribute(:root_url, arg ? arg.to_s.strip : nil)
end end
def password def password
read_ciphered_attribute(:password) read_ciphered_attribute(:password)
end end
def password=(arg) def password=(arg)
write_ciphered_attribute(:password, arg) write_ciphered_attribute(:password, arg)
end end
def scm_adapter def scm_adapter
self.class.scm_adapter_class self.class.scm_adapter_class
end end
def scm def scm
unless @scm unless @scm
@scm = self.scm_adapter.new(url, root_url, @scm = self.scm_adapter.new(url, root_url,
login, password, path_encoding) login, password, path_encoding)
if root_url.blank? && @scm.root_url.present? if root_url.blank? && @scm.root_url.present?
update_attribute(:root_url, @scm.root_url) update_attribute(:root_url, @scm.root_url)
end end
end end
@scm @scm
end end
def scm_name def scm_name
self.class.scm_name self.class.scm_name
end end
def name def name
if identifier.present? if identifier.present?
identifier identifier
elsif is_default? elsif is_default?
l(:field_repository_is_default) l(:field_repository_is_default)
else else
scm_name scm_name
end end
end end
def identifier=(identifier) def identifier=(identifier)
super unless identifier_frozen? super unless identifier_frozen?
end end
def identifier_frozen? def identifier_frozen?
errors[:identifier].blank? && !(new_record? || identifier.blank?) errors[:identifier].blank? && !(new_record? || identifier.blank?)
end end
def identifier_param def identifier_param
if is_default? if is_default?
nil nil
elsif identifier.present? elsif identifier.present?
identifier identifier
else else
id.to_s id.to_s
end end
end end
def <=>(repository) def <=>(repository)
if is_default? if is_default?
-1 -1
elsif repository.is_default? elsif repository.is_default?
1 1
else else
identifier.to_s <=> repository.identifier.to_s identifier.to_s <=> repository.identifier.to_s
end end
end end
def self.find_by_identifier_param(param) def self.find_by_identifier_param(param)
if param.to_s =~ /^\d+$/ if param.to_s =~ /^\d+$/
find_by_id(param) find_by_id(param)
else else
find_by_identifier(param) find_by_identifier(param)
end end
end end
def merge_extra_info(arg) def merge_extra_info(arg)
h = extra_info || {} h = extra_info || {}
return h if arg.nil? return h if arg.nil?
h.merge!(arg) h.merge!(arg)
write_attribute(:extra_info, h) write_attribute(:extra_info, h)
end end
def report_last_commit def report_last_commit
true true
end end
def supports_cat? def supports_cat?
scm.supports_cat? scm.supports_cat?
end end
def supports_annotate? def supports_annotate?
scm.supports_annotate? scm.supports_annotate?
end end
def supports_all_revisions? def supports_all_revisions?
true true
end end
def supports_directory_revisions? def supports_directory_revisions?
false false
end end
def supports_revision_graph? def supports_revision_graph?
false false
end end
def entry(path=nil, identifier=nil) def entry(path=nil, identifier=nil)
scm.entry(path, identifier) scm.entry(path, identifier)
end end
def entries(path=nil, identifier=nil) def entries(path=nil, identifier=nil)
entries = scm.entries(path, identifier) entries = scm.entries(path, identifier)
load_entries_changesets(entries) load_entries_changesets(entries)
entries entries
end end
def branches def branches
scm.branches scm.branches
end end
def tags def tags
scm.tags scm.tags
end end
def default_branch def default_branch
nil nil
end end
def properties(path, identifier=nil) def properties(path, identifier=nil)
scm.properties(path, identifier) scm.properties(path, identifier)
end end
def cat(path, identifier=nil) def cat(path, identifier=nil)
scm.cat(path, identifier) scm.cat(path, identifier)
end end
def diff(path, rev, rev_to) def diff(path, rev, rev_to)
scm.diff(path, rev, rev_to) scm.diff(path, rev, rev_to)
end end
def diff_format_revisions(cs, cs_to, sep=':') def diff_format_revisions(cs, cs_to, sep=':')
text = "" text = ""
text << cs_to.format_identifier + sep if cs_to text << cs_to.format_identifier + sep if cs_to
text << cs.format_identifier if cs text << cs.format_identifier if cs
text text
end end
# Returns a path relative to the url of the repository # Returns a path relative to the url of the repository
def relative_path(path) def relative_path(path)
path path
end end
# Finds and returns a revision with a number or the beginning of a hash # Finds and returns a revision with a number or the beginning of a hash
def find_changeset_by_name(name) def find_changeset_by_name(name)
return nil if name.blank? return nil if name.blank?
s = name.to_s s = name.to_s
if s.match(/^\d*$/) if s.match(/^\d*$/)
changesets.where("revision = ?", s).first changesets.where("revision = ?", s).first
else else
changesets.where("revision LIKE ?", s + '%').first changesets.where("revision LIKE ?", s + '%').first
end end
end end
def latest_changeset def latest_changeset
@latest_changeset ||= changesets.first @latest_changeset ||= changesets.first
end end
# Returns the latest changesets for +path+ # Returns the latest changesets for +path+
# Default behaviour is to search in cached changesets # Default behaviour is to search in cached changesets
def latest_changesets(path, rev, limit=10) def latest_changesets(path, rev, limit=10)
if path.blank? if path.blank?
changesets.find( changesets.find(
:all, :all,
:include => :user, :include => :user,
:order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC", :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
:limit => limit) :limit => limit)
else else
filechanges.find( filechanges.find(
:all, :all,
:include => {:changeset => :user}, :include => {:changeset => :user},
:conditions => ["path = ?", path.with_leading_slash], :conditions => ["path = ?", path.with_leading_slash],
:order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC", :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
:limit => limit :limit => limit
).collect(&:changeset) ).collect(&:changeset)
end end
end end
def scan_changesets_for_issue_ids def scan_changesets_for_issue_ids
self.changesets.each(&:scan_comment_for_issue_ids) self.changesets.each(&:scan_comment_for_issue_ids)
end end
# Returns an array of committers usernames and associated user_id # Returns an array of committers usernames and associated user_id
def committers def committers
@committers ||= Changeset.connection.select_rows( @committers ||= Changeset.connection.select_rows(
"SELECT DISTINCT committer, user_id FROM #{Changeset.table_name} WHERE repository_id = #{id}") "SELECT DISTINCT committer, user_id FROM #{Changeset.table_name} WHERE repository_id = #{id}")
end end
# Maps committers username to a user ids # Maps committers username to a user ids
def committer_ids=(h) def committer_ids=(h)
if h.is_a?(Hash) if h.is_a?(Hash)
committers.each do |committer, user_id| committers.each do |committer, user_id|
new_user_id = h[committer] new_user_id = h[committer]
if new_user_id && (new_user_id.to_i != user_id.to_i) if new_user_id && (new_user_id.to_i != user_id.to_i)
new_user_id = (new_user_id.to_i > 0 ? new_user_id.to_i : nil) new_user_id = (new_user_id.to_i > 0 ? new_user_id.to_i : nil)
Changeset.update_all( Changeset.update_all(
"user_id = #{ new_user_id.nil? ? 'NULL' : new_user_id }", "user_id = #{ new_user_id.nil? ? 'NULL' : new_user_id }",
["repository_id = ? AND committer = ?", id, committer]) ["repository_id = ? AND committer = ?", id, committer])
end end
end end
@committers = nil @committers = nil
@found_committer_users = nil @found_committer_users = nil
true true
else else
false false
end end
end end
# Returns the Redmine User corresponding to the given +committer+ # Returns the Redmine User corresponding to the given +committer+
# It will return nil if the committer is not yet mapped and if no User # It will return nil if the committer is not yet mapped and if no User
# with the same username or email was found # with the same username or email was found
def find_committer_user(committer) def find_committer_user(committer)
unless committer.blank? unless committer.blank?
@found_committer_users ||= {} @found_committer_users ||= {}
return @found_committer_users[committer] if @found_committer_users.has_key?(committer) return @found_committer_users[committer] if @found_committer_users.has_key?(committer)
user = nil user = nil
c = changesets.where(:committer => committer).includes(:user).first c = changesets.where(:committer => committer).includes(:user).first
if c && c.user if c && c.user
user = c.user user = c.user
elsif committer.strip =~ /^([^<]+)(<(.*)>)?$/ elsif committer.strip =~ /^([^<]+)(<(.*)>)?$/
username, email = $1.strip, $3 username, email = $1.strip, $3
u = User.find_by_login(username) u = User.find_by_login(username)
u ||= User.find_by_mail(email) unless email.blank? u ||= User.find_by_mail(email) unless email.blank?
user = u user = u
end end
@found_committer_users[committer] = user @found_committer_users[committer] = user
user user
end end
end end
def repo_log_encoding def repo_log_encoding
encoding = log_encoding.to_s.strip encoding = log_encoding.to_s.strip
encoding.blank? ? 'UTF-8' : encoding encoding.blank? ? 'UTF-8' : encoding
end end
# Fetches new changesets for all repositories of active projects # Fetches new changesets for all repositories of active projects
# Can be called periodically by an external script # Can be called periodically by an external script
# eg. ruby script/runner "Repository.fetch_changesets" # eg. ruby script/runner "Repository.fetch_changesets"
def self.fetch_changesets def self.fetch_changesets
Project.active.has_module(:repository).all.each do |project| Project.active.has_module(:repository).all.each do |project|
project.repositories.each do |repository| project.repositories.each do |repository|
begin begin
repository.fetch_changesets repository.fetch_changesets
rescue Redmine::Scm::Adapters::CommandFailed => e rescue Redmine::Scm::Adapters::CommandFailed => e
logger.error "scm: error during fetching changesets: #{e.message}" logger.error "scm: error during fetching changesets: #{e.message}"
end end
end end
end end
end end
# scan changeset comments to find related and fixed issues for all repositories # scan changeset comments to find related and fixed issues for all repositories
def self.scan_changesets_for_issue_ids def self.scan_changesets_for_issue_ids
all.each(&:scan_changesets_for_issue_ids) all.each(&:scan_changesets_for_issue_ids)
end end
def self.scm_name def self.scm_name
'Abstract' 'Abstract'
end end
def self.available_scm def self.available_scm
subclasses.collect {|klass| [klass.scm_name, klass.name]} subclasses.collect {|klass| [klass.scm_name, klass.name]}
end end
def self.factory(klass_name, *args) def self.factory(klass_name, *args)
klass = "Repository::#{klass_name}".constantize klass = "Repository::#{klass_name}".constantize
klass.new(*args) klass.new(*args)
rescue rescue
nil nil
end end
def self.scm_adapter_class def self.scm_adapter_class
nil nil
end end
def self.scm_command def self.scm_command
ret = "" ret = ""
begin begin
ret = self.scm_adapter_class.client_command if self.scm_adapter_class ret = self.scm_adapter_class.client_command if self.scm_adapter_class
rescue Exception => e rescue Exception => e
logger.error "scm: error during get command: #{e.message}" logger.error "scm: error during get command: #{e.message}"
end end
ret ret
end end
def self.scm_version_string def self.scm_version_string
ret = "" ret = ""
begin begin
ret = self.scm_adapter_class.client_version_string if self.scm_adapter_class ret = self.scm_adapter_class.client_version_string if self.scm_adapter_class
rescue Exception => e rescue Exception => e
logger.error "scm: error during get version string: #{e.message}" logger.error "scm: error during get version string: #{e.message}"
end end
ret ret
end end
def self.scm_available def self.scm_available
ret = false ret = false
begin begin
ret = self.scm_adapter_class.client_available if self.scm_adapter_class ret = self.scm_adapter_class.client_available if self.scm_adapter_class
rescue Exception => e rescue Exception => e
logger.error "scm: error during get scm available: #{e.message}" logger.error "scm: error during get scm available: #{e.message}"
end end
ret ret
end end
def set_as_default? def set_as_default?
new_record? && project && !Repository.first(:conditions => {:project_id => project.id}) new_record? && project && !Repository.first(:conditions => {:project_id => project.id})
end end
protected protected
def check_default def check_default
if !is_default? && set_as_default? if !is_default? && set_as_default?
self.is_default = true self.is_default = true
end end
if is_default? && is_default_changed? if is_default? && is_default_changed?
Repository.update_all(["is_default = ?", false], ["project_id = ?", project_id]) Repository.update_all(["is_default = ?", false], ["project_id = ?", project_id])
end end
end end
def load_entries_changesets(entries) def load_entries_changesets(entries)
if entries if entries
entries.each do |entry| entries.each do |entry|
if entry.lastrev && entry.lastrev.identifier if entry.lastrev && entry.lastrev.identifier
entry.changeset = find_changeset_by_name(entry.lastrev.identifier) entry.changeset = find_changeset_by_name(entry.lastrev.identifier)
end end
end end
end end
end end
private private
# Deletes repository data # Deletes repository data
def clear_changesets def clear_changesets
cs = Changeset.table_name cs = Changeset.table_name
ch = Change.table_name ch = Change.table_name
ci = "#{table_name_prefix}changesets_issues#{table_name_suffix}" ci = "#{table_name_prefix}changesets_issues#{table_name_suffix}"
cp = "#{table_name_prefix}changeset_parents#{table_name_suffix}" cp = "#{table_name_prefix}changeset_parents#{table_name_suffix}"
connection.delete("DELETE FROM #{ch} WHERE #{ch}.changeset_id IN (SELECT #{cs}.id FROM #{cs} WHERE #{cs}.repository_id = #{id})") connection.delete("DELETE FROM #{ch} WHERE #{ch}.changeset_id IN (SELECT #{cs}.id FROM #{cs} WHERE #{cs}.repository_id = #{id})")
connection.delete("DELETE FROM #{ci} WHERE #{ci}.changeset_id IN (SELECT #{cs}.id FROM #{cs} WHERE #{cs}.repository_id = #{id})") connection.delete("DELETE FROM #{ci} WHERE #{ci}.changeset_id IN (SELECT #{cs}.id FROM #{cs} WHERE #{cs}.repository_id = #{id})")
connection.delete("DELETE FROM #{cp} WHERE #{cp}.changeset_id IN (SELECT #{cs}.id FROM #{cs} WHERE #{cs}.repository_id = #{id})") connection.delete("DELETE FROM #{cp} WHERE #{cp}.changeset_id IN (SELECT #{cs}.id FROM #{cs} WHERE #{cs}.repository_id = #{id})")
connection.delete("DELETE FROM #{cs} WHERE #{cs}.repository_id = #{id}") connection.delete("DELETE FROM #{cs} WHERE #{cs}.repository_id = #{id}")
clear_extra_info_of_changesets clear_extra_info_of_changesets
end end
def clear_extra_info_of_changesets def clear_extra_info_of_changesets
end end
end end

View File

@ -12,6 +12,7 @@
<% end %></p> <% end %></p>
<!-- <p style="margin-left:-10px;"><%= f.text_field :homepage, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> --> <!-- by huang --> <!-- <p style="margin-left:-10px;"><%= f.text_field :homepage, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> --> <!-- by huang -->
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %></em></p> <p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %></em></p>
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :hidden_repo, :style => "margin-left:10px;" %></em></p>
<p style="display:none;"><%= f.text_field :project_type, :value => 0 %></p> <p style="display:none;"><%= f.text_field :project_type, :value => 0 %></p>
<%= wikitoolbar_for 'project_description' %> <%= wikitoolbar_for 'project_description' %>

View File

@ -1561,6 +1561,8 @@ en:
label_course_practice: Courses label_course_practice: Courses
label_user_home: User Space label_user_home: User Space
field_hidden_repo: private code

View File

@ -1705,3 +1705,5 @@ zh:
label_duration_time: 授课时间 label_duration_time: 授课时间
label_course_brief_introduction: 课程简介 label_course_brief_introduction: 课程简介
field_teacher_name: 教 师 field_teacher_name: 教 师
field_hidden_repo: 私有代码

View File

@ -0,0 +1,5 @@
class AddHiddenRepoToProjects < ActiveRecord::Migration
def change
add_column :projects, :hidden_repo, :boolean, :default => false, :null => false
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20131108133857) do ActiveRecord::Schema.define(:version => 20131112005309) do
create_table "a_user_watchers", :force => true do |t| create_table "a_user_watchers", :force => true do |t|
t.string "name" t.string "name"
@ -540,6 +540,7 @@ ActiveRecord::Schema.define(:version => 20131108133857) do
t.integer "rgt" t.integer "rgt"
t.boolean "inherit_members", :default => false, :null => false t.boolean "inherit_members", :default => false, :null => false
t.integer "project_type" t.integer "project_type"
t.boolean "hidden_repo", :default => false, :null => false
end end
add_index "projects", ["lft"], :name => "index_projects_on_lft" add_index "projects", ["lft"], :name => "index_projects_on_lft"

View File

@ -314,7 +314,7 @@ Redmine::MenuManager.map :project_menu do |menu|
# :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural # :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural
menu.push :files, { :controller => 'files', :action => 'index' }, :param => :project_id, :caption => :label_file_new menu.push :files, { :controller => 'files', :action => 'index' }, :param => :project_id, :caption => :label_file_new
menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil }, menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil },
:if => Proc.new { |p| p.repository && !p.repository.new_record? } :if => Proc.new { |p| p.repository && !p.repository.new_record? && !( !User.current.member_of?(p) && p.hidden_repo ) }
menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true
end end