@@ -75,11 +75,18 @@ export class Model {
75
75
76
76
// Base on https://github.com/aleclarson/glob-regex/blob/master/index.js
77
77
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 ( "|" ) ;
83
90
84
91
try {
85
92
this . ignorePattern = new RegExp ( "^(" + pattern + ")$" ) ;
@@ -177,30 +184,32 @@ export class Model {
177
184
return ;
178
185
}
179
186
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 ) ;
188
190
189
- this . open ( repository ) ;
190
- } catch ( err ) {
191
- const newLevel = level + 1 ;
191
+ if ( this . getRepository ( repositoryRoot ) ) {
192
+ return ;
193
+ }
192
194
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 ) ) ;
201
196
197
+ this . open ( repository ) ;
198
+ } catch ( err ) { }
202
199
return ;
203
200
}
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 ;
204
213
}
205
214
206
215
getRepository ( hint : any ) {
0 commit comments