File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ const Svn = require ( './svn' ) ;
2+
3+ function repository ( ) {
4+ this . svn = new Svn ( ) ;
5+ this . filePaths = [ ] ;
6+ this . update ( ) ;
7+ }
8+
9+ repository . prototype . update = function ( ) {
10+ this . svn . getStatus ( ) . then ( result => {
11+ result . forEach ( item => {
12+ this . filePaths . push ( item . $ . path ) ;
13+ } ) ;
14+ } ) ;
15+ }
16+
17+ repository . prototype . getRepositoryFilePath = function ( relativePath ) {
18+ let repositoryFilePath = false ;
19+
20+ this . filePaths . forEach ( filePath => {
21+ const fileName = relativePath . split ( '/' ) . pop ( ) ;
22+
23+ let regex = new RegExp ( fileName , 'g' ) ;
24+ let matches = filePath . match ( regex ) ;
25+
26+ if ( matches ) {
27+ repositoryFilePath = filePath ;
28+ }
29+ } ) ;
30+
31+ return repositoryFilePath ;
32+ }
33+
34+ module . exports = repository ;
You can’t perform that action at this time.
0 commit comments