gitlabhq/app/controllers/repositories_controller.rb

40 lines
767 B
Ruby
Raw Permalink Normal View History

class RepositoriesController < ProjectResourceController
# Authorize
before_filter :authorize_read_project!
before_filter :authorize_code_access!
before_filter :require_non_empty_project
def show
2013-01-03 20:09:18 +01:00
@activities = @repository.commits_with_refs(20)
end
2011-12-31 12:12:10 +01:00
def branches
2013-01-03 20:09:18 +01:00
@branches = @repository.branches
2011-12-31 12:12:10 +01:00
end
def tags
2013-01-03 20:09:18 +01:00
@tags = @repository.tags
2011-12-31 12:12:10 +01:00
end
2012-11-10 22:08:47 +01:00
def stats
2013-01-03 20:09:18 +01:00
@stats = Gitlab::GitStats.new(@repository.raw, @repository.root_ref)
2012-11-10 22:08:47 +01:00
@graph = @stats.graph
end
def archive
unless can?(current_user, :download_code, @project)
2012-11-10 22:08:47 +01:00
render_404 and return
end
2013-01-03 20:09:18 +01:00
file_path = @repository.archive_repo(params[:ref])
if file_path
# Send file to user
send_file file_path
else
render_404
end
end
end