assert_equal 1, @repository.extra_info["db_consistent"]["ordering"]
end
+ def test_db_consistent_ordering_before_1_2
+ assert_nil @repository.extra_info
+ @repository.fetch_changesets
+ @repository.reload
+ assert_equal 21, @repository.changesets.count
+ assert_not_nil @repository.extra_info
+ @repository.write_attribute(:extra_info, nil)
+ @repository.save
+ assert_nil @repository.extra_info
+ assert_equal 21, @repository.changesets.count
+ @repository.fetch_changesets
+ @repository.reload
+ assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
+
+ del_revs = [
+ "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
+ "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
+ "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
+ "deff712f05a90d96edbd70facc47d944be5897e3",
+ "32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf",
+ "7e61ac704deecde634b51e59daa8110435dcb3da",
+ ]
+ @repository.changesets.each do |rev|
+ rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s }
+ end
+ @repository.reload
+ cs1 = @repository.changesets
+ assert_equal 15, cs1.count
+ assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
+ h = @repository.extra_info.dup
+ h["branches"]["master"]["last_scmid"] =
+ "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
+ @repository.merge_extra_info(h)
+ @repository.save
+ @repository.reload
+ extra_info_db_1 = @repository.extra_info["branches"]
+ assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8",
+ extra_info_db_1["master"]["last_scmid"]
+
+ @repository.fetch_changesets
+ assert_equal 21, @repository.changesets.count
+ assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
+ end
+
def test_latest_changesets
@repository.fetch_changesets
@repository.reload