Project

General

Profile

Defect #1435 » git_log_from_db.patch

Jean-Philippe Lang, 2008-11-20 20:00

View differences:

app/models/repository/git.rb (working copy)
28 28
  def self.scm_name
29 29
    'Git'
30 30
  end
31
  
32
  def entries(path=nil, identifier=nil)
33
    entries=scm.entries(path, identifier)
34
    if entries
35
      entries.each do |entry|
36
        # Search the DB for the entry's last change
37
        change = changes.find(:first, :conditions => ["path = ? OR path LIKE ?", entry.path, "#{entry.path}/%"], :order => "#{Changeset.table_name}.committed_on DESC")
38
        if change
39
          entry.lastrev.identifier = change.changeset.revision
40
          entry.lastrev.name = change.changeset.revision
41
          entry.lastrev.author = change.changeset.committer
42
          entry.lastrev.revision = change.revision
43
          entry.lastrev.time = change.changeset.committed_on
44
        end
45
      end
46
    end
47
    entries
48
  end
31 49

  
32 50
  def changesets_for_path(path)
33 51
    Change.find(:all, :include => {:changeset => :user}, 
lib/redmine/scm/adapters/git_adapter.rb (working copy)
125 125
                                       :path => (path.empty? ? name : "#{path}/#{name}"),
126 126
                                       :kind => ((type == "tree") ? 'dir' : 'file'),
127 127
                                       :size => ((type == "tree") ? nil : size),
128
                                       :lastrev => get_rev(identifier,(path.empty? ? name : "#{path}/#{name}")) 
128
                                       :lastrev => Revision.new
129 129
                                                                  
130 130
                                     }) unless entries.detect{|entry| entry.name == name}
131 131
              end
(1-1/4)