Skip to content

Commit f7e678b

Browse files
committed
use per repository tags
1 parent ccf242d commit f7e678b

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

opengrok-indexer/src/test/java/org/opengrok/indexer/history/FileHistoryCacheTest.java

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,17 @@ void testStoreAndGetNotRenamed() throws Exception {
248248
@EnabledForRepository(MERCURIAL)
249249
@Test
250250
void testStoreAndGetIncrementalTags() throws Exception {
251-
// Enable tagging of history entries.
252-
env.setTagsEnabled(true);
253-
254251
File reposRoot = new File(repositories.getSourceRoot(), "mercurial");
252+
assertTrue(reposRoot.exists());
253+
255254
Repository repo = RepositoryFactory.getRepository(reposRoot);
255+
assertNotNull(repo);
256+
257+
// Enable tagging of history entries.
258+
repo.setTagsEnabled(true);
259+
256260
History historyToStore = repo.getHistory(reposRoot);
261+
assertNotNull(historyToStore);
257262

258263
// Store the history.
259264
cache.store(historyToStore, repo);
@@ -426,13 +431,13 @@ void testRenameFileThenDoIncrementalReindex() throws Exception {
426431
// The test expects support for renamed files.
427432
env.setHandleHistoryOfRenamedFiles(true);
428433

434+
Repository repo = RepositoryFactory.getRepository(reposRoot);
435+
assertNotNull(repo);
436+
429437
// Use tags for better coverage.
430-
env.setTagsEnabled(true);
438+
repo.setTagsEnabled(true);
431439

432440
// Generate history index.
433-
// It is necessary to call getRepository() only after tags were enabled
434-
// to produce list of tags.
435-
Repository repo = RepositoryFactory.getRepository(reposRoot);
436441
History historyToStore = repo.getHistory(reposRoot);
437442
cache.store(historyToStore, repo);
438443

@@ -539,14 +544,9 @@ void testRenameFileThenDoIncrementalReindex() throws Exception {
539544
@Test
540545
void testRenamedFilePlusChangesBranched() throws Exception {
541546
File reposRoot = new File(repositories.getSourceRoot(), "mercurial");
547+
assertTrue(reposRoot.exists());
542548
History updatedHistory;
543549

544-
// The test expects support for renamed files.
545-
env.setHandleHistoryOfRenamedFiles(true);
546-
547-
// Use tags for better coverage.
548-
env.setTagsEnabled(true);
549-
550550
// Branch the repo and add one changeset.
551551
runHgCommand(reposRoot, "unbundle",
552552
Paths.get(getClass().getResource("/history/hg-branch.bundle").toURI()).toString());
@@ -558,10 +558,16 @@ void testRenamedFilePlusChangesBranched() throws Exception {
558558
// Switch to the newly created branch.
559559
runHgCommand(reposRoot, "update", "mybranch");
560560

561-
// Generate history index.
562-
// It is necessary to call getRepository() only after tags were enabled
563-
// to produce list of tags.
564561
Repository repo = RepositoryFactory.getRepository(reposRoot);
562+
assertNotNull(repo);
563+
564+
// The test expects support for renamed files.
565+
repo.setHandleRenamedFiles(true);
566+
567+
// Use tags for better coverage.
568+
repo.setTagsEnabled(true);
569+
570+
// Generate history index.
565571
History historyToStore = repo.getHistory(reposRoot);
566572
cache.store(historyToStore, repo);
567573

0 commit comments

Comments
 (0)