Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# **v1.5.0 UNDER DEVELOPMENT**

# **v1.4.1**

## Bug Fixes

* @edgardmessias Not check SVN version if folder not contains ".svn" folder
* @edgardmessias Fixed ignored folder for multifolder svn to work with Windows

# **v1.4.0**

## What's New
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@
"type": "array",
"minimum": 4,
"description": "Folders to ignore using SVN",
"default": ["**/.git", "**/.hg", "**/vendor", "**/node_modules"]
"default": [
"**/.git/**",
"**/.hg/**",
"**/vendor/**",
"**/node_modules/**"
]
}
}
}
Expand Down
57 changes: 33 additions & 24 deletions src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,18 @@ export class Model {

// Base on https://github.com/aleclarson/glob-regex/blob/master/index.js
const pattern = ignoreList
.join("|")
.replace(/\./g, "\\.")
.replace(/\*\*\//g, "(.+[\\\\/])?")
.replace(/\*\*/g, "(.+[\\\\/])?*")
.replace(/\*/g, "[^\\\\/]+");
.map((ignored: string) => {
return ignored
.replace(/\\/g, "/")
.replace(/\./g, "\\.")
.replace(/\*\*\//g, "(.+[\\\\/])?")
.replace(/\*\*/g, "(.+[\\\\/])?*")
.replace(/\*/g, "[^\\\\/]+")
.replace(/(\w)\//g, "$1[\\\\/]")
.replace(/\/(\w)/g, "[\\\\/]$1")
.replace(/(\w)$/g, "$1([\\\\/].*)*");
})
.join("|");

try {
this.ignorePattern = new RegExp("^(" + pattern + ")$");
Expand Down Expand Up @@ -177,30 +184,32 @@ export class Model {
return;
}

try {
const repositoryRoot = await this.svn.getRepositoryRoot(path);

if (this.getRepository(repositoryRoot)) {
return;
}

const repository = new Repository(this.svn.open(repositoryRoot, path));
if (fs.existsSync(path + "/.svn")) {
try {
const repositoryRoot = await this.svn.getRepositoryRoot(path);

this.open(repository);
} catch (err) {
const newLevel = level + 1;
if (this.getRepository(repositoryRoot)) {
return;
}

if (newLevel <= this.maxDepth) {
fs.readdirSync(path).forEach(file => {
const dir = path + "/" + file;
if (fs.statSync(dir).isDirectory() && !this.ignorePattern.test(dir)) {
this.tryOpenRepository(dir, newLevel);
}
});
}
const repository = new Repository(this.svn.open(repositoryRoot, path));

this.open(repository);
} catch (err) {}
return;
}

const newLevel = level + 1;
if (newLevel <= this.maxDepth) {
fs.readdirSync(path).forEach(file => {
const dir = path + "/" + file;
if (fs.statSync(dir).isDirectory() && !this.ignorePattern.test(dir)) {
this.tryOpenRepository(dir, newLevel);
}
});
}

return;
}

getRepository(hint: any) {
Expand Down