Skip to content

Commit

Permalink
feat: Allow to scan repository on ignored folders (close #570) (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias authored and JohnstonCode committed May 29, 2019
1 parent 5e3631e commit be7069d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Here is a table of settings with their default values. To change any of these, a
|`svn.sourceControl.ignoreOnCommit`|Changelists to ignore on commit|`["ignore-on-commit"]`|
|`svn.sourceControl.ignoreOnStatusCount`|Changelists to ignore on status count|`["ignore-on-commit"]`|
|`svn.detectExternals`|Controls whether to automatically detect svn externals.|`true`|
|`svn.detectIgnored`|Controls whether to automatically detect svn on ignored folders.|`true`|
|`svn.sourceControl.combineExternalIfSameServer`|Combine the svn external in the main if is from the same server.|`false`|
|`svn.sourceControl.countUnversioned`|Allow to count unversioned files in status count|`true`|
|`svn.log.length`|Number of commit messages to log|`50`|
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,11 @@
"default": true,
"description": "Controls whether to automatically detect svn externals."
},
"svn.detectIgnored": {
"type": "boolean",
"default": true,
"description": "Controls whether to automatically detect svn on ignored folders."
},
"svn.sourceControl.combineExternalIfSameServer": {
"type": "boolean",
"default": false,
Expand Down
26 changes: 25 additions & 1 deletion src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class Model implements IDisposable {
@debounce(500)
private eventuallyScanPossibleSvnRepositories(): void {
for (const path of this.possibleSvnRepositoryPaths) {
this.tryOpenRepository(path);
this.tryOpenRepository(path, 1);
}

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

private scanIgnored(repository: Repository): void {
const shouldScan =
configuration.get<boolean>("detectIgnored") === true;

if (!shouldScan) {
return;
}

repository.statusIgnored
.map(r => path.join(repository.workspaceRoot, r.path))
.forEach(p => this.eventuallyScanPossibleSvnRepository(p));
}

private disable(): void {
this.repositories.forEach(repository => repository.dispose());
this.openRepositories = [];
Expand Down Expand Up @@ -335,6 +348,15 @@ export class Model implements IDisposable {
return false;
}
}
for (const ignored of liveRepository.repository.statusIgnored) {
const ignoredPath = path.join(
liveRepository.repository.workspaceRoot,
ignored.path
);
if (isDescendant(ignoredPath, hint.fsPath)) {
return false;
}
}

return true;
});
Expand Down Expand Up @@ -390,8 +412,10 @@ export class Model implements IDisposable {

const statusListener = repository.onDidChangeStatus(() => {
this.scanExternals(repository);
this.scanIgnored(repository);
});
this.scanExternals(repository);
this.scanIgnored(repository);

const dispose = () => {
disappearListener.dispose();
Expand Down

0 comments on commit be7069d

Please sign in to comment.