Skip to content

Commit be7069d

Browse files
edgardmessiasJohnstonCode
authored andcommitted
feat: Allow to scan repository on ignored folders (close #570) (#586)
1 parent 5e3631e commit be7069d

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Here is a table of settings with their default values. To change any of these, a
112112
|`svn.sourceControl.ignoreOnCommit`|Changelists to ignore on commit|`["ignore-on-commit"]`|
113113
|`svn.sourceControl.ignoreOnStatusCount`|Changelists to ignore on status count|`["ignore-on-commit"]`|
114114
|`svn.detectExternals`|Controls whether to automatically detect svn externals.|`true`|
115+
|`svn.detectIgnored`|Controls whether to automatically detect svn on ignored folders.|`true`|
115116
|`svn.sourceControl.combineExternalIfSameServer`|Combine the svn external in the main if is from the same server.|`false`|
116117
|`svn.sourceControl.countUnversioned`|Allow to count unversioned files in status count|`true`|
117118
|`svn.log.length`|Number of commit messages to log|`50`|

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,11 @@
10311031
"default": true,
10321032
"description": "Controls whether to automatically detect svn externals."
10331033
},
1034+
"svn.detectIgnored": {
1035+
"type": "boolean",
1036+
"default": true,
1037+
"description": "Controls whether to automatically detect svn on ignored folders."
1038+
},
10341039
"svn.sourceControl.combineExternalIfSameServer": {
10351040
"type": "boolean",
10361041
"default": false,

src/model.ts

+25-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export class Model implements IDisposable {
157157
@debounce(500)
158158
private eventuallyScanPossibleSvnRepositories(): void {
159159
for (const path of this.possibleSvnRepositoryPaths) {
160-
this.tryOpenRepository(path);
160+
this.tryOpenRepository(path, 1);
161161
}
162162

163163
this.possibleSvnRepositoryPaths.clear();
@@ -176,6 +176,19 @@ export class Model implements IDisposable {
176176
.forEach(p => this.eventuallyScanPossibleSvnRepository(p));
177177
}
178178

179+
private scanIgnored(repository: Repository): void {
180+
const shouldScan =
181+
configuration.get<boolean>("detectIgnored") === true;
182+
183+
if (!shouldScan) {
184+
return;
185+
}
186+
187+
repository.statusIgnored
188+
.map(r => path.join(repository.workspaceRoot, r.path))
189+
.forEach(p => this.eventuallyScanPossibleSvnRepository(p));
190+
}
191+
179192
private disable(): void {
180193
this.repositories.forEach(repository => repository.dispose());
181194
this.openRepositories = [];
@@ -335,6 +348,15 @@ export class Model implements IDisposable {
335348
return false;
336349
}
337350
}
351+
for (const ignored of liveRepository.repository.statusIgnored) {
352+
const ignoredPath = path.join(
353+
liveRepository.repository.workspaceRoot,
354+
ignored.path
355+
);
356+
if (isDescendant(ignoredPath, hint.fsPath)) {
357+
return false;
358+
}
359+
}
338360

339361
return true;
340362
});
@@ -390,8 +412,10 @@ export class Model implements IDisposable {
390412

391413
const statusListener = repository.onDidChangeStatus(() => {
392414
this.scanExternals(repository);
415+
this.scanIgnored(repository);
393416
});
394417
this.scanExternals(repository);
418+
this.scanIgnored(repository);
395419

396420
const dispose = () => {
397421
disappearListener.dispose();

0 commit comments

Comments
 (0)