From be7069d35ab008a6b21e5ced6e609740fbb37d7d Mon Sep 17 00:00:00 2001 From: Edgard Lorraine Messias Date: Wed, 29 May 2019 05:29:31 -0300 Subject: [PATCH] feat: Allow to scan repository on ignored folders (close #570) (#586) --- README.md | 1 + package.json | 5 +++++ src/model.ts | 26 +++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e12703e..5b1b1ad4 100644 --- a/README.md +++ b/README.md @@ -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`| diff --git a/package.json b/package.json index f35135ff..4b394c94 100644 --- a/package.json +++ b/package.json @@ -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, diff --git a/src/model.ts b/src/model.ts index 0de01236..6ed6b75c 100644 --- a/src/model.ts +++ b/src/model.ts @@ -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(); @@ -176,6 +176,19 @@ export class Model implements IDisposable { .forEach(p => this.eventuallyScanPossibleSvnRepository(p)); } + private scanIgnored(repository: Repository): void { + const shouldScan = + configuration.get("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 = []; @@ -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; }); @@ -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();