comparison app/models/repository/git.rb @ 3:7c48bad7d85d yuya

* Import Mercurial overhaul patches from Yuya Nishihara (see http://www.redmine.org/issues/4455)
author Chris Cannam
date Wed, 28 Jul 2010 12:40:01 +0100
parents 513646585e45
children b859cc0c4fa1
comparison
equal deleted inserted replaced
2:b940d200fbd2 3:7c48bad7d85d
47 # before fetching changesets (eg. for offline resync) 47 # before fetching changesets (eg. for offline resync)
48 def fetch_changesets 48 def fetch_changesets
49 c = changesets.find(:first, :order => 'committed_on DESC') 49 c = changesets.find(:first, :order => 'committed_on DESC')
50 since = (c ? c.committed_on - 7.days : nil) 50 since = (c ? c.committed_on - 7.days : nil)
51 51
52 revisions = scm.revisions('', nil, nil, :all => true, :since => since) 52 revisions = scm.revisions('', nil, nil, :all => true, :since => since, :reverse => true)
53 return if revisions.nil? || revisions.empty? 53 return if revisions.nil? || revisions.empty?
54 54
55 recent_changesets = changesets.find(:all, :conditions => ['committed_on >= ?', since]) 55 recent_changesets = changesets.find(:all, :conditions => ['committed_on >= ?', since])
56 56
57 # Clean out revisions that are no longer in git 57 # Clean out revisions that are no longer in git
73 :all, 73 :all,
74 :conditions => [ 74 :conditions => [
75 "scmid IN (?)", 75 "scmid IN (?)",
76 revisions.map!{|c| c.scmid} 76 revisions.map!{|c| c.scmid}
77 ], 77 ],
78 :order => 'committed_on DESC' 78 :order => 'id DESC'
79 ) 79 )
80 end 80 end
81 end 81 end