gitlabhq/doc/app/Commit.html

1192 lines
46 KiB
HTML
Raw Normal View History

2012-10-25 10:59:41 +02:00
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>class Commit - Rails Application Documentation</title>
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
<script type="text/javascript">
var rdoc_rel_prefix = "./";
</script>
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
<body id="top" class="class">
<nav id="metadata">
<nav id="home-section" class="section">
<h3 class="section-header">
<a href="./index.html">Home</a>
<a href="./table_of_contents.html#classes">Classes</a>
<a href="./table_of_contents.html#methods">Methods</a>
</h3>
</nav>
<nav id="search-section" class="section project-section" class="initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
<h3 class="section-header">
<input type="text" name="search" placeholder="Search" id="search-field"
title="Type to search, Up and Down to navigate, Enter to load">
</h3>
</form>
<ul id="search-results" class="initially-hidden"></ul>
</nav>
<div id="file-metadata">
<nav id="file-list-section" class="section">
<h3 class="section-header">Defined In</h3>
<ul>
<li>app/models/commit.rb
</ul>
</nav>
</div>
<div id="class-metadata">
<nav id="parent-class-section" class="section">
<h3 class="section-header">Parent</h3>
<p class="link">Object
</nav>
<!-- Included Modules -->
<nav id="includes-section" class="section">
<h3 class="section-header">Included Modules</h3>
<ul class="link-list">
<li><span class="include">ActiveModel::Conversion</span>
<li><a class="include" href="Gitlab/Encode.html">Gitlab::Encode</a>
<li><a class="include" href="StaticModel.html">StaticModel</a>
</ul>
</nav>
<!-- Method Quickref -->
<nav id="method-list-section" class="section">
<h3 class="section-header">Methods</h3>
<ul class="link-list">
<li><a href="#method-c-commits">::commits</a>
<li><a href="#method-c-commits_between">::commits_between</a>
<li><a href="#method-c-commits_since">::commits_since</a>
<li><a href="#method-c-commits_with_refs">::commits_with_refs</a>
<li><a href="#method-c-compare">::compare</a>
<li><a href="#method-c-find_or_first">::find_or_first</a>
<li><a href="#method-c-fresh_commits">::fresh_commits</a>
<li><a href="#method-c-new">::new</a>
<li><a href="#method-i-author_email">#author_email</a>
<li><a href="#method-i-author_name">#author_name</a>
<li><a href="#method-i-committer_email">#committer_email</a>
<li><a href="#method-i-committer_name">#committer_name</a>
<li><a href="#method-i-created_at">#created_at</a>
<li><a href="#method-i-different_committer-3F">#different_committer?</a>
<li><a href="#method-i-parents_count">#parents_count</a>
<li><a href="#method-i-prev_commit">#prev_commit</a>
<li><a href="#method-i-prev_commit_id">#prev_commit_id</a>
<li><a href="#method-i-safe_message">#safe_message</a>
<li><a href="#method-i-short_id">#short_id</a>
</ul>
</nav>
</div>
<div id="project-metadata">
<nav id="fileindex-section" class="section project-section">
<h3 class="section-header">Pages</h3>
<ul>
<li class="file"><a href="./doc/README_FOR_APP.html">README_FOR_APP</a>
</ul>
</nav>
<nav id="classindex-section" class="section project-section">
<h3 class="section-header">Class and Module Index</h3>
<ul class="link-list">
<li><a href="./Gitlab.html">Gitlab</a>
<li><a href="./Gitlab/API.html">Gitlab::API</a>
<li><a href="./Gitlab/APIHelpers.html">Gitlab::APIHelpers</a>
<li><a href="./Gitlab/AppLogger.html">Gitlab::AppLogger</a>
<li><a href="./Gitlab/Auth.html">Gitlab::Auth</a>
<li><a href="./Gitlab/Encode.html">Gitlab::Encode</a>
<li><a href="./Gitlab/Entities.html">Gitlab::Entities</a>
<li><a href="./Gitlab/Entities/Hook.html">Gitlab::Entities::Hook</a>
<li><a href="./Gitlab/Entities/Issue.html">Gitlab::Entities::Issue</a>
<li><a href="./Gitlab/Entities/Milestone.html">Gitlab::Entities::Milestone</a>
<li><a href="./Gitlab/Entities/Project.html">Gitlab::Entities::Project</a>
<li><a href="./Gitlab/Entities/ProjectMember.html">Gitlab::Entities::ProjectMember</a>
<li><a href="./Gitlab/Entities/ProjectSnippet.html">Gitlab::Entities::ProjectSnippet</a>
<li><a href="./Gitlab/Entities/RepoCommit.html">Gitlab::Entities::RepoCommit</a>
<li><a href="./Gitlab/Entities/RepoObject.html">Gitlab::Entities::RepoObject</a>
<li><a href="./Gitlab/Entities/SSHKey.html">Gitlab::Entities::SSHKey</a>
<li><a href="./Gitlab/Entities/User.html">Gitlab::Entities::User</a>
<li><a href="./Gitlab/Entities/UserBasic.html">Gitlab::Entities::UserBasic</a>
<li><a href="./Gitlab/Entities/UserLogin.html">Gitlab::Entities::UserLogin</a>
<li><a href="./Gitlab/FileEditor.html">Gitlab::FileEditor</a>
<li><a href="./Gitlab/GitLogger.html">Gitlab::GitLogger</a>
<li><a href="./Gitlab/Gitolite.html">Gitlab::Gitolite</a>
<li><a href="./Gitlab/Gitolite/AccessDenied.html">Gitlab::Gitolite::AccessDenied</a>
<li><a href="./Gitlab/GitoliteConfig.html">Gitlab::GitoliteConfig</a>
<li><a href="./Gitlab/GitoliteConfig/PullError.html">Gitlab::GitoliteConfig::PullError</a>
<li><a href="./Gitlab/GitoliteConfig/PushError.html">Gitlab::GitoliteConfig::PushError</a>
<li><a href="./Gitlab/GraphCommit.html">Gitlab::GraphCommit</a>
<li><a href="./Gitlab/InlineDiff.html">Gitlab::InlineDiff</a>
<li><a href="./Gitlab/Issues.html">Gitlab::Issues</a>
<li><a href="./Gitlab/Logger.html">Gitlab::Logger</a>
<li><a href="./Gitlab/Markdown.html">Gitlab::Markdown</a>
<li><a href="./Gitlab/Merge.html">Gitlab::Merge</a>
<li><a href="./Gitlab/Milestones.html">Gitlab::Milestones</a>
<li><a href="./Gitlab/Projects.html">Gitlab::Projects</a>
<li><a href="./Gitlab/Satellite.html">Gitlab::Satellite</a>
<li><a href="./Gitlab/Session.html">Gitlab::Session</a>
<li><a href="./Gitlab/Theme.html">Gitlab::Theme</a>
<li><a href="./Gitlab/Users.html">Gitlab::Users</a>
<li><a href="./Admin.html">Admin</a>
<li><a href="./Admin/DashboardController.html">Admin::DashboardController</a>
<li><a href="./Admin/GroupsController.html">Admin::GroupsController</a>
<li><a href="./Admin/HooksController.html">Admin::HooksController</a>
<li><a href="./Admin/LogsController.html">Admin::LogsController</a>
<li><a href="./Admin/ProjectsController.html">Admin::ProjectsController</a>
<li><a href="./Admin/ResqueController.html">Admin::ResqueController</a>
<li><a href="./Admin/TeamMembersController.html">Admin::TeamMembersController</a>
<li><a href="./Admin/UsersController.html">Admin::UsersController</a>
<li><a href="./Notes.html">Notes</a>
<li><a href="./Notes/CreateContext.html">Notes::CreateContext</a>
<li><a href="./Notes/LoadContext.html">Notes::LoadContext</a>
<li><a href="./Redcarpet.html">Redcarpet</a>
<li><a href="./Redcarpet/Render.html">Redcarpet::Render</a>
<li><a href="./Redcarpet/Render/GitlabHTML.html">Redcarpet::Render::GitlabHTML</a>
<li><a href="./ExtractsPath.html">ExtractsPath</a>
<li><a href="./ExtractsPath/InvalidPathError.html">ExtractsPath::InvalidPathError</a>
<li><a href="./FileSizeValidator.html">FileSizeValidator</a>
<li><a href="./FileSizeValidator/Helper.html">FileSizeValidator::Helper</a>
<li><a href="./Grack.html">Grack</a>
<li><a href="./Grack/Auth.html">Grack::Auth</a>
<li><a href="./IssueCommonality.html">IssueCommonality</a>
<li><a href="./IssueCommonality/ClassMethods.html">IssueCommonality::ClassMethods</a>
<li><a href="./StaticModel.html">StaticModel</a>
<li><a href="./StaticModel/ClassMethods.html">StaticModel::ClassMethods</a>
<li><a href="./Ability.html">Ability</a>
<li><a href="./Account.html">Account</a>
<li><a href="./ActivityObserver.html">ActivityObserver</a>
<li><a href="./AdminController.html">AdminController</a>
<li><a href="./ApplicationController.html">ApplicationController</a>
<li><a href="./ApplicationDecorator.html">ApplicationDecorator</a>
<li><a href="./ApplicationHelper.html">ApplicationHelper</a>
<li><a href="./AttachmentUploader.html">AttachmentUploader</a>
<li><a href="./Authority.html">Authority</a>
<li><a href="./BaseContext.html">BaseContext</a>
<li><a href="./BlameController.html">BlameController</a>
<li><a href="./BlobController.html">BlobController</a>
<li><a href="./Commit.html">Commit</a>
<li><a href="./CommitController.html">CommitController</a>
<li><a href="./CommitDecorator.html">CommitDecorator</a>
<li><a href="./CommitLoadContext.html">CommitLoadContext</a>
<li><a href="./CommitsController.html">CommitsController</a>
<li><a href="./CommitsHelper.html">CommitsHelper</a>
<li><a href="./CompareController.html">CompareController</a>
<li><a href="./DashboardController.html">DashboardController</a>
<li><a href="./DeployKeysController.html">DeployKeysController</a>
<li><a href="./ErrorsController.html">ErrorsController</a>
<li><a href="./Event.html">Event</a>
<li><a href="./EventDecorator.html">EventDecorator</a>
<li><a href="./EventsHelper.html">EventsHelper</a>
<li><a href="./GitHost.html">GitHost</a>
<li><a href="./GitlabMarkdownHelper.html">GitlabMarkdownHelper</a>
<li><a href="./Group.html">Group</a>
<li><a href="./GroupsController.html">GroupsController</a>
<li><a href="./HelpController.html">HelpController</a>
<li><a href="./HooksController.html">HooksController</a>
<li><a href="./Issue.html">Issue</a>
<li><a href="./IssueObserver.html">IssueObserver</a>
<li><a href="./IssuesBulkUpdateContext.html">IssuesBulkUpdateContext</a>
<li><a href="./IssuesController.html">IssuesController</a>
<li><a href="./IssuesHelper.html">IssuesHelper</a>
<li><a href="./IssuesListContext.html">IssuesListContext</a>
<li><a href="./Key.html">Key</a>
<li><a href="./KeyObserver.html">KeyObserver</a>
<li><a href="./KeysController.html">KeysController</a>
<li><a href="./LabelsController.html">LabelsController</a>
<li><a href="./MergeRequest.html">MergeRequest</a>
<li><a href="./MergeRequestObserver.html">MergeRequestObserver</a>
<li><a href="./MergeRequestsController.html">MergeRequestsController</a>
<li><a href="./MergeRequestsHelper.html">MergeRequestsHelper</a>
<li><a href="./MergeRequestsLoadContext.html">MergeRequestsLoadContext</a>
<li><a href="./Milestone.html">Milestone</a>
<li><a href="./MilestonesController.html">MilestonesController</a>
<li><a href="./Note.html">Note</a>
<li><a href="./NoteObserver.html">NoteObserver</a>
<li><a href="./NotesController.html">NotesController</a>
<li><a href="./NotesHelper.html">NotesHelper</a>
<li><a href="./Notify.html">Notify</a>
<li><a href="./OmniauthCallbacksController.html">OmniauthCallbacksController</a>
<li><a href="./PostReceive.html">PostReceive</a>
<li><a href="./ProfileController.html">ProfileController</a>
<li><a href="./ProfileHelper.html">ProfileHelper</a>
<li><a href="./Project.html">Project</a>
<li><a href="./ProjectHook.html">ProjectHook</a>
<li><a href="./ProjectObserver.html">ProjectObserver</a>
<li><a href="./ProjectResourceController.html">ProjectResourceController</a>
<li><a href="./ProjectsController.html">ProjectsController</a>
<li><a href="./ProjectsHelper.html">ProjectsHelper</a>
<li><a href="./ProtectedBranch.html">ProtectedBranch</a>
<li><a href="./ProtectedBranchesController.html">ProtectedBranchesController</a>
<li><a href="./PushEvent.html">PushEvent</a>
<li><a href="./PushObserver.html">PushObserver</a>
<li><a href="./RefsController.html">RefsController</a>
<li><a href="./RepositoriesController.html">RepositoriesController</a>
<li><a href="./Repository.html">Repository</a>
<li><a href="./SearchContext.html">SearchContext</a>
<li><a href="./SearchController.html">SearchController</a>
<li><a href="./Snippet.html">Snippet</a>
<li><a href="./SnippetsController.html">SnippetsController</a>
<li><a href="./SnippetsHelper.html">SnippetsHelper</a>
<li><a href="./SystemHook.html">SystemHook</a>
<li><a href="./SystemHookObserver.html">SystemHookObserver</a>
<li><a href="./SystemHookWorker.html">SystemHookWorker</a>
<li><a href="./TabHelper.html">TabHelper</a>
<li><a href="./TagsHelper.html">TagsHelper</a>
<li><a href="./Team.html">Team</a>
<li><a href="./TeamMembersController.html">TeamMembersController</a>
<li><a href="./TestHookContext.html">TestHookContext</a>
<li><a href="./Tree.html">Tree</a>
<li><a href="./TreeController.html">TreeController</a>
<li><a href="./TreeDecorator.html">TreeDecorator</a>
<li><a href="./TreeHelper.html">TreeHelper</a>
<li><a href="./User.html">User</a>
<li><a href="./UserObserver.html">UserObserver</a>
<li><a href="./UsersProject.html">UsersProject</a>
<li><a href="./UsersProjectObserver.html">UsersProjectObserver</a>
<li><a href="./Votes.html">Votes</a>
<li><a href="./WebHook.html">WebHook</a>
<li><a href="./Wiki.html">Wiki</a>
<li><a href="./WikisController.html">WikisController</a>
</ul>
</nav>
</div>
</nav>
<div id="documentation">
<h1 class="class">class Commit</h1>
<div id="description" class="description">
</div><!-- description -->
<section id="5Buntitled-5D" class="documentation-section">
<!-- Attributes -->
<section id="attribute-method-details" class="method-section section">
<h3 class="section-header">Attributes</h3>
<div id="attribute-i-commit" class="method-detail">
<div class="method-heading attribute-method-heading">
<span class="method-name">commit</span><span
class="attribute-access-type">[RW]</span>
</div>
<div class="method-description">
</div>
</div>
<div id="attribute-i-head" class="method-detail">
<div class="method-heading attribute-method-heading">
<span class="method-name">head</span><span
class="attribute-access-type">[RW]</span>
</div>
<div class="method-description">
</div>
</div>
<div id="attribute-i-refs" class="method-detail">
<div class="method-heading attribute-method-heading">
<span class="method-name">refs</span><span
class="attribute-access-type">[RW]</span>
</div>
<div class="method-description">
</div>
</div>
</section><!-- attribute-method-details -->
<!-- Methods -->
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
<h3 class="section-header">Public Class Methods</h3>
<div id="method-c-commits" class="method-detail ">
<div class="method-heading">
<span class="method-name">commits</span><span
class="method-args">(repo, ref, path = nil, limit = nil, offset = nil)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="commits-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 58</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">commits</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">ref</span>, <span class="ruby-identifier">path</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">limit</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">offset</span> = <span class="ruby-keyword">nil</span>)
<span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">log</span>(<span class="ruby-identifier">ref</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">max_count</span><span class="ruby-operator">:</span> <span class="ruby-identifier">limit</span>, <span class="ruby-identifier">skip</span><span class="ruby-operator">:</span> <span class="ruby-identifier">offset</span>)
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">limit</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">offset</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">commits</span>(<span class="ruby-identifier">ref</span>, <span class="ruby-identifier">limit</span>, <span class="ruby-identifier">offset</span>)
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">commits</span>(<span class="ruby-identifier">ref</span>)
<span class="ruby-keyword">end</span>.<span class="ruby-identifier">map</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-constant">Commit</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">c</span>) }
<span class="ruby-keyword">end</span></pre>
</div><!-- commits-source -->
</div>
</div><!-- commits-method -->
<div id="method-c-commits_between" class="method-detail ">
<div class="method-heading">
<span class="method-name">commits_between</span><span
class="method-args">(repo, from, to)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="commits_between-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 68</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">commits_between</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">commits_between</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-constant">Commit</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">c</span>) }
<span class="ruby-keyword">end</span></pre>
</div><!-- commits_between-source -->
</div>
</div><!-- commits_between-method -->
<div id="method-c-commits_since" class="method-detail ">
<div class="method-heading">
<span class="method-name">commits_since</span><span
class="method-args">(repo, date)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="commits_since-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 46</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">commits_since</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">date</span>)
<span class="ruby-identifier">commits</span> = <span class="ruby-identifier">repo</span>.<span class="ruby-identifier">heads</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">log</span>(<span class="ruby-identifier">h</span>.<span class="ruby-identifier">name</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">since</span><span class="ruby-operator">:</span> <span class="ruby-identifier">date</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-constant">Commit</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">c</span>, <span class="ruby-identifier">h</span>) }
<span class="ruby-keyword">end</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">uniq</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">id</span> }
<span class="ruby-identifier">commits</span>.<span class="ruby-identifier">sort!</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">y</span>.<span class="ruby-identifier">committed_date</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">committed_date</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">commits</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- commits_since-source -->
</div>
</div><!-- commits_since-method -->
<div id="method-c-commits_with_refs" class="method-detail ">
<div class="method-heading">
<span class="method-name">commits_with_refs</span><span
class="method-args">(repo, n = 20)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="commits_with_refs-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 36</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">commits_with_refs</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">n</span> = <span class="ruby-value">20</span>)
<span class="ruby-identifier">commits</span> = <span class="ruby-identifier">repo</span>.<span class="ruby-identifier">branches</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">ref</span><span class="ruby-operator">|</span> <span class="ruby-constant">Commit</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">commit</span>, <span class="ruby-identifier">ref</span>) }
<span class="ruby-identifier">commits</span>.<span class="ruby-identifier">sort!</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">y</span>.<span class="ruby-identifier">committed_date</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">committed_date</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">commits</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">n</span>]
<span class="ruby-keyword">end</span></pre>
</div><!-- commits_with_refs-source -->
</div>
</div><!-- commits_with_refs-method -->
<div id="method-c-compare" class="method-detail ">
<div class="method-heading">
<span class="method-name">compare</span><span
class="method-args">(project, from, to)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="compare-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 72</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">compare</span>(<span class="ruby-identifier">project</span>, <span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
<span class="ruby-identifier">result</span> = {
<span class="ruby-identifier">commits</span><span class="ruby-operator">:</span> [],
<span class="ruby-identifier">diffs</span><span class="ruby-operator">:</span> [],
<span class="ruby-identifier">commit</span><span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>,
<span class="ruby-identifier">same</span><span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>
}
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">from</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">to</span>
<span class="ruby-identifier">first</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">commit</span>(<span class="ruby-identifier">to</span>.<span class="ruby-identifier">try</span>(<span class="ruby-value">:strip</span>))
<span class="ruby-identifier">last</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">commit</span>(<span class="ruby-identifier">from</span>.<span class="ruby-identifier">try</span>(<span class="ruby-value">:strip</span>))
<span class="ruby-keyword">if</span> <span class="ruby-identifier">first</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">last</span>
<span class="ruby-identifier">commits</span> = [<span class="ruby-identifier">first</span>, <span class="ruby-identifier">last</span>].<span class="ruby-identifier">sort_by</span>(&amp;<span class="ruby-value">:created_at</span>)
<span class="ruby-identifier">younger</span> = <span class="ruby-identifier">commits</span>.<span class="ruby-identifier">first</span>
<span class="ruby-identifier">older</span> = <span class="ruby-identifier">commits</span>.<span class="ruby-identifier">last</span>
<span class="ruby-identifier">result</span>[<span class="ruby-value">:same</span>] = (<span class="ruby-identifier">younger</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">older</span>.<span class="ruby-identifier">id</span>)
<span class="ruby-identifier">result</span>[<span class="ruby-value">:commits</span>] = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">commits_between</span>(<span class="ruby-identifier">younger</span>.<span class="ruby-identifier">id</span>, <span class="ruby-identifier">older</span>.<span class="ruby-identifier">id</span>).<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-constant">Commit</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">c</span>)}
<span class="ruby-identifier">result</span>[<span class="ruby-value">:diffs</span>] = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">diff</span>(<span class="ruby-identifier">younger</span>.<span class="ruby-identifier">id</span>, <span class="ruby-identifier">older</span>.<span class="ruby-identifier">id</span>) <span class="ruby-keyword">rescue</span> []
<span class="ruby-identifier">result</span>[<span class="ruby-value">:commit</span>] = <span class="ruby-constant">Commit</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">older</span>)
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">result</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- compare-source -->
</div>
</div><!-- compare-method -->
<div id="method-c-find_or_first" class="method-detail ">
<div class="method-heading">
<span class="method-name">find_or_first</span><span
class="method-args">(repo, commit_id = nil, root_ref)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="find_or_first-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 14</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find_or_first</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">commit_id</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">root_ref</span>)
<span class="ruby-identifier">commit</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">commit_id</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">commit</span>(<span class="ruby-identifier">commit_id</span>)
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">commits</span>(<span class="ruby-identifier">root_ref</span>).<span class="ruby-identifier">first</span>
<span class="ruby-keyword">end</span>
<span class="ruby-constant">Commit</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">commit</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">commit</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- find_or_first-source -->
</div>
</div><!-- find_or_first-method -->
<div id="method-c-fresh_commits" class="method-detail ">
<div class="method-heading">
<span class="method-name">fresh_commits</span><span
class="method-args">(repo, n = 10)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="fresh_commits-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 24</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">fresh_commits</span>(<span class="ruby-identifier">repo</span>, <span class="ruby-identifier">n</span> = <span class="ruby-value">10</span>)
<span class="ruby-identifier">commits</span> = <span class="ruby-identifier">repo</span>.<span class="ruby-identifier">heads</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">repo</span>.<span class="ruby-identifier">commits</span>(<span class="ruby-identifier">h</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">n</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-constant">Commit</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">c</span>, <span class="ruby-identifier">h</span>) }
<span class="ruby-keyword">end</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">uniq</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">id</span> }
<span class="ruby-identifier">commits</span>.<span class="ruby-identifier">sort!</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">y</span>.<span class="ruby-identifier">committed_date</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">committed_date</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">commits</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">n</span>]
<span class="ruby-keyword">end</span></pre>
</div><!-- fresh_commits-source -->
</div>
</div><!-- fresh_commits-method -->
<div id="method-c-new" class="method-detail ">
<div class="method-heading">
<span class="method-name">new</span><span
class="method-args">(raw_commit, head = nil)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="new-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 100</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">raw_commit</span>, <span class="ruby-identifier">head</span> = <span class="ruby-keyword">nil</span>)
<span class="ruby-ivar">@commit</span> = <span class="ruby-identifier">raw_commit</span>
<span class="ruby-ivar">@head</span> = <span class="ruby-identifier">head</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- new-source -->
</div>
</div><!-- new-method -->
</section><!-- public-class-method-details -->
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
<h3 class="section-header">Public Instance Methods</h3>
<div id="method-i-author_email" class="method-detail ">
<div class="method-heading">
<span class="method-name">author_email</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="author_email-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 117</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">author_email</span>
<span class="ruby-identifier">author</span>.<span class="ruby-identifier">email</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- author_email-source -->
</div>
</div><!-- author_email-method -->
<div id="method-i-author_name" class="method-detail ">
<div class="method-heading">
<span class="method-name">author_name</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="author_name-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 121</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">author_name</span>
<span class="ruby-identifier">utf8</span> <span class="ruby-identifier">author</span>.<span class="ruby-identifier">name</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- author_name-source -->
</div>
</div><!-- author_name-method -->
<div id="method-i-committer_email" class="method-detail ">
<div class="method-heading">
<span class="method-name">committer_email</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="committer_email-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 134</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">committer_email</span>
<span class="ruby-identifier">committer</span>.<span class="ruby-identifier">email</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- committer_email-source -->
</div>
</div><!-- committer_email-method -->
<div id="method-i-committer_name" class="method-detail ">
<div class="method-heading">
<span class="method-name">committer_name</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="committer_name-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 130</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">committer_name</span>
<span class="ruby-identifier">utf8</span> <span class="ruby-identifier">committer</span>.<span class="ruby-identifier">name</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- committer_name-source -->
</div>
</div><!-- committer_name-method -->
<div id="method-i-created_at" class="method-detail ">
<div class="method-heading">
<span class="method-name">created_at</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="created_at-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 113</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">created_at</span>
<span class="ruby-identifier">committed_date</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- created_at-source -->
</div>
</div><!-- created_at-method -->
<div id="method-i-different_committer-3F" class="method-detail ">
<div class="method-heading">
<span class="method-name">different_committer?</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<p>Was this commit committed by a different person than the original author?</p>
<div class="method-source-code" id="different_committer-3F-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 126</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">different_committer?</span>
<span class="ruby-identifier">author_name</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">committer_name</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">author_email</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">committer_email</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- different_committer-3F-source -->
</div>
</div><!-- different_committer-3F-method -->
<div id="method-i-parents_count" class="method-detail ">
<div class="method-heading">
<span class="method-name">parents_count</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="parents_count-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 146</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">parents_count</span>
<span class="ruby-identifier">parents</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- parents_count-source -->
</div>
</div><!-- parents_count-method -->
<div id="method-i-prev_commit" class="method-detail ">
<div class="method-heading">
<span class="method-name">prev_commit</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="prev_commit-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 138</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">prev_commit</span>
<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">try</span> <span class="ruby-value">:first</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- prev_commit-source -->
</div>
</div><!-- prev_commit-method -->
<div id="method-i-prev_commit_id" class="method-detail ">
<div class="method-heading">
<span class="method-name">prev_commit_id</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="prev_commit_id-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 142</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">prev_commit_id</span>
<span class="ruby-identifier">prev_commit</span>.<span class="ruby-identifier">try</span> <span class="ruby-value">:id</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- prev_commit_id-source -->
</div>
</div><!-- prev_commit_id-method -->
<div id="method-i-safe_message" class="method-detail ">
<div class="method-heading">
<span class="method-name">safe_message</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="safe_message-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 109</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">safe_message</span>
<span class="ruby-ivar">@safe_message</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">utf8</span> <span class="ruby-identifier">message</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- safe_message-source -->
</div>
</div><!-- safe_message-method -->
<div id="method-i-short_id" class="method-detail ">
<div class="method-heading">
<span class="method-name">short_id</span><span
class="method-args">(length = 10)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="short_id-source">
<pre><span class="ruby-comment"># File app/models/commit.rb, line 105</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">short_id</span>(<span class="ruby-identifier">length</span> = <span class="ruby-value">10</span>)
<span class="ruby-identifier">id</span>.<span class="ruby-identifier">to_s</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">length</span>]
<span class="ruby-keyword">end</span></pre>
</div><!-- short_id-source -->
</div>
</div><!-- short_id-method -->
</section><!-- public-instance-method-details -->
</section><!-- 5Buntitled-5D -->
</div><!-- documentation -->
<footer id="validator-badges">
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
</footer>