Mercurial > hg > soundsoftware-site
comparison app/models/repository/subversion.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbce1fd3b1b7 |
children | 51d7f3e06556 622f24f53b42 261b3d9a4903 |
comparison
equal
deleted
inserted
replaced
929:5f33065ddc4b | 1115:433d4f72a19b |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2011 Jean-Philippe Lang | 2 # Copyright (C) 2006-2012 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
38 'UTF-8' | 38 'UTF-8' |
39 end | 39 end |
40 | 40 |
41 def latest_changesets(path, rev, limit=10) | 41 def latest_changesets(path, rev, limit=10) |
42 revisions = scm.revisions(path, rev, nil, :limit => limit) | 42 revisions = scm.revisions(path, rev, nil, :limit => limit) |
43 revisions ? changesets.find_all_by_revision(revisions.collect(&:identifier), :order => "committed_on DESC", :include => :user) : [] | 43 if revisions |
44 identifiers = revisions.collect(&:identifier).compact | |
45 changesets.where(:revision => identifiers).reorder("committed_on DESC").includes(:repository, :user).all | |
46 else | |
47 [] | |
48 end | |
44 end | 49 end |
45 | 50 |
46 # Returns a path relative to the url of the repository | 51 # Returns a path relative to the url of the repository |
47 def relative_path(path) | 52 def relative_path(path) |
48 path.gsub(Regexp.new("^\/?#{Regexp.escape(relative_url)}"), '') | 53 path.gsub(Regexp.new("^\/?#{Regexp.escape(relative_url)}"), '') |
79 end | 84 end |
80 end | 85 end |
81 end | 86 end |
82 end | 87 end |
83 | 88 |
89 protected | |
90 | |
91 def load_entries_changesets(entries) | |
92 return unless entries | |
93 | |
94 entries_with_identifier = entries.select {|entry| entry.lastrev && entry.lastrev.identifier.present?} | |
95 identifiers = entries_with_identifier.map {|entry| entry.lastrev.identifier}.compact.uniq | |
96 | |
97 if identifiers.any? | |
98 changesets_by_identifier = changesets.where(:revision => identifiers).includes(:user, :repository).all.group_by(&:revision) | |
99 entries_with_identifier.each do |entry| | |
100 if m = changesets_by_identifier[entry.lastrev.identifier] | |
101 entry.changeset = m.first | |
102 end | |
103 end | |
104 end | |
105 end | |
106 | |
84 private | 107 private |
85 | 108 |
86 # Returns the relative url of the repository | 109 # Returns the relative url of the repository |
87 # Eg: root_url = file:///var/svn/foo | 110 # Eg: root_url = file:///var/svn/foo |
88 # url = file:///var/svn/foo/bar | 111 # url = file:///var/svn/foo/bar |