@@ -14,7 +14,7 @@ ClassMethod export(generated = 0, system = 0, percent = 0, mapped = 0, mask = ""
14
14
#define isGenerated (%code ) ##class (%RoutineMgr ).IsGenerated ( %code )
15
15
#define isPercented (%code ) (" %" = $e (%code ))
16
16
#define isMapped (%code ) ##class (%RoutineMgr ).IsMapped ( %code )
17
- #define log w !, code , " -> " , ##class ( %File ). GetFilename ( filename ), " "
17
+ #define log w !, code , " -> " , $piece ( filename ,.. workdir (), 2 ), " "
18
18
19
19
#define mkdir (%filename ) ##continue
20
20
s path = ##class (%File ).GetDirectory ( %filename ) ##continue
@@ -91,10 +91,11 @@ ClassMethod import(filemask = "*.*", qspec = "cku-d", ByRef err = "", recurse =
91
91
#define push (%dir ) s dirs ( $i ( dirs ) ) = %dir
92
92
#define next (%i,%dir ) s %i =$o ( dirs ( " " ), 1 , %dir ) k :%i '=" " dirs (%i )
93
93
#define isDirectory (%type ) ( %type = " D" )
94
- #define log w !, ##class ( %File ). GetFilename ( filename ), " " w :sc " Ok" d :'sc $system .OBJ .DisplayError (sc )
94
+ #define log w !, $piece ( filename ,.. workdir (), 2 ), " " w :sc " Ok" d :'sc $system .OBJ .DisplayError (sc )
95
95
96
96
s sc = 1 , dirs = " " , dir = ..workdir () $$$push(dir )
97
97
if verbose w " #; Importing from " , dir ,!
98
+ d ..setIgnore (.fm )
98
99
for { $$$next(i ,dir ) Q :i =" " Q :dir =" "
99
100
100
101
s rs = ##class (%File ).FileSetFunc ( dir , filemask , , 1 )
@@ -106,6 +107,8 @@ ClassMethod import(filemask = "*.*", qspec = "cku-d", ByRef err = "", recurse =
106
107
if recurse $$$push(filename )
107
108
continue
108
109
}
110
+ // check file filter
111
+ if ..inFilter (.fm ,filename ) continue
109
112
110
113
s ext = $p ( filename , " ." , * )
111
114
@@ -123,6 +126,43 @@ ClassMethod import(filemask = "*.*", qspec = "cku-d", ByRef err = "", recurse =
123
126
Q sc
124
127
}
125
128
129
+ ClassMethod inFilter (ByRef filtermask ,filename ) as %Boolean
130
+ {
131
+ s result =0
132
+ for
133
+ {
134
+ if '$d (filtermask ($I (i ))) quit
135
+ set filter =$piece (filtermask (i )," *" )
136
+ if $length (filename ,filter )>1 set result =1
137
+ }
138
+
139
+ quit result
140
+ }
141
+
142
+ /// get the filtermask for the repository.
143
+ /// looks for .gitignore file and applies all the lines to filters
144
+ ClassMethod setIgnore (ByRef filtermask )
145
+ {
146
+
147
+ // working with .gitignore file
148
+ // gitignore consists of masks of filtering files
149
+ s filename =..workdir ()_" /.gitignore"
150
+ if '##class (%File ).Exists (filename ) quit
151
+ s file =##class (%File ).%New (filename )
152
+ s sc =file .Open (" R" )
153
+ if 'sc
154
+ {
155
+ if verbose d $System .OBJ .DisplayError (sc ) return
156
+ }
157
+
158
+ While 'file .AtEnd
159
+ {
160
+ s filtermask ($I (filtermask ))=file .ReadLine ()
161
+ }
162
+ quit
163
+ }
164
+
165
+
126
166
/// get or set working directory for export/import source
127
167
ClassMethod workdir (workdir )
128
168
{
@@ -181,10 +221,11 @@ ClassMethod importUpdated(filemask = "*.*", qspec = "cku-d", ByRef err = "", rec
181
221
#define push (%dir ) s dirs ( $i ( dirs ) ) = %dir
182
222
#define next (%i,%dir ) s %i =$o ( dirs ( " " ), 1 , %dir ) k :%i '=" " dirs (%i )
183
223
#define isDirectory (%type ) ( %type = " D" )
184
- #define log w !, ##class ( %File ). GetFilename ( filename )," " w :sc " Ok" d :'sc $system .OBJ .DisplayError ( sc )
224
+ #define log w !, $piece ( filename ,.. workdir (), 2 )," " w :sc " Ok" d :'sc $system .OBJ .DisplayError ( sc )
185
225
186
226
s sc = 1 , dirs = " " , dir = ..workdir () $$$push(dir )
187
227
if verbose w " #; Importing updated from " , dir ,!
228
+ d ..setIgnore (.fm )
188
229
for { $$$next(i ,dir ) Q :i =" " Q :dir =" "
189
230
190
231
s rs = ##class (%File ).FileSetFunc ( dir , filemask , , 1 )
@@ -197,6 +238,9 @@ ClassMethod importUpdated(filemask = "*.*", qspec = "cku-d", ByRef err = "", rec
197
238
continue
198
239
}
199
240
241
+ // check file filter
242
+ if ..inFilter (.fm ,filename ) continue
243
+
200
244
s filets = rs .DateModified
201
245
s codename = ..codename ( filename , .ext )
202
246
s codets = ..codets ( codename , ext )
0 commit comments