##// END OF EJS Templates
keyword: make iskwfile() a weeding method in lieu of a boolean...
Christian Ebert -
r12627:7d916289 default
parent child Browse files
Show More
@@ -191,16 +191,15 b' class kwtemplater(object):'
191 return self.substitute(data, path, ctx, self.re_kw.sub)
191 return self.substitute(data, path, ctx, self.re_kw.sub)
192 return data
192 return data
193
193
194 def iskwfile(self, path, flagfunc):
194 def iskwfile(self, cand, ctx):
195 '''Returns true if path matches [keyword] pattern
195 '''Returns subset of candidates which are configured for keyword
196 and is not a symbolic link.
196 expansion are not symbolic links.'''
197 Caveat: localrepository._link fails on Windows.'''
197 return [f for f in cand if self.match(f) and not 'l' in ctx.flags(f)]
198 return self.match(path) and not 'l' in flagfunc(path)
199
198
200 def overwrite(self, ctx, candidates, lookup, expand):
199 def overwrite(self, ctx, candidates, lookup, expand):
201 '''Overwrites selected files expanding/shrinking keywords.'''
200 '''Overwrites selected files expanding/shrinking keywords.'''
202 if self.restrict or lookup: # exclude kw_copy
201 if self.restrict or lookup: # exclude kw_copy
203 candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)]
202 candidates = self.iskwfile(candidates, ctx)
204 if not candidates:
203 if not candidates:
205 return
204 return
206 commit = self.restrict and not lookup
205 commit = self.restrict and not lookup
@@ -417,8 +416,8 b' def files(ui, repo, *pats, **opts):'
417 if not opts.get('unknown') or opts.get('all'):
416 if not opts.get('unknown') or opts.get('all'):
418 files = sorted(modified + added + clean)
417 files = sorted(modified + added + clean)
419 wctx = repo[None]
418 wctx = repo[None]
420 kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
419 kwfiles = kwt.iskwfile(files, wctx)
421 kwunknown = [f for f in unknown if kwt.iskwfile(f, wctx.flags)]
420 kwunknown = kwt.iskwfile(unknown, wctx)
422 if not opts.get('ignore') or opts.get('all'):
421 if not opts.get('ignore') or opts.get('all'):
423 showfiles = kwfiles, kwunknown
422 showfiles = kwfiles, kwunknown
424 else:
423 else:
General Comments 0
You need to be logged in to leave comments. Login now