##// END OF EJS Templates
Subversion repository now accepts svn+ssh url....
Jean-Philippe Lang -
r740:a42a115b8fa2
parent child
Show More
@@ -1,69 +1,69
1 1 # redMine - project management software
2 2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require 'redmine/scm/adapters/subversion_adapter'
19 19
20 20 class Repository::Subversion < Repository
21 21 attr_protected :root_url
22 22 validates_presence_of :url
23 validates_format_of :url, :with => /^(http|https|svn|file):\/\/.+/i
23 validates_format_of :url, :with => /^(http|https|svn|svn\+ssh|file):\/\/.+/i
24 24
25 25 def scm_adapter
26 26 Redmine::Scm::Adapters::SubversionAdapter
27 27 end
28 28
29 29 def self.scm_name
30 30 'Subversion'
31 31 end
32 32
33 33 def fetch_changesets
34 34 scm_info = scm.info
35 35 if scm_info
36 36 # latest revision found in database
37 37 db_revision = latest_changeset ? latest_changeset.revision : 0
38 38 # latest revision in the repository
39 39 scm_revision = scm_info.lastrev.identifier.to_i
40 40 if db_revision < scm_revision
41 41 logger.debug "Fetching changesets for repository #{url}" if logger && logger.debug?
42 42 identifier_from = db_revision + 1
43 43 while (identifier_from <= scm_revision)
44 44 # loads changesets by batches of 200
45 45 identifier_to = [identifier_from + 199, scm_revision].min
46 46 revisions = scm.revisions('', identifier_to, identifier_from, :with_paths => true)
47 47 transaction do
48 48 revisions.reverse_each do |revision|
49 49 changeset = Changeset.create(:repository => self,
50 50 :revision => revision.identifier,
51 51 :committer => revision.author,
52 52 :committed_on => revision.time,
53 53 :comments => revision.message)
54 54
55 55 revision.paths.each do |change|
56 56 Change.create(:changeset => changeset,
57 57 :action => change[:action],
58 58 :path => change[:path],
59 59 :from_path => change[:from_path],
60 60 :from_revision => change[:from_revision])
61 61 end
62 62 end
63 63 end unless revisions.nil?
64 64 identifier_from = identifier_to + 1
65 65 end
66 66 end
67 67 end
68 68 end
69 69 end
General Comments 0
You need to be logged in to leave comments. Login now