summaryrefslogtreecommitdiffstats
path: root/test/unit/repository_git_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-03-28 17:18:04 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-03-28 17:18:04 +0000
commit9b333e1c87722f1d580a7e1a9f5e72fad985cf60 (patch)
tree9225f4bb3e1a52020cb38bd501ae1438d672d7f4 /test/unit/repository_git_test.rb
parent3e11f9abfe9d55963983305b8ca71ca0a428b1cc (diff)
downloadredmine-9b333e1c87722f1d580a7e1a9f5e72fad985cf60.tar.gz
redmine-9b333e1c87722f1d580a7e1a9f5e72fad985cf60.zip
scm: git: process new git revisions all at once rather than per branch (#10470)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9283 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/repository_git_test.rb')
-rw-r--r--test/unit/repository_git_test.rb68
1 files changed, 38 insertions, 30 deletions
diff --git a/test/unit/repository_git_test.rb b/test/unit/repository_git_test.rb
index bc1e3a632..91b41af94 100644
--- a/test/unit/repository_git_test.rb
+++ b/test/unit/repository_git_test.rb
@@ -116,7 +116,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
assert_equal "README", change.path
assert_equal "A", change.action
- assert_equal NUM_HEAD, @repository.extra_info["branches"].size
+ assert_equal NUM_HEAD, @repository.extra_info["heads"].size
end
def test_fetch_changesets_incremental
@@ -124,11 +124,11 @@ class RepositoryGitTest < ActiveSupport::TestCase
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- extra_info_db = @repository.extra_info["branches"]
- assert_equal "1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127",
- extra_info_db["latin-1-path-encoding"]["last_scmid"]
- assert_equal "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
- extra_info_db["master"]["last_scmid"]
+ extra_info_heads = @repository.extra_info["heads"].dup
+ assert_equal NUM_HEAD, extra_info_heads.size
+ extra_info_heads.delete_if { |x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c" }
+ assert_equal 4, extra_info_heads.size
+
del_revs = [
"83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
"ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
@@ -142,20 +142,19 @@ class RepositoryGitTest < ActiveSupport::TestCase
end
@project.reload
cs1 = @repository.changesets
- assert_equal 22, cs1.count
- h = @repository.extra_info.dup
- h["branches"]["master"]["last_scmid"] =
- "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
+ assert_equal NUM_REV - 6, cs1.count
+ extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
+ h = {}
+ h["heads"] = extra_info_heads
@repository.merge_extra_info(h)
@repository.save
@project.reload
- extra_info_db_1 = @repository.extra_info["branches"]
- assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8",
- extra_info_db_1["master"]["last_scmid"]
-
+ assert @repository.extra_info["heads"].index("4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8")
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
+ assert_equal NUM_HEAD, @repository.extra_info["heads"].size
+ assert @repository.extra_info["heads"].index("83ca5fd546063a3c7dc2e568ba3355661a9e2b2c")
end
def test_fetch_changesets_history_editing
@@ -163,9 +162,11 @@ class RepositoryGitTest < ActiveSupport::TestCase
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- assert_equal NUM_HEAD, @repository.extra_info["branches"].size
- assert_equal "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
- @repository.extra_info["branches"]["master"]["last_scmid"]
+ extra_info_heads = @repository.extra_info["heads"].dup
+ assert_equal NUM_HEAD, extra_info_heads.size
+ extra_info_heads.delete_if { |x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c" }
+ assert_equal 4, extra_info_heads.size
+
del_revs = [
"83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
"ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
@@ -189,17 +190,21 @@ class RepositoryGitTest < ActiveSupport::TestCase
@project.reload
assert_equal NUM_REV - 5, @repository.changesets.count
- h = @repository.extra_info.dup
- h["branches"]["master"]["last_scmid"] = "abcd1234efgh"
+ extra_info_heads << "abcd1234efgh"
+ h = {}
+ h["heads"] = extra_info_heads
@repository.merge_extra_info(h)
@repository.save
@project.reload
- assert_equal "abcd1234efgh",
- @repository.extra_info["branches"]["master"]["last_scmid"]
+ h1 = @repository.extra_info["heads"].dup
+ assert h1.index("abcd1234efgh")
+ assert_equal 5, h1.size
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV - 5, @repository.changesets.count
+ h2 = @repository.extra_info["heads"].dup
+ assert_equal h1, h2
end
def test_parents
@@ -246,6 +251,8 @@ class RepositoryGitTest < ActiveSupport::TestCase
@project.reload
assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
+ extra_info_heads = @repository.extra_info["heads"].dup
+ extra_info_heads.delete_if { |x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c" }
del_revs = [
"83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
"ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
@@ -261,18 +268,19 @@ class RepositoryGitTest < ActiveSupport::TestCase
cs1 = @repository.changesets
assert_equal NUM_REV - 6, cs1.count
assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
- h = @repository.extra_info.dup
- h["branches"]["master"]["last_scmid"] =
- "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
+
+ extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
+ h = {}
+ h["heads"] = extra_info_heads
@repository.merge_extra_info(h)
@repository.save
@project.reload
- extra_info_db_1 = @repository.extra_info["branches"]
- assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8",
- extra_info_db_1["master"]["last_scmid"]
-
+ assert @repository.extra_info["heads"].index("4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8")
@repository.fetch_changesets
+ @project.reload
assert_equal NUM_REV, @repository.changesets.count
+ assert_equal NUM_HEAD, @repository.extra_info["heads"].size
+
assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
end
@@ -511,7 +519,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- %w|95488a44bc25f7d1f97d775a31359539ff333a63 95488a44b|.each do |r1|
+ %w|7234cb2750b63f47bff735edc50a1c0a433c2518 7234cb275|.each do |r1|
changeset = @repository.find_changeset_by_name(r1)
assert_nil changeset.previous
end
@@ -535,7 +543,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
- %w|67e7792ce20ccae2e4bb73eed09bb397819c8834 67e7792ce20cca|.each do |r1|
+ %w|2a682156a3b6e77a8bf9cd4590e8db757f3c6c78 2a682156a3b6e77a|.each do |r1|
changeset = @repository.find_changeset_by_name(r1)
assert_nil changeset.next
end