| |   |
| 5 | 5 | LOGS_PER_PAGE = 30 |
| 6 | 6 | |
| 7 | 7 | def index |
| 8 | | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 9 | | @commits = @git.log(LOGS_PER_PAGE) |
| 10 | | @tags_per_sha = @git.tags_by_sha |
| 8 | @git = @repository.git |
| 9 | @commits = @git.commits(@repository.head_candidate.name, LOGS_PER_PAGE) |
| 11 | 10 | # TODO: Patch rails to keep track of what it responds to so we can DRY this up |
| 12 | 11 | @atom_auto_discovery_url = project_repository_formatted_browse_path(@project, @repository, :atom) |
| 13 | 12 | respond_to do |format| |
| … | … | |
| 16 | 16 | end |
| 17 | 17 | |
| 18 | 18 | def tree |
| 19 | | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 20 | | @tree = @git.tree(params[:sha]) |
| 19 | @git = @repository.git |
| 20 | @commit = @git.commit(params[:sha]) |
| 21 | path = params[:path].blank? ? [] : ["#{params[:path].join("/")}/"] # FIXME: meh, this sux |
| 22 | @tree = @git.tree(@commit.tree.id, path) |
| 21 | 23 | end |
| 22 | 24 | |
| 23 | 25 | def commit |
| 24 | 26 | @diffmode = params[:diffmode] == "sidebyside" ? "sidebyside" : "inline" |
| 25 | | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 27 | @git = @repository.git |
| 26 | 28 | @commit = @git.commit(params[:sha]) |
| 27 | | if @commit.parent |
| 28 | | @diff = @git.diff(@commit.parent.sha || "", @commit.sha) |
| 29 | | else |
| 30 | | # initial commit, link to the initial tree instead |
| 31 | | @diff = nil |
| 32 | | end |
| 33 | | @comment_count = @repository.comments.count(:all, :conditions => {:sha1 => @commit.sha}) |
| 29 | @diff = @commit.diffs |
| 30 | @comment_count = @repository.comments.count(:all, :conditions => {:sha1 => @commit.id}) |
| 34 | 31 | end |
| 35 | 32 | |
| 36 | 33 | def diff |
| 37 | | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 34 | @git = @repository.git |
| 38 | 35 | @diff = @git.diff(params[:sha], params[:other_sha]) |
| 39 | 36 | end |
| 40 | 37 | |
| 41 | 38 | def blob |
| 42 | | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 43 | | @blob = @git.blob(params[:sha]) |
| 39 | @git = @repository.git |
| 40 | @commit = @git.commit(params[:sha]) |
| 41 | @blob = @git.tree(@commit.tree.id, ["#{params[:path].join("/")}"]).contents.first |
| 42 | render_not_found and return unless @blob |
| 44 | 43 | end |
| 45 | 44 | |
| 46 | 45 | def raw |
| 47 | | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 48 | | @blob = @git.blob(params[:sha]) |
| 49 | | render :text => @blob.contents, :content_type => "text/plain" |
| 46 | @git = @repository.git |
| 47 | @commit = @git.commit(params[:sha]) |
| 48 | @blob = @git.tree(@commit.tree.id, ["#{params[:path].join("/")}"]).contents.first |
| 49 | render_not_found and return unless @blob |
| 50 | render :text => @blob.data, :content_type => "text/plain" |
| 50 | 51 | end |
| 51 | 52 | |
| 52 | 53 | def log |
| 53 | | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 54 | @git = @repository.git |
| 54 | 55 | skip = params[:page].blank? ? 0 : (params[:page].to_i-1) * LOGS_PER_PAGE |
| 55 | | @commits = @git.log(LOGS_PER_PAGE, skip) |
| 56 | | @tags_per_sha = @git.tags_by_sha |
| 56 | @commits = @git.commits(@repository.head_candidate.name, LOGS_PER_PAGE, skip) |
| 57 | 57 | # TODO: Patch rails to keep track of what it responds to so we can DRY this up |
| 58 | 58 | @atom_auto_discovery_url = project_repository_formatted_browse_path(@project, @repository, :atom) |
| 59 | 59 | respond_to do |format| |
| toggle raw diff |
--- a/app/controllers/browse_controller.rb
+++ b/app/controllers/browse_controller.rb
@@ -5,9 +5,8 @@ class BrowseController < ApplicationController
LOGS_PER_PAGE = 30
def index
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
- @commits = @git.log(LOGS_PER_PAGE)
- @tags_per_sha = @git.tags_by_sha
+ @git = @repository.git
+ @commits = @git.commits(@repository.head_candidate.name, LOGS_PER_PAGE)
# TODO: Patch rails to keep track of what it responds to so we can DRY this up
@atom_auto_discovery_url = project_repository_formatted_browse_path(@project, @repository, :atom)
respond_to do |format|
@@ -17,44 +16,44 @@ class BrowseController < ApplicationController
end
def tree
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
- @tree = @git.tree(params[:sha])
+ @git = @repository.git
+ @commit = @git.commit(params[:sha])
+ path = params[:path].blank? ? [] : ["#{params[:path].join("/")}/"] # FIXME: meh, this sux
+ @tree = @git.tree(@commit.tree.id, path)
end
def commit
@diffmode = params[:diffmode] == "sidebyside" ? "sidebyside" : "inline"
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
+ @git = @repository.git
@commit = @git.commit(params[:sha])
- if @commit.parent
- @diff = @git.diff(@commit.parent.sha || "", @commit.sha)
- else
- # initial commit, link to the initial tree instead
- @diff = nil
- end
- @comment_count = @repository.comments.count(:all, :conditions => {:sha1 => @commit.sha})
+ @diff = @commit.diffs
+ @comment_count = @repository.comments.count(:all, :conditions => {:sha1 => @commit.id})
end
def diff
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
+ @git = @repository.git
@diff = @git.diff(params[:sha], params[:other_sha])
end
def blob
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
- @blob = @git.blob(params[:sha])
+ @git = @repository.git
+ @commit = @git.commit(params[:sha])
+ @blob = @git.tree(@commit.tree.id, ["#{params[:path].join("/")}"]).contents.first
+ render_not_found and return unless @blob
end
def raw
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
- @blob = @git.blob(params[:sha])
- render :text => @blob.contents, :content_type => "text/plain"
+ @git = @repository.git
+ @commit = @git.commit(params[:sha])
+ @blob = @git.tree(@commit.tree.id, ["#{params[:path].join("/")}"]).contents.first
+ render_not_found and return unless @blob
+ render :text => @blob.data, :content_type => "text/plain"
end
def log
- @git = Gitorious::Gitto.new(@repository.full_repository_path)
+ @git = @repository.git
skip = params[:page].blank? ? 0 : (params[:page].to_i-1) * LOGS_PER_PAGE
- @commits = @git.log(LOGS_PER_PAGE, skip)
- @tags_per_sha = @git.tags_by_sha
+ @commits = @git.commits(@repository.head_candidate.name, LOGS_PER_PAGE, skip)
# TODO: Patch rails to keep track of what it responds to so we can DRY this up
@atom_auto_discovery_url = project_repository_formatted_browse_path(@project, @repository, :atom)
respond_to do |format| |
| |   |
| 36 | 36 | current_path << path |
| 37 | 37 | end |
| 38 | 38 | |
| 39 | | # def breadcrumb_path |
| 40 | | # out = %Q{<ul class="path_breadcrumbs">\n} |
| 41 | | # visited_path = [] |
| 42 | | # out << %Q{ <li>/ #{link_to("root", tree_path(params[:sha], []))}</li>\n} |
| 43 | | # current_path.each_with_index do |path, index| |
| 44 | | # visited_path << path |
| 45 | | # out << %Q{ <li>/ #{link_to(path, tree_path(params[:sha], path))}</li>\n} |
| 46 | | # end |
| 47 | | # out << "</ul>" |
| 48 | | # out |
| 49 | | # end |
| 39 | def breadcrumb_path(root_name = "root", commit_id = params[:sha]) |
| 40 | return if current_path.blank? |
| 41 | out = %Q{<ul class="path_breadcrumbs">\n} |
| 42 | visited_path = [] |
| 43 | out << %Q{ <li>#{link_to(root_name, tree_path(commit_id, []))}</li>\n} |
| 44 | current_path.each_with_index do |path, index| |
| 45 | visited_path << path |
| 46 | if visited_path == current_path |
| 47 | out << %Q{ <li>/ #{path}</li>\n} |
| 48 | else |
| 49 | out << %Q{ <li>/ #{link_to(path, tree_path(commit_id, visited_path))}</li>\n} |
| 50 | end |
| 51 | end |
| 52 | out << "</ul>" |
| 53 | out |
| 54 | end |
| 50 | 55 | |
| 51 | 56 | def render_tag_box_if_match(sha, tags_per_sha) |
| 52 | 57 | tags = tags_per_sha[sha] |
| … | … | |
| 66 | 66 | end |
| 67 | 67 | |
| 68 | 68 | # Takes a unified diff as input and renders it as html |
| 69 | | def render_diff(udiff, src_sha, dst_sha, display_mode = "inline") |
| 69 | def render_diff(udiff, display_mode = "inline") |
| 70 | 70 | return if udiff.blank? |
| 71 | 71 | |
| 72 | 72 | case display_mode |
| 73 | 73 | when "sidebyside" |
| 74 | | render_sidebyside_diff(udiff, src_sha, dst_sha) |
| 74 | render_sidebyside_diff(udiff) |
| 75 | 75 | else |
| 76 | | render_inline_diff(udiff, src_sha, dst_sha) |
| 76 | render_inline_diff(udiff) |
| 77 | 77 | end |
| 78 | 78 | end |
| 79 | 79 | |
| 80 | 80 | #diff = Diff::Display::Unified.new(load_diff("simple")) |
| 81 | 81 | #diff.render(Diff::Renderer::Base.new) |
| 82 | | def render_inline_diff(udiff, src_sha, dst_sha) |
| 82 | def render_inline_diff(udiff) |
| 83 | 83 | differ = Diff::Display::Unified.new(udiff) |
| 84 | 84 | out = %Q{<table class="codediff inline">\n} |
| 85 | 85 | out << "<thead>\n" |
| 86 | 86 | out << "<tr>" |
| 87 | | out << %Q{<td class="line-numbers">#{src_sha}</td>} |
| 88 | | out << %Q{<td class="line-numbers">#{dst_sha}</td>} |
| 87 | out << %Q{<td class="line-numbers"></td>} |
| 88 | out << %Q{<td class="line-numbers"></td>} |
| 89 | 89 | out << "<td> </td></tr>\n" |
| 90 | 90 | out << "</thead>\n" |
| 91 | 91 | out << differ.render(Gitorious::Diff::InlineTableCallback.new) |
| … | … | |
| 98 | 98 | out |
| 99 | 99 | end |
| 100 | 100 | |
| 101 | | def render_sidebyside_diff(udiff, src_sha, dst_sha) |
| 101 | def render_sidebyside_diff(udiff) |
| 102 | 102 | differ = Diff::Display::Unified.new(udiff) |
| 103 | 103 | out = %Q{<table class="codediff sidebyside">\n} |
| 104 | 104 | out << %Q{<colgroup class="left"><col class="lines"/><col class="code"/></colgroup>} |
| 105 | 105 | out << %Q{<colgroup class="right"><col class="lines"/><col class="code"/></colgroup>} |
| 106 | | out << %Q{<thead><th class="line-numbers">#{src_sha}</th><th></th>} |
| 107 | | out << %Q{<th class="line-numbers">#{dst_sha}</th><th></th></thead>} |
| 106 | out << %Q{<thead><th class="line-numbers"></th><th></th>} |
| 107 | out << %Q{<th class="line-numbers"></th><th></th></thead>} |
| 108 | 108 | out << differ.render(Gitorious::Diff::SidebysideTableCallback.new) |
| 109 | 109 | out << %Q{<tr class="toggle_diff"><td colspan="4">} |
| 110 | 110 | out << %Q{<small>#{link_to_function "toggle raw diff", "$('diff#{udiff.object_id}').toggle()"}</small></td></tr>} |
| toggle raw diff |
--- a/app/helpers/browse_helper.rb
+++ b/app/helpers/browse_helper.rb
@@ -36,17 +36,22 @@ module BrowseHelper
current_path << path
end
- # def breadcrumb_path
- # out = %Q{<ul class="path_breadcrumbs">\n}
- # visited_path = []
- # out << %Q{ <li>/ #{link_to("root", tree_path(params[:sha], []))}</li>\n}
- # current_path.each_with_index do |path, index|
- # visited_path << path
- # out << %Q{ <li>/ #{link_to(path, tree_path(params[:sha], path))}</li>\n}
- # end
- # out << "</ul>"
- # out
- # end
+ def breadcrumb_path(root_name = "root", commit_id = params[:sha])
+ return if current_path.blank?
+ out = %Q{<ul class="path_breadcrumbs">\n}
+ visited_path = []
+ out << %Q{ <li>#{link_to(root_name, tree_path(commit_id, []))}</li>\n}
+ current_path.each_with_index do |path, index|
+ visited_path << path
+ if visited_path == current_path
+ out << %Q{ <li>/ #{path}</li>\n}
+ else
+ out << %Q{ <li>/ #{link_to(path, tree_path(commit_id, visited_path))}</li>\n}
+ end
+ end
+ out << "</ul>"
+ out
+ end
def render_tag_box_if_match(sha, tags_per_sha)
tags = tags_per_sha[sha]
@@ -61,26 +66,26 @@ module BrowseHelper
end
# Takes a unified diff as input and renders it as html
- def render_diff(udiff, src_sha, dst_sha, display_mode = "inline")
+ def render_diff(udiff, display_mode = "inline")
return if udiff.blank?
case display_mode
when "sidebyside"
- render_sidebyside_diff(udiff, src_sha, dst_sha)
+ render_sidebyside_diff(udiff)
else
- render_inline_diff(udiff, src_sha, dst_sha)
+ render_inline_diff(udiff)
end
end
#diff = Diff::Display::Unified.new(load_diff("simple"))
#diff.render(Diff::Renderer::Base.new)
- def render_inline_diff(udiff, src_sha, dst_sha)
+ def render_inline_diff(udiff)
differ = Diff::Display::Unified.new(udiff)
out = %Q{<table class="codediff inline">\n}
out << "<thead>\n"
out << "<tr>"
- out << %Q{<td class="line-numbers">#{src_sha}</td>}
- out << %Q{<td class="line-numbers">#{dst_sha}</td>}
+ out << %Q{<td class="line-numbers"></td>}
+ out << %Q{<td class="line-numbers"></td>}
out << "<td> </td></tr>\n"
out << "</thead>\n"
out << differ.render(Gitorious::Diff::InlineTableCallback.new)
@@ -93,13 +98,13 @@ module BrowseHelper
out
end
- def render_sidebyside_diff(udiff, src_sha, dst_sha)
+ def render_sidebyside_diff(udiff)
differ = Diff::Display::Unified.new(udiff)
out = %Q{<table class="codediff sidebyside">\n}
out << %Q{<colgroup class="left"><col class="lines"/><col class="code"/></colgroup>}
out << %Q{<colgroup class="right"><col class="lines"/><col class="code"/></colgroup>}
- out << %Q{<thead><th class="line-numbers">#{src_sha}</th><th></th>}
- out << %Q{<th class="line-numbers">#{dst_sha}</th><th></th></thead>}
+ out << %Q{<thead><th class="line-numbers"></th><th></th>}
+ out << %Q{<th class="line-numbers"></th><th></th></thead>}
out << differ.render(Gitorious::Diff::SidebysideTableCallback.new)
out << %Q{<tr class="toggle_diff"><td colspan="4">}
out << %Q{<small>#{link_to_function "toggle raw diff", "$('diff#{udiff.object_id}').toggle()"}</small></td></tr>} |
| |   |
| 15 | 15 | after_create :add_user_as_committer, :create_new_repos_task |
| 16 | 16 | after_destroy :create_delete_repos_task |
| 17 | 17 | |
| 18 | BASE_REPOSITORY_URL = "gitorious.org" |
| 19 | |
| 18 | 20 | def self.new_by_cloning(other, username=nil) |
| 19 | 21 | suggested_name = username ? "#{username}s-#{other.name}-clone" : nil |
| 20 | 22 | new(:parent => other, :project => other.project, :name => suggested_name) |
| … | … | |
| 26 | 26 | find_by_name(name) || raise(ActiveRecord::RecordNotFound) |
| 27 | 27 | end |
| 28 | 28 | |
| 29 | | BASE_REPOSITORY_URL = "gitorious.org" |
| 29 | def self.create_git_repository(path) |
| 30 | git_backend.create(full_path_from_partial_path(path)) |
| 31 | end |
| 32 | |
| 33 | def self.clone_git_repository(target_path, source_path) |
| 34 | git_backend.clone(full_path_from_partial_path(target_path), |
| 35 | full_path_from_partial_path(source_path)) |
| 36 | end |
| 37 | |
| 38 | def self.delete_git_repository(path) |
| 39 | git_backend.delete!(full_path_from_partial_path(path)) |
| 40 | end |
| 30 | 41 | |
| 31 | 42 | def gitdir |
| 32 | 43 | File.join(project.slug, "#{name}.git") |
| … | … | |
| 55 | 55 | self.class.full_path_from_partial_path(gitdir) |
| 56 | 56 | end |
| 57 | 57 | |
| 58 | | def self.create_git_repository(path) |
| 59 | | git_backend.create(full_path_from_partial_path(path)) |
| 60 | | end |
| 61 | | |
| 62 | | def self.clone_git_repository(target_path, source_path) |
| 63 | | git_backend.clone(full_path_from_partial_path(target_path), |
| 64 | | full_path_from_partial_path(source_path)) |
| 65 | | end |
| 66 | | |
| 67 | | def self.delete_git_repository(path) |
| 68 | | git_backend.delete!(full_path_from_partial_path(path)) |
| 58 | def git |
| 59 | Grit::Repo.new(full_repository_path) |
| 69 | 60 | end |
| 70 | 61 | |
| 71 | 62 | def has_commits? |
| 72 | | git_backend.repository_has_commits?(full_repository_path) |
| 63 | return false if new_record? || !ready? |
| 64 | !git.heads.empty? |
| 73 | 65 | end |
| 74 | 66 | |
| 75 | 67 | def self.git_backend |
| … | … | |
| 86 | 86 | end |
| 87 | 87 | end |
| 88 | 88 | |
| 89 | def head_candidate |
| 90 | return nil unless has_commits? |
| 91 | @head_candidate ||= git.heads.find{|h| h.name == "master"} || git.heads.first |
| 92 | end |
| 93 | |
| 89 | 94 | def last_commit |
| 90 | 95 | if has_commits? |
| 91 | | @last_commit ||= Git.bare(full_repository_path).log(1).first |
| 96 | @last_commit ||= git.commits(head_candidate.name, 1).first |
| 92 | 97 | end |
| 93 | 98 | @last_commit |
| 94 | 99 | end |
| toggle raw diff |
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -15,6 +15,8 @@ class Repository < ActiveRecord::Base
after_create :add_user_as_committer, :create_new_repos_task
after_destroy :create_delete_repos_task
+ BASE_REPOSITORY_URL = "gitorious.org"
+
def self.new_by_cloning(other, username=nil)
suggested_name = username ? "#{username}s-#{other.name}-clone" : nil
new(:parent => other, :project => other.project, :name => suggested_name)
@@ -24,7 +26,18 @@ class Repository < ActiveRecord::Base
find_by_name(name) || raise(ActiveRecord::RecordNotFound)
end
- BASE_REPOSITORY_URL = "gitorious.org"
+ def self.create_git_repository(path)
+ git_backend.create(full_path_from_partial_path(path))
+ end
+
+ def self.clone_git_repository(target_path, source_path)
+ git_backend.clone(full_path_from_partial_path(target_path),
+ full_path_from_partial_path(source_path))
+ end
+
+ def self.delete_git_repository(path)
+ git_backend.delete!(full_path_from_partial_path(path))
+ end
def gitdir
File.join(project.slug, "#{name}.git")
@@ -42,21 +55,13 @@ class Repository < ActiveRecord::Base
self.class.full_path_from_partial_path(gitdir)
end
- def self.create_git_repository(path)
- git_backend.create(full_path_from_partial_path(path))
- end
-
- def self.clone_git_repository(target_path, source_path)
- git_backend.clone(full_path_from_partial_path(target_path),
- full_path_from_partial_path(source_path))
- end
-
- def self.delete_git_repository(path)
- git_backend.delete!(full_path_from_partial_path(path))
+ def git
+ Grit::Repo.new(full_repository_path)
end
def has_commits?
- git_backend.repository_has_commits?(full_repository_path)
+ return false if new_record? || !ready?
+ !git.heads.empty?
end
def self.git_backend
@@ -81,9 +86,14 @@ class Repository < ActiveRecord::Base
end
end
+ def head_candidate
+ return nil unless has_commits?
+ @head_candidate ||= git.heads.find{|h| h.name == "master"} || git.heads.first
+ end
+
def last_commit
if has_commits?
- @last_commit ||= Git.bare(full_repository_path).log(1).first
+ @last_commit ||= git.commits(head_candidate.name, 1).first
end
@last_commit
end |
| |   |
| 1 | 1 | <ul class="infobox"> |
| 2 | | <li><strong>Date:</strong> <%=h @commit.date -%></li> |
| 2 | <li><strong>Date:</strong> <%=h @commit.committed_date -%></li> |
| 3 | 3 | <li><strong>Committer:</strong> <%=h @commit.committer.name -%> (<%=h @commit.committer.email -%>)</li> |
| 4 | 4 | <% unless @commit.author.email == @commit.committer.email -%> |
| 5 | 5 | <li><strong>Author:</strong> <%=h @commit.author.name -%> (<%=h @commit.author.email -%>)</li> |
| 6 | 6 | <% end -%> |
| 7 | | <li><strong>Commit SHA1:</strong> <%=h @commit.sha -%></li> |
| 8 | | <li><strong>Tree SHA1:</strong> <%= link_to h(@commit.gtree.sha), |
| 9 | | project_repository_tree_path(@project, @repository, @commit.gtree.sha) -%></li> |
| 7 | <li><strong>Commit SHA1:</strong> <%=h @commit.id -%></li> |
| 8 | <li><strong>Tree SHA1:</strong> <%= link_to h(@commit.tree.id), |
| 9 | project_repository_tree_path(@project, @repository, @commit.id) -%></li> |
| 10 | 10 | </ul> |
| toggle raw diff |
--- a/app/views/browse/_commit_infobox.html.erb
+++ b/app/views/browse/_commit_infobox.html.erb
@@ -1,10 +1,10 @@
<ul class="infobox">
- <li><strong>Date:</strong> <%=h @commit.date -%></li>
+ <li><strong>Date:</strong> <%=h @commit.committed_date -%></li>
<li><strong>Committer:</strong> <%=h @commit.committer.name -%> (<%=h @commit.committer.email -%>)</li>
<% unless @commit.author.email == @commit.committer.email -%>
<li><strong>Author:</strong> <%=h @commit.author.name -%> (<%=h @commit.author.email -%>)</li>
<% end -%>
- <li><strong>Commit SHA1:</strong> <%=h @commit.sha -%></li>
- <li><strong>Tree SHA1:</strong> <%= link_to h(@commit.gtree.sha),
- project_repository_tree_path(@project, @repository, @commit.gtree.sha) -%></li>
+ <li><strong>Commit SHA1:</strong> <%=h @commit.id -%></li>
+ <li><strong>Tree SHA1:</strong> <%= link_to h(@commit.tree.id),
+ project_repository_tree_path(@project, @repository, @commit.id) -%></li>
</ul>
\ No newline at end of file |
| |   |
| 1 | 1 | <ul> |
| 2 | 2 | <% @commits.each do |commit| -%> |
| 3 | 3 | <li class="commit_item"> |
| 4 | | <a href=""><%= link_to h(commit.sha)[0,6], |
| 5 | | project_repository_commit_path(@project, @repository, commit.sha) -%></a> |
| 6 | | by <strong><%=h commit.committer.name -%></strong> <%=h time_ago_in_words(commit.committer.date) -%> ago |
| 4 | <a href=""><%= link_to h(commit.id_abbrev), |
| 5 | project_repository_commit_path(@project, @repository, commit.id) -%></a> |
| 6 | by <strong><%=h commit.committer.name -%></strong> <%=h time_ago_in_words(commit.committed_date) -%> ago |
| 7 | 7 | <div class="commit_message"><%= simple_format(h(commit.message)) -%></div> |
| 8 | 8 | </li> |
| 9 | 9 | <% end -%> |
| toggle raw diff |
--- a/app/views/browse/_log.html.erb
+++ b/app/views/browse/_log.html.erb
@@ -1,9 +1,9 @@
<ul>
<% @commits.each do |commit| -%>
<li class="commit_item">
- <a href=""><%= link_to h(commit.sha)[0,6],
- project_repository_commit_path(@project, @repository, commit.sha) -%></a>
- by <strong><%=h commit.committer.name -%></strong> <%=h time_ago_in_words(commit.committer.date) -%> ago
+ <a href=""><%= link_to h(commit.id_abbrev),
+ project_repository_commit_path(@project, @repository, commit.id) -%></a>
+ by <strong><%=h commit.committer.name -%></strong> <%=h time_ago_in_words(commit.committed_date) -%> ago
<div class="commit_message"><%= simple_format(h(commit.message)) -%></div>
</li>
<% end -%> |
| |   |
| 12 | 12 | |
| 13 | 13 | <h1> |
| 14 | 14 | Blob of <code><%= current_path.join("/") -%></code> |
| 15 | | <small>(<%= link_to "raw blob data", raw_blob_path(@blob.sha, current_path) -%>)</small> |
| 15 | <small>(<%= link_to "raw blob data", raw_blob_path(@commit.id, current_path) -%>)</small> |
| 16 | 16 | </h1> |
| 17 | 17 | |
| 18 | <%= breadcrumb_path(@repository.name, @commit.id) -%> |
| 19 | |
| 18 | 20 | <% cache do -%> |
| 19 | | <%= render_highlighted(@blob.contents, current_path.last || "") -%> |
| 21 | <%= render_highlighted(@blob.data, current_path.last || "") -%> |
| 20 | 22 | <% end -%> |
| toggle raw diff |
--- a/app/views/browse/blob.html.erb
+++ b/app/views/browse/blob.html.erb
@@ -12,9 +12,11 @@
<h1>
Blob of <code><%= current_path.join("/") -%></code>
- <small>(<%= link_to "raw blob data", raw_blob_path(@blob.sha, current_path) -%>)</small>
+ <small>(<%= link_to "raw blob data", raw_blob_path(@commit.id, current_path) -%>)</small>
</h1>
+<%= breadcrumb_path(@repository.name, @commit.id) -%>
+
<% cache do -%>
- <%= render_highlighted(@blob.contents, current_path.last || "") -%>
+ <%= render_highlighted(@blob.data, current_path.last || "") -%>
<% end -%> |
| |   |
| 1 | 1 | <% @page_title = "Commit in #{@repository.name} in #{@project.title}" -%> |
| 2 | 2 | |
| 3 | | <h1>Commit <%=h @commit.sha -%></h1> |
| 3 | <h1>Commit <%=h @commit.id -%></h1> |
| 4 | 4 | |
| 5 | 5 | <div class="commit_message"><%= simple_format(h(@commit.message)) -%></div> |
| 6 | 6 | <%= render :partial => "commit_infobox" -%> |
| … | … | |
| 8 | 8 | <ul class="tab_menu"> |
| 9 | 9 | <li class="selected">Commit diff</li> |
| 10 | 10 | <li><%= link_to "Comments (#{@comment_count})", |
| 11 | | project_repository_commit_comment_path(@project, @repository, @commit.sha) -%></li> |
| 11 | project_repository_commit_comment_path(@project, @repository, @commit.id) -%></li> |
| 12 | 12 | </ul> |
| 13 | 13 | |
| 14 | 14 | |
| … | … | |
| 16 | 16 | <% if @diff.blank? -%> |
| 17 | 17 | <p> |
| 18 | 18 | This is the initial commit in this repository, |
| 19 | | <%= link_to "browse the initial tree state", tree_path(@commit.gtree.sha) -%>. |
| 19 | <%= link_to "browse the initial tree state", tree_path(@commit.id) -%>. |
| 20 | 20 | </p> |
| 21 | 21 | <% else -%> |
| 22 | 22 | <% cache({:diffmode => @diffmode}) do -%> |
| 23 | | <%= render_diff_stats(@diff.stats) -%> |
| 23 | <%#= render_diff_stats(@diff.stats) -%> |
| 24 | 24 | <h2>Commit diff</h2> |
| 25 | 25 | <%= render_diffmode_selector -%> |
| 26 | | <% @diff.each do |file, index| -%> |
| 27 | | <a name="<%= h(file.path) -%>"></a> |
| 28 | | <h4><%= h(file.path) -%><%#=link_to h(file.path), blob_path(file.sha, file.path) -%></h4> |
| 29 | | <%= render_diff(file.patch, file.src, file.dst, @diffmode) -%> |
| 26 | <% @diff.each do |file| -%> |
| 27 | <a name="<%= h(file.a_path) -%>"></a> |
| 28 | <h4><%=h(file.a_path) -%></h4> |
| 29 | <%= render_diff(file.diff, @diffmode) -%> |
| 30 | 30 | <% end -%> |
| 31 | 31 | <% end -%> |
| 32 | 32 | <% end -%> |
| toggle raw diff |
--- a/app/views/browse/commit.html.erb
+++ b/app/views/browse/commit.html.erb
@@ -1,6 +1,6 @@
<% @page_title = "Commit in #{@repository.name} in #{@project.title}" -%>
-<h1>Commit <%=h @commit.sha -%></h1>
+<h1>Commit <%=h @commit.id -%></h1>
<div class="commit_message"><%= simple_format(h(@commit.message)) -%></div>
<%= render :partial => "commit_infobox" -%>
@@ -8,7 +8,7 @@
<ul class="tab_menu">
<li class="selected">Commit diff</li>
<li><%= link_to "Comments (#{@comment_count})",
- project_repository_commit_comment_path(@project, @repository, @commit.sha) -%></li>
+ project_repository_commit_comment_path(@project, @repository, @commit.id) -%></li>
</ul>
@@ -16,17 +16,17 @@
<% if @diff.blank? -%>
<p>
This is the initial commit in this repository,
- <%= link_to "browse the initial tree state", tree_path(@commit.gtree.sha) -%>.
+ <%= link_to "browse the initial tree state", tree_path(@commit.id) -%>.
</p>
<% else -%>
<% cache({:diffmode => @diffmode}) do -%>
- <%= render_diff_stats(@diff.stats) -%>
+ <%#= render_diff_stats(@diff.stats) -%>
<h2>Commit diff</h2>
<%= render_diffmode_selector -%>
- <% @diff.each do |file, index| -%>
- <a name="<%= h(file.path) -%>"></a>
- <h4><%= h(file.path) -%><%#=link_to h(file.path), blob_path(file.sha, file.path) -%></h4>
- <%= render_diff(file.patch, file.src, file.dst, @diffmode) -%>
+ <% @diff.each do |file| -%>
+ <a name="<%= h(file.a_path) -%>"></a>
+ <h4><%=h(file.a_path) -%></h4>
+ <%= render_diff(file.diff, @diffmode) -%>
<% end -%>
<% end -%>
<% end -%> |
| |   |
| 1 | 1 | atom_feed do |feed| |
| 2 | 2 | feed.title("Gitorious: #{@project.title} - #{@repository.name}") |
| 3 | | feed.updated((@commits.blank? ? nil : @commits.first.date)) |
| 3 | feed.updated((@commits.blank? ? nil : @commits.first.committed_date)) |
| 4 | 4 | |
| 5 | 5 | @commits.each do |commit| |
| 6 | | item_url = "http://gitorious.org" + project_repository_commit_path(@project, @repository, commit.sha) |
| 7 | | feed.entry(commit.sha, { |
| 6 | item_url = "http://gitorious.org" + project_repository_commit_path(@project, @repository, commit.id) |
| 7 | feed.entry(commit.id, { |
| 8 | 8 | :url => item_url, |
| 9 | | :updated => commit.date, |
| 10 | | :published => commit.date, |
| 11 | | :id => "#{@repository.name}:#{commit.sha}" |
| 9 | :updated => commit.committed_date, |
| 10 | :published => commit.committed_date, |
| 11 | :id => "#{@repository.name}:#{commit.id}" |
| 12 | 12 | }) do |entry| |
| 13 | 13 | entry.title(truncate(commit.message, 75)) |
| 14 | 14 | entry.content(<<-EOS, :type => 'html') |
| 15 | 15 | <h1>In #{@repository.gitdir}</h1> |
| 16 | 16 | <pre> |
| 17 | | Date: #{commit.date.strftime("%Y-%m-%d %H:%M")} |
| 17 | Date: #{commit.committed_date.strftime("%Y-%m-%d %H:%M")} |
| 18 | 18 | Committer: #{commit.committer.name} (#{commit.committer.email}) |
| 19 | 19 | Message: |
| 20 | 20 | #{commit.message} |
| toggle raw diff |
--- a/app/views/browse/index.atom.builder
+++ b/app/views/browse/index.atom.builder
@@ -1,20 +1,20 @@
atom_feed do |feed|
feed.title("Gitorious: #{@project.title} - #{@repository.name}")
- feed.updated((@commits.blank? ? nil : @commits.first.date))
+ feed.updated((@commits.blank? ? nil : @commits.first.committed_date))
@commits.each do |commit|
- item_url = "http://gitorious.org" + project_repository_commit_path(@project, @repository, commit.sha)
- feed.entry(commit.sha, {
+ item_url = "http://gitorious.org" + project_repository_commit_path(@project, @repository, commit.id)
+ feed.entry(commit.id, {
:url => item_url,
- :updated => commit.date,
- :published => commit.date,
- :id => "#{@repository.name}:#{commit.sha}"
+ :updated => commit.committed_date,
+ :published => commit.committed_date,
+ :id => "#{@repository.name}:#{commit.id}"
}) do |entry|
entry.title(truncate(commit.message, 75))
entry.content(<<-EOS, :type => 'html')
<h1>In #{@repository.gitdir}</h1>
<pre>
-Date: #{commit.date.strftime("%Y-%m-%d %H:%M")}
+Date: #{commit.committed_date.strftime("%Y-%m-%d %H:%M")}
Committer: #{commit.committer.name} (#{commit.committer.email})
Message:
#{commit.message} |
| |   |
| 6 | 6 | <ul class="infobox"> |
| 7 | 7 | <li><strong>Project:</strong> <%= link_to h(@repository.project.title), @repository.project -%></li> |
| 8 | 8 | <li><strong>Owner:</strong> <%= link_to h(@repository.user.login), @repository.user -%></li> |
| 9 | | <li><strong>HEAD tree:</strong> <%= link_to h(@commits.first.gtree.sha), |
| 10 | | tree_path(@commits.first.gtree.sha) -%></li> |
| 9 | <li><strong>HEAD tree:</strong> <%= link_to h(@commits.first.tree.id), |
| 10 | tree_path(@commits.id) -%></li> |
| 11 | 11 | </ul> |
| 12 | 12 | |
| 13 | 13 | <h2>Commits</h2> |
| 14 | 14 | <%= render :partial => "log", :locals => {:commits => @commits} -%> |
| 15 | 15 | |
| 16 | 16 | <% content_for :sidebar do -%> |
| 17 | | <h5>Branches:</h5> |
| 18 | | <ul class="links"> |
| 19 | | <% @git.branches.each do |branch| -%> |
| 20 | | <li><%= link_to h(branch.name), commit_path(branch.gcommit.sha) -%></li> |
| 21 | | <% end -%> |
| 22 | | </ul> |
| 23 | | |
| 24 | | <h5>Tags:</h5> |
| 25 | | <ul class="links"> |
| 26 | | <% @git.tags.each do |tag| -%> |
| 27 | | <li><%= link_to h(tag.name), commit_path(tag.sha) -%></li> |
| 28 | | <% end -%> |
| 29 | | </ul> |
| 17 | <%= render :partial => "tags_and_branches" -%> |
| 30 | 18 | <% end -%> |
| toggle raw diff |
--- a/app/views/browse/index.html.erb
+++ b/app/views/browse/index.html.erb
@@ -6,25 +6,13 @@
<ul class="infobox">
<li><strong>Project:</strong> <%= link_to h(@repository.project.title), @repository.project -%></li>
<li><strong>Owner:</strong> <%= link_to h(@repository.user.login), @repository.user -%></li>
- <li><strong>HEAD tree:</strong> <%= link_to h(@commits.first.gtree.sha),
- tree_path(@commits.first.gtree.sha) -%></li>
+ <li><strong>HEAD tree:</strong> <%= link_to h(@commits.first.tree.id),
+ tree_path(@commits.id) -%></li>
</ul>
<h2>Commits</h2>
<%= render :partial => "log", :locals => {:commits => @commits} -%>
<% content_for :sidebar do -%>
- <h5>Branches:</h5>
- <ul class="links">
- <% @git.branches.each do |branch| -%>
- <li><%= link_to h(branch.name), commit_path(branch.gcommit.sha) -%></li>
- <% end -%>
- </ul>
-
- <h5>Tags:</h5>
- <ul class="links">
- <% @git.tags.each do |tag| -%>
- <li><%= link_to h(tag.name), commit_path(tag.sha) -%></li>
- <% end -%>
- </ul>
+ <%= render :partial => "tags_and_branches" -%>
<% end -%>
\ No newline at end of file |
| |   |
| 1 | 1 | <% @page_title = "Tree for #{@repository.name} in #{@project.title}" -%> |
| 2 | 2 | <h1> |
| 3 | | Browsing tree of <%= h(@repository.name) -%> repository in <%= h(@project.title) -%> |
| 3 | Tree of <%= h(@repository.name) -%> repository in <%= h(@project.title) -%> |
| 4 | 4 | </h1> |
| 5 | 5 | |
| 6 | <%= breadcrumb_path(@repository.name, @commit.id) -%> |
| 7 | |
| 6 | 8 | <table class="listing tree"> |
| 7 | | <% @tree.children.sort_by{|f,n| f.downcase }.each do |file, node| -%> |
| 9 | <% @tree.contents.sort_by{|c| c.name.downcase}.each do |node| -%> |
| 8 | 10 | <tr class="<%= cycle("odd", "even") -%>"> |
| 9 | 11 | <!-- <td><%#= h(node.mode) -%></td> --> |
| 10 | | <% if node.type == "tree" -%> |
| 11 | | <td class="node tree"><%= link_to h(file + "/"), tree_path(node.sha, build_tree_path(file)) -%></td> |
| 12 | | <td class="link"><%= link_to node.type, tree_path(node.sha, build_tree_path(file)) -%></td> |
| 13 | | <!-- TODO: archive --> |
| 12 | <% if node.is_a? Grit::Tree -%> |
| 13 | <td class="node tree"><%= link_to h(node.basename) + "/", tree_path(@commit.id, node.name) -%></td> |
| 14 | 14 | <% else -%> |
| 15 | | <td class="node file"><%= link_to h(file), blob_path(node.sha, build_tree_path(file)) -%></td> |
| 16 | | <td class="link"><%= link_to node.type, blob_path(node.sha, build_tree_path(file)) -%></td> |
| 15 | <td class="node file"><%= link_to h(node.basename), blob_path(@commit.id, node.name) -%></td> |
| 17 | 16 | <% end -%> |
| 18 | | <td class="sha1"><%= h(node.sha[0..16]) -%></td> |
| 17 | <td></td> |
| 19 | 18 | </tr> |
| 20 | 19 | <% end -%> |
| 21 | 20 | </table> |
| 21 | |
| 22 | <% content_for :sidebar do -%> |
| 23 | <%= render :partial => "tags_and_branches" -%> |
| 24 | <% end -%> |
| toggle raw diff |
--- a/app/views/browse/tree.html.erb
+++ b/app/views/browse/tree.html.erb
@@ -1,21 +1,24 @@
<% @page_title = "Tree for #{@repository.name} in #{@project.title}" -%>
<h1>
- Browsing tree of <%= h(@repository.name) -%> repository in <%= h(@project.title) -%>
+ Tree of <%= h(@repository.name) -%> repository in <%= h(@project.title) -%>
</h1>
+<%= breadcrumb_path(@repository.name, @commit.id) -%>
+
<table class="listing tree">
- <% @tree.children.sort_by{|f,n| f.downcase }.each do |file, node| -%>
+ <% @tree.contents.sort_by{|c| c.name.downcase}.each do |node| -%>
<tr class="<%= cycle("odd", "even") -%>">
<!-- <td><%#= h(node.mode) -%></td> -->
- <% if node.type == "tree" -%>
- <td class="node tree"><%= link_to h(file + "/"), tree_path(node.sha, build_tree_path(file)) -%></td>
- <td class="link"><%= link_to node.type, tree_path(node.sha, build_tree_path(file)) -%></td>
- <!-- TODO: archive -->
+ <% if node.is_a? Grit::Tree -%>
+ <td class="node tree"><%= link_to h(node.basename) + "/", tree_path(@commit.id, node.name) -%></td>
<% else -%>
- <td class="node file"><%= link_to h(file), blob_path(node.sha, build_tree_path(file)) -%></td>
- <td class="link"><%= link_to node.type, blob_path(node.sha, build_tree_path(file)) -%></td>
+ <td class="node file"><%= link_to h(node.basename), blob_path(@commit.id, node.name) -%></td>
<% end -%>
- <td class="sha1"><%= h(node.sha[0..16]) -%></td>
+ <td></td>
</tr>
<% end -%>
</table>
+
+<% content_for :sidebar do -%>
+ <%= render :partial => "tags_and_branches" -%>
+<% end -%>
\ No newline at end of file |
| |   |
| 5 | 5 | <%= link_to(h(comment.user.login), comment.user) -%> | |
| 6 | 6 | <%= comment.created_at.to_s(:short) -%> |
| 7 | 7 | <% unless comment.sha1.blank? -%> |
| 8 | | | <%= link_to "on commit #{comment.sha1[0..8]}", project_repository_commit_path(@project, @repository, comment.sha1) -%> |
| 8 | | <%= link_to "on commit #{comment.sha1[0..7]}", project_repository_commit_path(@project, @repository, comment.sha1) -%> |
| 9 | 9 | <% end -%> |
| 10 | 10 | | <a href="#<%= dom_id(comment) -%>"><abbr title="permalink for this comment">#</abbr></a> |
| 11 | 11 | </p> |
| toggle raw diff |
--- a/app/views/comments/_comment.html.erb
+++ b/app/views/comments/_comment.html.erb
@@ -5,7 +5,7 @@
<%= link_to(h(comment.user.login), comment.user) -%> |
<%= comment.created_at.to_s(:short) -%>
<% unless comment.sha1.blank? -%>
- | <%= link_to "on commit #{comment.sha1[0..8]}", project_repository_commit_path(@project, @repository, comment.sha1) -%>
+ | <%= link_to "on commit #{comment.sha1[0..7]}", project_repository_commit_path(@project, @repository, comment.sha1) -%>
<% end -%>
| <a href="#<%= dom_id(comment) -%>"><abbr title="permalink for this comment">#</abbr></a>
</p> |
| |   |
| 1 | 1 | <% @page_title = "Comments in #{@repository.name}" -%> |
| 2 | | <h1>Comments on commit <%= h(@commit.sha) -%> in <%= h(@repository.name) -%></h1> |
| 2 | <h1>Comments on commit <%= h(@commit.id[0,7]) -%> in <%= h(@repository.name) -%></h1> |
| 3 | 3 | |
| 4 | 4 | <p><pre><%=h @commit.message -%></pre></p> |
| 5 | 5 | |
| … | … | |
| 7 | 7 | |
| 8 | 8 | <ul class="tab_menu"> |
| 9 | 9 | <li><%= link_to "Commit diff", |
| 10 | | project_repository_commit_path(@project, @repository, @commit.sha) -%></li> |
| 10 | project_repository_commit_path(@project, @repository, @commit.id) -%></li> |
| 11 | 11 | <li class="selected">Comments (<%= @comments.size -%>)</li> |
| 12 | 12 | </ul> |
| 13 | 13 | |
| 14 | 14 | <%= render :partial => @comments -%> |
| 15 | 15 | |
| 16 | | <%= render :partial => "form", :locals => {:sha1 => @commit.sha} -%> |
| 16 | <%= render :partial => "form", :locals => {:sha1 => @commit.id} -%> |
| toggle raw diff |
--- a/app/views/comments/commit.html.erb
+++ b/app/views/comments/commit.html.erb
@@ -1,5 +1,5 @@
<% @page_title = "Comments in #{@repository.name}" -%>
-<h1>Comments on commit <%= h(@commit.sha) -%> in <%= h(@repository.name) -%></h1>
+<h1>Comments on commit <%= h(@commit.id[0,7]) -%> in <%= h(@repository.name) -%></h1>
<p><pre><%=h @commit.message -%></pre></p>
@@ -7,10 +7,10 @@
<ul class="tab_menu">
<li><%= link_to "Commit diff",
- project_repository_commit_path(@project, @repository, @commit.sha) -%></li>
+ project_repository_commit_path(@project, @repository, @commit.id) -%></li>
<li class="selected">Comments (<%= @comments.size -%>)</li>
</ul>
<%= render :partial => @comments -%>
-<%= render :partial => "form", :locals => {:sha1 => @commit.sha} -%>
+<%= render :partial => "form", :locals => {:sha1 => @commit.id} -%> |