hgkw/keyword.py
branchstable
changeset 471 2c2f35f8501f
parent 470 2c530e5df1d4
child 472 b1c631613074
--- a/hgkw/keyword.py	Thu Jun 26 14:35:46 2008 -0500
+++ b/hgkw/keyword.py	Thu Jun 26 14:35:50 2008 -0500
@@ -165,11 +165,11 @@
             return self.substitute(data, path, changenode, self.re_kw.sub)
         return data
 
-    def iskwfile(self, path, islink):
+    def iskwfile(self, path, flagfunc):
         '''Returns true if path matches [keyword] pattern
         and is not a symbolic link.
         Caveat: localrepository._link fails on Windows.'''
-        return self.matcher(path) and not islink(path)
+        return self.matcher(path) and not 'l' in flagfunc(path)
 
     def overwrite(self, node, expand, files):
         '''Overwrites selected files expanding/shrinking keywords.'''
@@ -180,9 +180,8 @@
             notify = self.ui.debug
         else:                    # kwexpand/kwshrink
             ctx = self.repo['.']
-            mf = ctx.manifest()
             notify = self.ui.note
-        candidates = [f for f in files if self.iskwfile(f, mf.linkf)]
+        candidates = [f for f in files if self.iskwfile(f, ctx.flags)]
         if candidates:
             self.restrict = True # do not expand when reading
             candidates.sort()
@@ -389,8 +388,7 @@
         files += unknown
     files.sort()
     wctx = repo[None]
-    islink = lambda p: 'l' in wctx.flags(p)
-    kwfiles = [f for f in files if kwt.iskwfile(f, islink)]
+    kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
     cwd = pats and repo.getcwd() or ''
     kwfstats = not opts.get('ignore') and (('K', kwfiles),) or ()
     if opts.get('all') or opts.get('ignore'):