##// END OF EJS Templates
scm: subversion: code clean up model....
Toshi MARUYAMA -
r5633:fa5f4ff77a7c
parent child
Show More
@@ -1,16 +1,16
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 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.
@@ -91,23 +91,23 class Repository::Cvs < Repository
91 91 # convert rev to revision. CVS can't handle changesets here
92 92 diff=[]
93 93 changeset_from = changesets.find_by_revision(rev)
94 if rev_to.to_i > 0
94 if rev_to.to_i > 0
95 95 changeset_to = changesets.find_by_revision(rev_to)
96 96 end
97 97 changeset_from.changes.each() do |change_from|
98 98 revision_from = nil
99 revision_to = nil
99 revision_to = nil
100 100 if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path))
101 101 revision_from = change_from.revision
102 102 end
103 103 if revision_from
104 104 if changeset_to
105 105 changeset_to.changes.each() do |change_to|
106 revision_to=change_to.revision if change_to.path==change_from.path
106 revision_to = change_to.revision if change_to.path == change_from.path
107 107 end
108 108 end
109 109 unless revision_to
110 revision_to=scm.get_previous_revision(revision_from)
110 revision_to = scm.get_previous_revision(revision_from)
111 111 end
112 112 file_diff = scm.diff(change_from.path, revision_from, revision_to)
113 113 diff = diff + file_diff unless file_diff.nil?
@@ -121,8 +121,8 class Repository::Cvs < Repository
121 121 # natively cvs doesn't provide any kind of changesets,
122 122 # there is only a revision per file.
123 123 # we now take a guess using the author, the commitlog and the commit-date.
124
125 # last one is the next step to take. the commit-date is not equal for all
124
125 # last one is the next step to take. the commit-date is not equal for all
126 126 # commits in one changeset. cvs update the commit-date when the *,v file was touched. so
127 127 # we use a small delta here, to merge all changes belonging to _one_ changeset
128 128 time_delta = 10.seconds
@@ -131,7 +131,7 class Repository::Cvs < Repository
131 131 tmp_rev_num = 1
132 132 scm.revisions('', fetch_since, nil, :log_encoding => repo_log_encoding) do |revision|
133 133 # only add the change to the database, if it doen't exists. the cvs log
134 # is not exclusive at all.
134 # is not exclusive at all.
135 135 tmp_time = revision.time.clone
136 136 unless changes.find_by_path_and_revision(
137 137 scm.with_leading_slash(revision.paths[0][:path]),
@@ -147,7 +147,7 class Repository::Cvs < Repository
147 147 :comments => cmt
148 148 }
149 149 )
150 # create a new changeset....
150 # create a new changeset....
151 151 unless cs
152 152 # we use a temporaray revision number here (just for inserting)
153 153 # later on, we calculate a continous positive number
@@ -157,7 +157,7 class Repository::Cvs < Repository
157 157 cs = Changeset.create(:repository => self,
158 158 :revision => "tmp#{tmp_rev_num}",
159 159 :scmid => scmid,
160 :committer => revision.author,
160 :committer => revision.author,
161 161 :committed_on => tmp_time,
162 162 :comments => revision.message)
163 163 tmp_rev_num += 1
@@ -179,7 +179,7 class Repository::Cvs < Repository
179 179 )
180 180 end
181 181 end
182
182
183 183 # Renumber new changesets in chronological order
184 184 changesets.find(
185 185 :all,
General Comments 0
You need to be logged in to leave comments. Login now