Skip to content

Commit c2af690

Browse files
authored
Merge pull request #359 from edgardmessias/ignore_repositories
feat: Added support for ignored repositories list (Close #301)
2 parents 94b7575 + 0adc221 commit c2af690

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ Example:
9090
|`svn.autorefresh`|Whether auto refreshing is enabled|`true`|
9191
|`svn.decorations.enabled`|Controls if SVN contributes colors and badges to the explorer and the open (VSCode \>= 1.18 with proposed-api)|`true`|
9292
|`svn.path`|Path to the svn executable|`null`|
93+
|`svn.defaultCheckoutDirectory`|The default location to checkout a svn repository.|`null`|
94+
|`svn.ignoreRepositories`|List of SVN repositories to ignore.|`null`|
9395
|`svn.ignoreMissingSvnWarning`|Ignores the warning when SVN is missing|`false`|
9496
|`svn.ignoreWorkingCopyIsTooOld`|Ignores the warning when working copy is too old|`false`|
9597
|`svn.diff.withHead`|Show diff changes using latest revision in the repository. Set false to use latest revision in local folder|`true`|

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,15 @@
602602
"default": null,
603603
"description": "The default location to checkout a svn repository."
604604
},
605+
"svn.ignoreRepositories": {
606+
"type": [
607+
"array",
608+
null
609+
],
610+
"default": null,
611+
"scope": "resource",
612+
"description": "List of SVN repositories to ignore."
613+
},
605614
"svn.ignoreMissingSvnWarning": {
606615
"type": "boolean",
607616
"description": "Ignores the warning when SVN is missing",

src/model.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ import {
2727
dispose,
2828
filterEvent,
2929
IDisposable,
30-
isDescendant
30+
isDescendant,
31+
normalizePath
3132
} from "./util";
3233

3334
export class Model implements IDisposable {
@@ -277,6 +278,19 @@ export class Model implements IDisposable {
277278
}
278279

279280
if (isSvnFolder) {
281+
// Config based on folder path
282+
const resourceConfig = workspace.getConfiguration("svn", Uri.file(path));
283+
284+
const ignoredRepos = new Set(
285+
(resourceConfig.get<string[]>("ignoreRepositories") || []).map(p =>
286+
normalizePath(p)
287+
)
288+
);
289+
290+
if (ignoredRepos.has(normalizePath(path))) {
291+
return;
292+
}
293+
280294
try {
281295
const repositoryRoot = await this.svn.getRepositoryRoot(path);
282296

src/util.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ export function fixPathSeparator(file: string) {
7676
return file;
7777
}
7878

79+
export function normalizePath(file: string) {
80+
file = fixPathSeparator(file);
81+
82+
// IF Windows
83+
if (sep === "\\") {
84+
file = file.toLowerCase();
85+
}
86+
87+
return file;
88+
}
89+
7990
export function isDescendant(parent: string, descendant: string): boolean {
8091
parent = parent.replace(/[\\\/]/g, sep);
8192
descendant = descendant.replace(/[\\\/]/g, sep);

0 commit comments

Comments
 (0)