Añade plugin Redmine Git Hosting 4.0.2

This commit is contained in:
Manuel Cillero 2020-12-05 13:57:05 +01:00
parent 472cb1ea76
commit bdd66d941f
494 changed files with 36768 additions and 0 deletions

View file

@ -0,0 +1,31 @@
<% @entries.each do |entry| %>
<% tr_id = Digest::MD5.hexdigest(entry.path)
depth = params[:depth].to_i %>
<% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(entry.path) %>
<% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %>
<tr id="<%= tr_id %>" class="<%= h params[:parent_id] %> entry <%= entry.kind %>">
<td style="padding-left: <%=18 * depth%>px;" class="<%=
@repository.report_last_commit ? "filename" : "filename_no_report" %>">
<% if entry.is_dir? %>
<span class="expander" onclick="scmEntryClick('<%= tr_id %>', '<%= escape_javascript(url_for(
:action => 'show',
:id => @project,
:repository_id => @repository.identifier_param,
:path => to_path_param(ent_path),
:rev => @rev,
:depth => (depth + 1),
:parent_id => tr_id)) %>');">&nbsp;</span>
<% end %>
<%= link_to h(ent_name),
{:action => (entry.is_dir? ? 'show' : 'changes'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
:class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
</td>
<td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
<% if @repository.report_last_commit %>
<td class="revision"><%= link_to_revision2(entry.changeset, @repository) if entry.changeset %></td>
<td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>
<td class="author"><%= entry.author %></td>
<td class="comments"><%= entry.changeset.comments.truncate(50) if entry.changeset %></td>
<% end %>
</tr>
<% end %>

View file

@ -0,0 +1,51 @@
<% show_revision_graph = ( @repository.supports_revision_graph? && path.blank? ) %>
<%= if show_revision_graph && revisions && revisions.any?
indexed_commits, graph_space = index_commits(revisions, @repository.branches) do |scmid|
url_for(
:controller => 'archived_repositories',
:action => 'revision',
:id => project,
:repository_id => @repository.identifier_param,
:rev => scmid)
end
render :partial => 'revision_graph',
:locals => {
:commits => indexed_commits,
:space => graph_space
}
end %>
<%= form_tag(
{:controller => 'archived_repositories', :action => 'diff', :id => project,
:repository_id => @repository.identifier_param, :path => to_path_param(path)},
:method => :get
) do %>
<table class="list changesets">
<thead><tr>
<th>#</th>
<th></th>
<th></th>
<th><%= l(:label_date) %></th>
<th><%= l(:field_author) %></th>
<th><%= l(:field_comments) %></th>
</tr></thead>
<tbody>
<% show_diff = revisions.size > 1 %>
<% line_num = 1 %>
<% revisions.each do |changeset| %>
<tr class="changeset <%= cycle 'odd', 'even' %>">
<% id_style = (show_revision_graph ? "padding-left:#{(graph_space + 1) * 20}px" : nil) %>
<%= content_tag(:td, :class => 'id', :style => id_style) do %>
<%= link_to_revision2(changeset, @repository) %>
<% end %>
<td class="checkbox"><%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked',true);") if show_diff && (line_num < revisions.size) %></td>
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').attr('checked')) {$('#cb-#{line_num-1}').attr('checked',true);}") if show_diff && (line_num > 1) %></td>
<td class="committed_on"><%= format_time(changeset.committed_on) %></td>
<td class="author"><%= changeset.author.to_s.truncate(30) %></td>
<td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td>
</tr>
<% line_num += 1 %>
<% end %>
</tbody>
</table>
<%= submit_tag(l(:label_view_diff), :name => nil) if show_diff %>
<% end %>

View file

@ -0,0 +1,46 @@
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
<div class="contextual">
<%= render :partial => 'navigation' %>
</div>
<h2><%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
<%= render :partial => 'link_to_functions' %>
<% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
<div class="autoscroll">
<table class="filecontent annotate syntaxhl">
<tbody>
<% line_num = 1; previous_revision = nil %>
<% syntax_highlight_lines(@path, Redmine::CodesetUtil.to_utf8_by_setting(@annotate.content)).each do |line| %>
<% revision = @annotate.revisions[line_num - 1] %>
<tr id="L<%= line_num %>" class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %>">
<th class="line-num"><a href="#L<%= line_num %>"><%= line_num %></a></th>
<td class="revision">
<% if revision && revision != previous_revision %>
<%= revision.identifier ?
link_to_revision2(revision, @repository) : format_revision(revision) %>
<% end %>
</td>
<td class="author">
<% if revision && revision != previous_revision %>
<% author = Redmine::CodesetUtil.to_utf8(revision.author.to_s,
@repository.repo_log_encoding) %>
<%= author.split('<').first %>
<% end %>
</td>
<td class="line-code"><pre><%= line.html_safe %></pre></td>
</tr>
<% line_num += 1; previous_revision = revision %>
<% end %>
</tbody>
</table>
</div>
<% html_title(l(:button_annotate)) -%>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
<% end %>

View file

@ -0,0 +1,89 @@
<%# This is used to display basic git setup instructions, like on github... %>
<% flash.now[:warning] = l(:notice_empty_repository) %>
<div class="box">
<% if User.current.allowed_to?(:view_changesets, @project) %>
<h2><%= l(:label_help_git_setup) %> :</h2>
<pre>
<a href="https://git-scm.com/download" target="_blank"><%= l(:label_download_and_install_git) %></a>
git config --global user.name "<%= User.current.name(:firstname_lastname) %>"
git config --global user.email <%= User.current.mail ? User.current.mail : "mail@example.com" %>
<% if !User.current.anonymous? && User.current.gitolite_public_keys.active.length == 0 %>
<%= link_to "Upload SSH Public Key", {:controller => 'my', :action => 'account'} %>
<% end %>
</pre>
<% if User.current.allowed_to?(:commit_access, @project) %>
<div id="repository_setup">
<h2><%= l(:label_help_repository_setup_new) %> :</h2>
<pre>
mkdir <%= @repository.redmine_name %>
cd <%= @repository.redmine_name %>
git init
touch readme.txt
git add readme.txt
git commit -m 'Initializing <%= @repository.redmine_name %> repository'
git remote add origin <span class="git_url_access"></span>
git push -u origin master
</pre>
<h2><%= l(:label_help_repository_setup_existing) %> :</h2>
<pre>
cd existing_git_repo
git remote add origin <span class="git_url_access"></span>
git push -u origin master
</pre>
</div>
<% end %>
<h2><%= l(:label_help_repository_clone) %> :</h2>
<pre>
git clone <span class="git_url_access"></span>
</pre>
<% else %>
<%= l(:label_help_no_repo_rights) %>
<% end %>
</div>
<% content_for :sidebar do %>
<h3><%= l(:label_repository_plural) %></h3>
<ul class="repository git">
<% @repositories.sort.each do |repo| %>
<li class="repository git"><%= link_to h(repo.name), {:controller => 'archived_repositories', :action => 'show', :id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil},
:class => 'repository' + (@repository.is_a?(Repository::Xitolite) ? ' git' : '') + (repo == @repository ? ' selected' : '') %>
</li>
<% end %>
</ul>
<% if @repository.is_a?(Repository::Xitolite) && @repository.urls_are_viewable? %>
<div class="git_hosting_urls">
<h3><%= l(:label_repository_access_url) %></h3>
<%= render :partial => 'common/git_urls', :locals => {:repository => @repository} %>
</div>
<% end %>
<% end %>
<% content_for :header_tags do %>
<%= javascript_tag do %>
$(document).ready(function() {
var key = $('#git_url_list li').first().attr('id');
var access = access_list[key];
$('.git_url_access').html(access.url);
$('#git_url_list li').on('click', function(){
var key = $(this).attr('id');
var access = access_list[key];
$('.git_url_access').html(access.url);
if (access.commiter == true) {
$('#repository_setup').show();
} else {
$('#repository_setup').hide();
}
});
});
<% end %>
<% end %>

View file

@ -0,0 +1,17 @@
h2 = l(:label_archived_repositories)
- if @archived_projects.any?
ul
- @archived_projects.each do |project|
- if project.repositories.any?
li
= project.name
ul
- project.repositories.each do |repository|
li
= link_to h(repository.url), { controller: 'archived_repositories',
action: 'show',
id: project,
repository_id: repository.identifier_param }
- else
p.nodata = l(:label_no_data)

View file

@ -0,0 +1,101 @@
<div class="contextual">
&#171;
<% unless @changeset.previous.nil? -%>
<%= link_to_revision2(@changeset.previous, @repository, :text => l(:label_previous)) %>
<% else -%>
<%= l(:label_previous) %>
<% end -%>
|
<% unless @changeset.next.nil? -%>
<%= link_to_revision2(@changeset.next, @repository, :text => l(:label_next)) %>
<% else -%>
<%= l(:label_next) %>
<% end -%>
&#187;&nbsp;
<%= form_tag({:controller => 'archived_repositories',
:action => 'revision',
:id => @project,
:repository_id => @repository.identifier_param,
:rev => nil},
:method => :get) do %>
<%= text_field_tag 'rev', @rev, :size => 8 %>
<%= submit_tag 'OK', :name => nil %>
<% end %>
</div>
<h2><%= avatar(@changeset.user, :size => "24") %><%= l(:label_revision) %> <%= format_revision(@changeset) %></h2>
<% if @changeset.scmid.present? || @changeset.parents.present? || @changeset.children.present? %>
<table class="revision-info">
<% if @changeset.scmid.present? %>
<tr>
<td>ID</td><td><%= h(@changeset.scmid) %></td>
</tr>
<% end %>
<% if @changeset.parents.present? %>
<tr>
<td><%= l(:label_parent_revision) %></td>
<td>
<%= @changeset.parents.collect{
|p| link_to_revision2(p, @repository, :text => format_revision(p))
}.join(", ").html_safe %>
</td>
</tr>
<% end %>
<% if @changeset.children.present? %>
<tr>
<td><%= l(:label_child_revision) %></td>
<td>
<%= @changeset.children.collect{
|p| link_to_revision2(p, @repository, :text => format_revision(p))
}.join(", ").html_safe %>
</td>
</tr>
<% end %>
</table>
<% end %>
<p>
<span class="author">
<%= authoring(@changeset.committed_on, @changeset.author) %>
</span>
</p>
<%= textilizable @changeset.comments %>
<% if @changeset.issues.visible.any? || User.current.allowed_to?(:manage_related_issues, @repository.project) %>
<%= render :partial => 'related_issues' %>
<% end %>
<% if User.current.allowed_to?(:browse_repository, @project) %>
<h3><%= l(:label_attachment_plural) %></h3>
<ul id="changes-legend">
<li class="change change-A"><%= l(:label_added) %></li>
<li class="change change-M"><%= l(:label_modified) %></li>
<li class="change change-C"><%= l(:label_copied) %></li>
<li class="change change-R"><%= l(:label_renamed) %></li>
<li class="change change-D"><%= l(:label_deleted) %></li>
</ul>
<p><%= link_to(l(:label_view_diff),
:action => 'diff',
:id => @project,
:repository_id => @repository.identifier_param,
:path => "",
:rev => @changeset.identifier) if @changeset.filechanges.any? %></p>
<div class="changeset-changes">
<%= render_changeset_changes %>
</div>
<% end %>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>
<% end %>
<%
title = "#{l(:label_revision)} #{format_revision(@changeset)}"
title << " - #{@changeset.comments.truncate(80)}"
html_title(title)
-%>

View file

@ -0,0 +1,34 @@
<div class="contextual">
<%= form_tag(
{:controller => 'archived_repositories', :action => 'revision', :id => @project,
:repository_id => @repository.identifier_param},
:method => :get
) do %>
<%= l(:label_revision) %>: <%= text_field_tag 'rev', nil, :size => 8 %>
<%= submit_tag 'OK' %>
<% end %>
</div>
<h2><%= l(:label_revision_plural) %></h2>
<%= render :partial => 'revisions',
:locals => {:project => @project,
:path => '',
:revisions => @changesets,
:entry => nil } %>
<p class="pagination"><%= pagination_links_full @changeset_pages,@changeset_count %></p>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>
<%= auto_discovery_link_tag(
:atom,
params.merge(
{:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<% end %>
<% html_title(l(:label_revision_plural)) -%>

View file

@ -0,0 +1,71 @@
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
<div class="contextual">
<%= render :partial => 'navigation' %>
</div>
<h2><%= render :partial => 'breadcrumbs',
:locals => { :path => @path, :kind => 'dir', :revision => @rev } %></h2>
<% if !@entries.nil? %>
<%= render :partial => 'dir_list' %>
<% end %>
<%= render_properties(@properties) %>
<% if @changesets && !@changesets.empty? %>
<h3><%= l(:label_latest_revision_plural) %></h3>
<%= render :partial => 'revisions',
:locals => {:project => @project, :path => @path,
:revisions => @changesets, :entry => nil }%>
<% end %>
<p>
<% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0)
sep = '' %>
<% if @repository.supports_all_revisions? && @path.blank? %>
<%= link_to l(:label_view_all_revisions), :action => 'revisions', :id => @project,
:repository_id => @repository.identifier_param %>
<% sep = '|' %>
<% end %>
<% if @repository.supports_directory_revisions? &&
( has_branches || !@path.blank? || !@rev.blank? ) %>
<%= sep %>
<%= link_to l(:label_view_revisions),
:action => 'changes',
:path => to_path_param(@path),
:id => @project,
:repository_id => @repository.identifier_param,
:rev => @rev %>
<% end %>
</p>
<% if @repository.supports_all_revisions? %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(
:atom, params.merge(
{:format => 'atom', :action => 'revisions',
:id => @project, :page => nil, :key => User.current.rss_key})) %>
<% end %>
<%= call_hook(:view_repositories_show_bottom, { :repository => @repository, :project => @project }) %>
<% end %>
<% content_for :sidebar do %>
<h3><%= l(:label_repository_plural) %></h3>
<ul class="repository git">
<% @repositories.sort.each do |repo| %>
<li class="repository git"><%= link_to h(repo.name), {:controller => 'archived_repositories', :action => 'show', :id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil},
:class => 'repository' + (@repository.is_a?(Repository::Xitolite) ? ' git' : '') + (repo == @repository ? ' selected' : '') %>
</li>
<% end %>
</ul>
<%= render :partial => 'repositories/download_revision',
:locals => { :repository => @repository } %>
<% end %>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>
<% end %>
<% html_title(l(:label_repository)) -%>