Skip to content

Commit 8049938

Browse files
idodeclareVladimir Kotal
authored andcommitted
Reorder repositories by cost and popularity
1 parent d7648fc commit 8049938

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/RepositoryFactory.java

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
22-
* Portions Copyright (c) 2017, 2019, Chris Fraire <[email protected]>.
22+
* Portions Copyright (c) 2017, 2019-2020, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.history;
2525

@@ -51,21 +51,30 @@ public final class RepositoryFactory {
5151
private static final Logger LOGGER = LoggerFactory.getLogger(RepositoryFactory.class);
5252

5353
private static final Repository[] repositories = {
54-
new BitKeeperRepository(),
55-
new MercurialRepository(),
56-
new AccuRevRepository(),
57-
new BazaarRepository(),
58-
new GitRepository(),
59-
new MonotoneRepository(),
60-
new SubversionRepository(),
61-
new SCCSRepository(),
62-
new RazorRepository(),
63-
new ClearCaseRepository(),
64-
new PerforceRepository(),
65-
new RCSRepository(),
66-
new CVSRepository(),
67-
new RepoRepository(),
68-
new SSCMRepository()
54+
/*
55+
* The following do cheap checks to determine isRepositoryFor(),
56+
* but still put the most popular at the head of the repositories
57+
* array.
58+
*/
59+
new GitRepository(),
60+
new MercurialRepository(),
61+
new RepoRepository(),
62+
new BitKeeperRepository(),
63+
new BazaarRepository(),
64+
new MonotoneRepository(),
65+
new SubversionRepository(),
66+
new SCCSRepository(),
67+
new RazorRepository(),
68+
new RCSRepository(),
69+
new CVSRepository(),
70+
new SSCMRepository(),
71+
/*
72+
* The following do expensive checks to determine isRepositoryFor(),
73+
* so put them at the end of the repositories array.
74+
*/
75+
new AccuRevRepository(),
76+
new ClearCaseRepository(),
77+
new PerforceRepository()
6978
};
7079

7180
private static final Map<String, Class<? extends Repository>> byName = new HashMap<>();

0 commit comments

Comments
 (0)