2012-09-27 14:59:42 -04:00
|
|
|
class RepositoriesController < ProjectResourceController
|
2011-12-30 15:56:13 -05:00
|
|
|
# Authorize
|
|
|
|
before_filter :authorize_read_project!
|
2012-02-21 17:31:18 -05:00
|
|
|
before_filter :authorize_code_access!
|
2011-12-30 15:56:13 -05:00
|
|
|
before_filter :require_non_empty_project
|
|
|
|
|
|
|
|
def show
|
2013-01-03 14:09:18 -05:00
|
|
|
@activities = @repository.commits_with_refs(20)
|
2011-12-30 15:56:13 -05:00
|
|
|
end
|
2011-12-31 06:12:10 -05:00
|
|
|
|
|
|
|
def branches
|
2013-01-03 14:09:18 -05:00
|
|
|
@branches = @repository.branches
|
2011-12-31 06:12:10 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def tags
|
2013-01-03 14:09:18 -05:00
|
|
|
@tags = @repository.tags
|
2011-12-31 06:12:10 -05:00
|
|
|
end
|
2012-02-07 18:00:49 -05:00
|
|
|
|
2012-11-10 16:08:47 -05:00
|
|
|
def stats
|
2013-04-03 14:05:10 -04:00
|
|
|
@stats = Gitlab::Git::Stats.new(@repository.raw, @repository.root_ref)
|
2012-11-10 16:08:47 -05:00
|
|
|
@graph = @stats.graph
|
|
|
|
end
|
|
|
|
|
2012-02-07 18:00:49 -05:00
|
|
|
def archive
|
|
|
|
unless can?(current_user, :download_code, @project)
|
2012-11-10 16:08:47 -05:00
|
|
|
render_404 and return
|
2012-02-07 18:00:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-04-29 02:15:18 -04:00
|
|
|
storage_path = Rails.root.join("tmp", "repositories")
|
|
|
|
|
|
|
|
file_path = @repository.archive_repo(params[:ref], storage_path)
|
2012-06-13 02:03:53 -04:00
|
|
|
|
|
|
|
if file_path
|
|
|
|
# Send file to user
|
|
|
|
send_file file_path
|
|
|
|
else
|
|
|
|
render_404
|
|
|
|
end
|
2012-02-07 18:00:49 -05:00
|
|
|
end
|
2011-12-30 15:56:13 -05:00
|
|
|
end
|