diff -r 9699864de219 -r 4b2c266bf059 hgext/keyword.py --- a/hgext/keyword.py Tue Apr 08 13:19:36 2008 +0200 +++ b/hgext/keyword.py Wed Apr 09 15:49:20 2008 -0700 @@ -100,11 +100,6 @@ '''Returns hgdate in cvs-like UTC format.''' return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date[0])) -def textsafe(s): - '''Safe version of util.binary with reversed logic. - Note: argument may not be None, which is allowed for util.binary.''' - return '\0' not in s - # make keyword tools accessible kwtools = {'templater': None, 'hgcmd': '', 'inc': [], 'exc': ['.hg*']} @@ -163,7 +158,7 @@ def expand(self, path, node, data): '''Returns data with keywords expanded.''' - if not self.restrict and self.matcher(path) and textsafe(data): + if not self.restrict and self.matcher(path) and not util.binary(data): changenode = self.getnode(path, node) return self.substitute(data, path, changenode, self.re_kw.sub) return data @@ -191,7 +186,7 @@ for f in candidates: fp = self.repo.file(f) data = fp.read(mf[f]) - if not textsafe(data): + if util.binary(data): continue if expand: changenode = node or self.getnode(f, mf[f]) @@ -211,7 +206,7 @@ def shrink(self, fname, text): '''Returns text with all keyword substitutions removed.''' - if self.matcher(fname) and textsafe(text): + if self.matcher(fname) and not util.binary(text): return self.shrinktext(text) return text @@ -219,7 +214,7 @@ '''Returns lines with keyword substitutions removed.''' if self.matcher(fname): text = ''.join(lines) - if textsafe(text): + if not util.binary(text): return self.shrinktext(text).splitlines(True) return lines