GitLab steht aufgrund wichtiger Wartungsarbeiten am Montag, den 12. April, ab 19:00 Uhr nicht zur Verfügung.

Commit 2963e7fd authored by Daniel Gerhardt's avatar Daniel Gerhardt

Add ref switching support for graphs

It is now possible to view contributor and commit statistics for
refs beyond the default branch.

Additionally, conditions in RefsController#switch have been refactored
in order that a `case` block is used now.
parent 570fd9f5
......@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 7.13.0 (unreleased)
- Fix redirection to home page URL for unauthorized users (Daniel Gerhardt)
- Add branch switching support for graphs (Daniel Gerhardt)
- Fix external issue tracker hook/test for HTTPS URLs (Daniel Gerhardt)
- Remove link leading to a 404 error in Deploy Keys page (Stan Hu)
- Add support for unlocking users in admin settings (Stan Hu)
class Projects::GraphsController < Projects::ApplicationController
include ExtractsPath
# Authorize
before_action :require_non_empty_project
before_action :assign_ref_vars
before_action :authorize_download_code!
def show
......@@ -13,7 +16,7 @@ def show
def commits
@commits = @project.repository.commits(nil, nil, 2000, 0, true)
@commits = @project.repository.commits(@ref, nil, 2000, 0, true)
@commits_graph =
@commits_per_week_days = @commits_graph.commits_per_week_days
@commits_per_time = @commits_graph.commits_per_time
......@@ -23,7 +26,7 @@ def commits
def fetch_graph
@commits = @project.repository.commits(nil, nil, 6000, 0, true)
@commits = @project.repository.commits(@ref, nil, 6000, 0, true)
@log = []
@commits.each do |commit|
......@@ -8,17 +8,21 @@ class Projects::RefsController < Projects::ApplicationController
def switch
respond_to do |format|
format.html do
new_path = if params[:destination] == "tree"
namespace_project_tree_path(@project.namespace, @project,
elsif params[:destination] == "blob"
namespace_project_blob_path(@project.namespace, @project,
elsif params[:destination] == "graph"
namespace_project_network_path(@project.namespace, @project, @id, @options)
namespace_project_commits_path(@project.namespace, @project, @id)
new_path =
case params[:destination]
when "tree"
namespace_project_tree_path(@project.namespace, @project, @id)
when "blob"
namespace_project_blob_path(@project.namespace, @project, @id)
when "graph"
namespace_project_network_path(@project.namespace, @project, @id, @options)
when "graphs"
namespace_project_graph_path(@project.namespace, @project, @id)
when "graphs_commits"
commits_namespace_project_graph_path(@project.namespace, @project, @id)
namespace_project_commits_path(@project.namespace, @project, @id)
redirect_to new_path
- page_title "Commit statistics"
= render 'shared/ref_switcher', destination: 'graphs_commits'
= render 'head'
Commit statistics for
%strong #{@repository.root_ref}
%strong #{@ref}
#{@commits_graph.start_date.strftime('%b %d')} - #{@commits_graph.end_date.strftime('%b %d')}
- page_title "Contributor statistics"
= render 'shared/ref_switcher', destination: 'graphs'
= render 'head'
......@@ -11,7 +14,7 @@
Commits to #{@project.default_branch}, excluding merge commits. Limited by 6,000 commits
Commits to #{@ref}, excluding merge commits. Limited by 6,000 commits
%input#brush_change{:type => "hidden"}
......@@ -35,4 +38,3 @@
dataType: "json"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment