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

Christian Ebert blacktrash at gmx.net
Fri Oct 1 00:24:45 UTC 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1285892011 -7200
# Node ID 00f46e66b680162c9b3302f7d6b2c3eef4a5a8e7
# Parent  bbf833d9e9a1a09f2b001a3c0646fa4af02cb7f4
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
@@ -185,17 +185,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
@@ -418,8 +417,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