@@ -68,6 +68,8 @@ public final class HistoryGuru {
68
68
*/
69
69
private static final HistoryGuru INSTANCE = new HistoryGuru ();
70
70
71
+ private final RuntimeEnvironment env ;
72
+
71
73
/**
72
74
* The history cache to use.
73
75
*/
@@ -91,10 +93,10 @@ public final class HistoryGuru {
91
93
* control system.
92
94
*/
93
95
private HistoryGuru () {
94
- HistoryCache cache = null ;
95
- RuntimeEnvironment env = RuntimeEnvironment .getInstance ();
96
+ env = RuntimeEnvironment .getInstance ();
96
97
scanningDepth = env .getScanningDepth ();
97
98
99
+ HistoryCache cache = null ;
98
100
if (env .useHistoryCache ()) {
99
101
cache = new FileHistoryCache ();
100
102
@@ -244,7 +246,7 @@ public History getHistory(File file, boolean withFiles, boolean ui)
244
246
final File dir = file .isDirectory () ? file : file .getParentFile ();
245
247
final Repository repo = getRepository (dir );
246
248
247
- RemoteSCM rscm = RuntimeEnvironment . getInstance () .getRemoteScmSupported ();
249
+ RemoteSCM rscm = env .getRemoteScmSupported ();
248
250
boolean doRemote = (ui && (rscm == RemoteSCM .UIONLY ))
249
251
|| (rscm == RemoteSCM .ON )
250
252
|| (ui || ((rscm == RemoteSCM .DIRBASED ) && (repo != null ) && repo .hasHistoryForDirectories ()));
@@ -318,9 +320,9 @@ public boolean hasHistory(File file) {
318
320
319
321
// This should return true for Annotate view.
320
322
return repo .isWorking () && repo .fileHasHistory (file )
321
- && ((RuntimeEnvironment . getInstance () .getRemoteScmSupported () == RemoteSCM .ON )
322
- || (RuntimeEnvironment . getInstance () .getRemoteScmSupported () == RemoteSCM .UIONLY )
323
- || (RuntimeEnvironment . getInstance () .getRemoteScmSupported () == RemoteSCM .DIRBASED )
323
+ && ((env .getRemoteScmSupported () == RemoteSCM .ON )
324
+ || (env .getRemoteScmSupported () == RemoteSCM .UIONLY )
325
+ || (env .getRemoteScmSupported () == RemoteSCM .DIRBASED )
324
326
|| !repo .isRemote ());
325
327
}
326
328
@@ -541,8 +543,7 @@ private void createCache(Repository repository, String sinceRevision) {
541
543
542
544
private void createCacheReal (Collection <Repository > repositories ) {
543
545
Statistics elapsed = new Statistics ();
544
- ExecutorService executor = RuntimeEnvironment .getInstance ().
545
- getIndexerParallelizer ().getHistoryExecutor ();
546
+ ExecutorService executor = env .getIndexerParallelizer ().getHistoryExecutor ();
546
547
// Since we know each repository object from the repositories
547
548
// collection is unique, we can abuse HashMap to create a list of
548
549
// repository,revision tuples with repository as key (as the revision
@@ -704,7 +705,7 @@ public void createCache() {
704
705
*/
705
706
private List <Repository > getReposFromString (Collection <String > repositories ) {
706
707
ArrayList <Repository > repos = new ArrayList <>();
707
- File srcRoot = RuntimeEnvironment . getInstance () .getSourceRootFile ();
708
+ File srcRoot = env .getSourceRootFile ();
708
709
709
710
for (String file : repositories ) {
710
711
File f = new File (srcRoot , file );
0 commit comments