Added basic support for CVS and Mercurial SCMs.
Browsing, changesets fetching and diff viewing are implemented. Only tested with local repositories. Thanks to Ralph Vater for CVS specific code. git-svn-id: http://redmine.rubyforge.org/svn/trunk@559 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -27,17 +27,17 @@
|
||||
<!--[eoform:project]-->
|
||||
</div>
|
||||
|
||||
<div class="box"><h3><%= check_box_tag "repository_enabled", 1, !@project.repository.nil?, :onclick => "Element.toggle('repository');" %> <%= l(:label_repository) %></h3>
|
||||
<%= hidden_field_tag "repository_enabled", 0 %>
|
||||
<div id="repository">
|
||||
<% fields_for :repository, @project.repository, { :builder => TabularFormBuilder, :lang => current_language} do |repository| %>
|
||||
<p><%= repository.text_field :url, :size => 60, :required => true, :disabled => (@project.repository && !@project.repository.root_url.blank?) %><br />(http://, https://, svn://, file:///)</p>
|
||||
<p><%= repository.text_field :login, :size => 30 %></p>
|
||||
<p><%= repository.password_field :password, :size => 30 %></p>
|
||||
<% end %>
|
||||
<div class="box">
|
||||
<h3><%= check_box_tag "repository_enabled", 1, !@project.repository.nil?, :onclick => "Element.toggle('repository');" %> <%= l(:label_repository) %></h3>
|
||||
<%= hidden_field_tag "repository_enabled", 0 %>
|
||||
<div id="repository">
|
||||
<p class="tabular"><label>SCM</label><%= scm_select_tag %></p>
|
||||
<div id="repository_fields">
|
||||
<%= render :partial => 'projects/repository', :locals => {:repository => @project.repository} if @project.repository %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= javascript_tag "Element.hide('repository');" if @project.repository.nil? %>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<h3><%= check_box_tag "wiki_enabled", 1, !@project.wiki.nil?, :onclick => "Element.toggle('wiki');" %> <%= l(:label_wiki) %></h3>
|
||||
@@ -58,4 +58,4 @@
|
||||
<%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
|
||||
<%= javascript_include_tag 'calendar/calendar-setup' %>
|
||||
<%= stylesheet_link_tag 'calendar' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<% fields_for :repository, repository, { :builder => TabularFormBuilder, :lang => current_language} do |f| %>
|
||||
<%= repository_field_tags(f, repository) %>
|
||||
<% end %>
|
||||
@@ -11,15 +11,15 @@
|
||||
<% total_size = 0
|
||||
@entries.each do |entry| %>
|
||||
<tr class="<%= cycle 'odd', 'even' %>">
|
||||
<td><%= link_to h(entry.name), { :action => (entry.is_dir? ? 'browse' : 'revisions'), :id => @project, :path => entry.path, :rev => @rev }, :class => ("icon " + (entry.is_dir? ? 'icon-folder' : 'icon-file')) %></td>
|
||||
<td align="right"><%= number_to_human_size(entry.size) unless entry.is_dir? %></td>
|
||||
<td align="right"><%= link_to entry.lastrev.identifier, :action => 'revision', :id => @project, :rev => entry.lastrev.identifier %></td>
|
||||
<td align="center"><%= format_time(entry.lastrev.time) %></td>
|
||||
<td align="center"><em><%=h entry.lastrev.author %></em></td>
|
||||
<% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) %>
|
||||
<td><%= link_to h(entry.name), { :action => (entry.is_dir? ? 'browse' : 'changes'), :id => @project, :path => entry.path, :rev => @rev }, :class => ("icon " + (entry.is_dir? ? 'icon-folder' : 'icon-file')) %></td>
|
||||
<td align="right"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
|
||||
<td align="right"><%= link_to(entry.lastrev.name, :action => 'revision', :id => @project, :rev => entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %></td>
|
||||
<td align="center"><%= format_time(entry.lastrev.time) if entry.lastrev %></td>
|
||||
<td align="center"><em><%=h(entry.lastrev.author) if entry.lastrev %></em></td>
|
||||
<% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) if entry.lastrev %>
|
||||
<td><%=h truncate(changeset.comments, 100) unless changeset.nil? %></td>
|
||||
</tr>
|
||||
<% total_size += entry.size
|
||||
<% total_size += entry.size if entry.size
|
||||
end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -5,7 +5,8 @@ if 'file' == kind
|
||||
filename = dirs.pop
|
||||
end
|
||||
link_path = ''
|
||||
dirs.each do |dir|
|
||||
dirs.each do |dir|
|
||||
next if dir.blank?
|
||||
link_path << '/' unless link_path.empty?
|
||||
link_path << "#{dir}"
|
||||
%>
|
||||
@@ -15,4 +16,4 @@ dirs.each do |dir|
|
||||
/ <%= link_to h(filename), :action => 'revisions', :id => @project, :path => "#{link_path}/#{filename}", :rev => @rev %>
|
||||
<% end %>
|
||||
|
||||
<%= "@ #{revision}" if revision %>
|
||||
<%= "@ #{revision}" if revision %>
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
<th><%= l(:field_comments) %></th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<% show_diff = entry && entry.is_file? && changesets.size > 1 %>
|
||||
<% show_diff = entry && entry.is_file? && revisions.size > 1 %>
|
||||
<% line_num = 1 %>
|
||||
<% changesets.each do |changeset| %>
|
||||
<% revisions.each do |revision| %>
|
||||
<% changeset = revision.is_a?(Change) ? revision.changeset : revision %>
|
||||
<tr class="<%= cycle 'odd', 'even' %>">
|
||||
<th align="center" style="width:3em;"><%= link_to changeset.revision, :action => 'revision', :id => project, :rev => changeset.revision %></th>
|
||||
<td align="center" style="width:1em;"><%= radio_button_tag('rev', changeset.revision, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < changesets.size) %></td>
|
||||
<th align="center" style="width:3em;"><%= link_to (revision.revision || changeset.revision), :action => 'revision', :id => project, :rev => changeset.revision %></th>
|
||||
<td align="center" style="width:1em;"><%= radio_button_tag('rev', changeset.revision, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < revisions.size) %></td>
|
||||
<td align="center" style="width:1em;"><%= radio_button_tag('rev_to', changeset.revision, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %></td>
|
||||
<td align="center" style="width:15%"><%= format_time(changeset.committed_on) %></td>
|
||||
<td align="center" style="width:15%"><em><%=h changeset.committer %></em></td>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %></h2>
|
||||
|
||||
<h3><%=h @entry.name %></h3>
|
||||
|
||||
<p>
|
||||
<% if @entry.is_text? %>
|
||||
<%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> |
|
||||
<% end %>
|
||||
<%= link_to l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' } %>
|
||||
<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
|
||||
</p>
|
||||
|
||||
<%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changes, :entry => @entry }%>
|
||||
@@ -7,7 +7,9 @@
|
||||
|
||||
<h2><%= l(:label_revision) %> <%= @changeset.revision %></h2>
|
||||
|
||||
<p><em><%= @changeset.committer %>, <%= format_time(@changeset.committed_on) %></em></p>
|
||||
<p><% if @changeset.scmid %>ID: <%= @changeset.scmid %><br /><% end %>
|
||||
<em><%= @changeset.committer %>, <%= format_time(@changeset.committed_on) %></em></p>
|
||||
|
||||
<%= textilizable @changeset.comments %>
|
||||
|
||||
<% if @changeset.issues.any? %>
|
||||
@@ -30,7 +32,7 @@
|
||||
<tbody>
|
||||
<% @changes.each do |change| %>
|
||||
<tr class="<%= cycle 'odd', 'even' %>">
|
||||
<td><div class="square action_<%= change.action %>"></div> <%= change.path %></td>
|
||||
<td><div class="square action_<%= change.action %>"></div> <%= change.path %> <%= "(#{change.revision})" unless change.revision.blank? %></td>
|
||||
<td align="right">
|
||||
<% if change.action == "M" %>
|
||||
<%= link_to l(:label_view_diff), :action => 'diff', :id => @project, :path => change.path, :rev => @changeset.revision %>
|
||||
|
||||
@@ -5,25 +5,13 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %></h2>
|
||||
<h2><%= l(:label_revision_plural) %></h2>
|
||||
|
||||
<% if @entry && @entry.is_file? %>
|
||||
<h3><%=h @entry.name %></h3>
|
||||
<p>
|
||||
<% if @entry.is_text? %>
|
||||
<%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> |
|
||||
<% end %>
|
||||
<%= link_to l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' } %>
|
||||
(<%= number_to_human_size @entry.size %>)</p>
|
||||
<% end %>
|
||||
|
||||
<h3><%= l(:label_revision_plural) %></h3>
|
||||
|
||||
<%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :changesets => @changesets, :entry => @entry }%>
|
||||
<%= render :partial => 'revisions', :locals => {:project => @project, :path => '', :revisions => @changesets, :entry => nil }%>
|
||||
|
||||
<p><%= pagination_links_full @changeset_pages %>
|
||||
[ <%= @changeset_pages.current.first_item %> - <%= @changeset_pages.current.last_item %> / <%= @changeset_count %> ]</p>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -2,17 +2,19 @@
|
||||
<%= link_to l(:label_statistics), {:action => 'stats', :id => @project}, :class => 'icon icon-stats' %>
|
||||
</div>
|
||||
|
||||
<h2><%= l(:label_repository) %></h2>
|
||||
<h2><%= l(:label_repository) %> (<%= @repository.scm_name %>)</h2>
|
||||
|
||||
<% unless @entries.nil? %>
|
||||
<h3><%= l(:label_browse) %></h3>
|
||||
<%= render :partial => 'dir_list' %>
|
||||
<% end %>
|
||||
|
||||
<% unless @changesets.empty? %>
|
||||
<h3><%= l(:label_latest_revision_plural) %></h3>
|
||||
<%= render :partial => 'revisions', :locals => {:project => @project, :path => '', :changesets => @changesets, :entry => nil }%>
|
||||
<%= render :partial => 'revisions', :locals => {:project => @project, :path => '', :revisions => @changesets, :entry => nil }%>
|
||||
<p><%= link_to l(:label_view_revisions), :action => 'revisions', :id => @project %></p>
|
||||
<% end %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user