Make cvs revision numbers sorted in chronological order, as before r1201.
git-svn-id: http://redmine.rubyforge.org/svn/branches/work@1214 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
93c2aebb61
commit
e8e64d2de2
1 file changed
+14
-3
@@ -93,6 +93,7 @@ class Repository::Cvs < Repository
|
|||||||
|
|
||||||
fetch_since = latest_changeset ? latest_changeset.committed_on : nil
|
fetch_since = latest_changeset ? latest_changeset.committed_on : nil
|
||||||
transaction do
|
transaction do
|
||||||
|
tmp_rev_num = 1
|
||||||
scm.revisions('', fetch_since, nil, :with_paths => true) do |revision|
|
scm.revisions('', fetch_since, nil, :with_paths => true) do |revision|
|
||||||
# only add the change to the database, if it doen't exists. the cvs log
|
# only add the change to the database, if it doen't exists. the cvs log
|
||||||
# is not exclusive at all.
|
# is not exclusive at all.
|
||||||
@@ -106,13 +107,15 @@ class Repository::Cvs < Repository
|
|||||||
|
|
||||||
# create a new changeset....
|
# create a new changeset....
|
||||||
unless cs
|
unless cs
|
||||||
|
# we use a temporaray revision number here (just for inserting)
|
||||||
|
# later on, we calculate a continous positive number
|
||||||
latest = changesets.find(:first, :order => 'id DESC')
|
latest = changesets.find(:first, :order => 'id DESC')
|
||||||
next_rev = latest ? latest.revision.to_i + 1 : '1'
|
|
||||||
cs = Changeset.create(:repository => self,
|
cs = Changeset.create(:repository => self,
|
||||||
:revision => next_rev,
|
:revision => "_#{tmp_rev_num}",
|
||||||
:committer => revision.author,
|
:committer => revision.author,
|
||||||
:committed_on => revision.time,
|
:committed_on => revision.time,
|
||||||
:comments => revision.message)
|
:comments => revision.message)
|
||||||
|
tmp_rev_num += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
#convert CVS-File-States to internal Action-abbrevations
|
#convert CVS-File-States to internal Action-abbrevations
|
||||||
@@ -132,6 +135,14 @@ class Repository::Cvs < Repository
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
# Renumber new changesets in chronological order
|
||||||
|
c = changesets.find(:first, :order => 'committed_on DESC, id DESC', :conditions => "revision NOT LIKE '_%'")
|
||||||
|
next_rev = c.nil? ? 1 : (c.revision.to_i + 1)
|
||||||
|
changesets.find(:all, :order => 'committed_on ASC, id ASC', :conditions => "revision LIKE '_%'").each do |changeset|
|
||||||
|
changeset.update_attribute :revision, next_rev
|
||||||
|
next_rev += 1
|
||||||
|
end
|
||||||
|
end # transaction
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user