[PATCH 4 of 5] keyword: pass context to iskwfile() and call ctx.flags() there

Christian Ebert blacktrash at gmx.net
Fri Oct 1 11:35:23 CDT 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1285950917 -7200
# Node ID 76eefe6fd45e8172f5b7d9a4ca216ef061ed60a6
# Parent  46da06a959cc929fe2a2bdc750ef42553b455714
keyword: pass context to iskwfile() and call ctx.flags() there

Remove obsolete cruft from iskwfile docstring.

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -191,17 +191,16 @@
             return self.substitute(data, path, ctx, self.re_kw.sub)
         return data
 
-    def iskwfile(self, path, flagfunc):
+    def iskwfile(self, path, ctx):
         '''Returns true if path matches [keyword] pattern
-        and is not a symbolic link.
-        Caveat: localrepository._link fails on Windows.'''
-        return self.match(path) and not 'l' in flagfunc(path)
+        and is not a symbolic link.'''
+        return self.match(path) and not 'l' in ctx.flags(path)
 
     def overwrite(self, ctx, candidates, iswctx, expand, changed):
         '''Overwrites selected files expanding/shrinking keywords.'''
         if changed is not None:
             candidates = [f for f in candidates if f in changed]
-        candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)]
+        candidates = [f for f in candidates if self.iskwfile(f, ctx)]
         if candidates:
             restrict = self.restrict
             self.restrict = changed is None # no expansion on filelog read
@@ -420,8 +419,8 @@
     if not opts.get('unknown') or opts.get('all'):
         files = sorted(modified + added + clean)
     wctx = repo[None]
-    kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
-    kwunknown = [f for f in unknown if kwt.iskwfile(f, wctx.flags)]
+    kwfiles = [f for f in files if kwt.iskwfile(f, wctx)]
+    kwunknown = [f for f in unknown if kwt.iskwfile(f, wctx)]
     if not opts.get('ignore') or opts.get('all'):
         showfiles = kwfiles, kwunknown
     else:


More information about the Mercurial-devel mailing list