Skip to content

Commit 1f4e649

Browse files
authored
Merge pull request #66 from edgardmessias/improved_multiple_folder
Improved multiple svn folders
2 parents 1dfe816 + 1fc88ca commit 1f4e649

File tree

3 files changed

+46
-25
lines changed

3 files changed

+46
-25
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# **v1.5.0 UNDER DEVELOPMENT**
22

3+
# **v1.4.1**
4+
5+
## Bug Fixes
6+
7+
* @edgardmessias Not check SVN version if folder not contains ".svn" folder
8+
* @edgardmessias Fixed ignored folder for multifolder svn to work with Windows
9+
310
# **v1.4.0**
411

512
## What's New

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,12 @@
179179
"type": "array",
180180
"minimum": 4,
181181
"description": "Folders to ignore using SVN",
182-
"default": ["**/.git", "**/.hg", "**/vendor", "**/node_modules"]
182+
"default": [
183+
"**/.git/**",
184+
"**/.hg/**",
185+
"**/vendor/**",
186+
"**/node_modules/**"
187+
]
183188
}
184189
}
185190
}

src/model.ts

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,18 @@ export class Model {
7575

7676
// Base on https://github.com/aleclarson/glob-regex/blob/master/index.js
7777
const pattern = ignoreList
78-
.join("|")
79-
.replace(/\./g, "\\.")
80-
.replace(/\*\*\//g, "(.+[\\\\/])?")
81-
.replace(/\*\*/g, "(.+[\\\\/])?*")
82-
.replace(/\*/g, "[^\\\\/]+");
78+
.map((ignored: string) => {
79+
return ignored
80+
.replace(/\\/g, "/")
81+
.replace(/\./g, "\\.")
82+
.replace(/\*\*\//g, "(.+[\\\\/])?")
83+
.replace(/\*\*/g, "(.+[\\\\/])?*")
84+
.replace(/\*/g, "[^\\\\/]+")
85+
.replace(/(\w)\//g, "$1[\\\\/]")
86+
.replace(/\/(\w)/g, "[\\\\/]$1")
87+
.replace(/(\w)$/g, "$1([\\\\/].*)*");
88+
})
89+
.join("|");
8390

8491
try {
8592
this.ignorePattern = new RegExp("^(" + pattern + ")$");
@@ -177,30 +184,32 @@ export class Model {
177184
return;
178185
}
179186

180-
try {
181-
const repositoryRoot = await this.svn.getRepositoryRoot(path);
182-
183-
if (this.getRepository(repositoryRoot)) {
184-
return;
185-
}
186-
187-
const repository = new Repository(this.svn.open(repositoryRoot, path));
187+
if (fs.existsSync(path + "/.svn")) {
188+
try {
189+
const repositoryRoot = await this.svn.getRepositoryRoot(path);
188190

189-
this.open(repository);
190-
} catch (err) {
191-
const newLevel = level + 1;
191+
if (this.getRepository(repositoryRoot)) {
192+
return;
193+
}
192194

193-
if (newLevel <= this.maxDepth) {
194-
fs.readdirSync(path).forEach(file => {
195-
const dir = path + "/" + file;
196-
if (fs.statSync(dir).isDirectory() && !this.ignorePattern.test(dir)) {
197-
this.tryOpenRepository(dir, newLevel);
198-
}
199-
});
200-
}
195+
const repository = new Repository(this.svn.open(repositoryRoot, path));
201196

197+
this.open(repository);
198+
} catch (err) {}
202199
return;
203200
}
201+
202+
const newLevel = level + 1;
203+
if (newLevel <= this.maxDepth) {
204+
fs.readdirSync(path).forEach(file => {
205+
const dir = path + "/" + file;
206+
if (fs.statSync(dir).isDirectory() && !this.ignorePattern.test(dir)) {
207+
this.tryOpenRepository(dir, newLevel);
208+
}
209+
});
210+
}
211+
212+
return;
204213
}
205214

206215
getRepository(hint: any) {

0 commit comments

Comments
 (0)