Show More
@@ -116,11 +116,11 b' class kwtemplater(object):' | |||||
116 | 'Header': '{root}/{file},v {node|short} {date|utcdate} {author|user}', |
|
116 | 'Header': '{root}/{file},v {node|short} {date|utcdate} {author|user}', | |
117 | } |
|
117 | } | |
118 |
|
118 | |||
119 |
def __init__(self, ui, repo, inc, exc, restrict |
|
119 | def __init__(self, ui, repo, inc, exc, restrict): | |
120 | self.ui = ui |
|
120 | self.ui = ui | |
121 | self.repo = repo |
|
121 | self.repo = repo | |
122 | self.matcher = util.matcher(repo.root, inc=inc, exc=exc)[1] |
|
122 | self.matcher = util.matcher(repo.root, inc=inc, exc=exc)[1] | |
123 |
self.restrict |
|
123 | self.restrict = restrict | |
124 | self.commitnode = None |
|
124 | self.commitnode = None | |
125 | self.path = '' |
|
125 | self.path = '' | |
126 |
|
126 | |||
@@ -159,7 +159,7 b' class kwtemplater(object):' | |||||
159 |
|
159 | |||
160 | def expand(self, node, data): |
|
160 | def expand(self, node, data): | |
161 | '''Returns data with keywords expanded.''' |
|
161 | '''Returns data with keywords expanded.''' | |
162 |
if self.restrict |
|
162 | if self.restrict or util.binary(data): | |
163 | return data |
|
163 | return data | |
164 | return self.substitute(node, data, self.re_kw.sub) |
|
164 | return self.substitute(node, data, self.re_kw.sub) | |
165 |
|
165 | |||
@@ -436,8 +436,8 b' def reposetup(ui, repo):' | |||||
436 | return |
|
436 | return | |
437 |
|
437 | |||
438 | global _kwtemplater |
|
438 | global _kwtemplater | |
439 |
|
|
439 | restrict = hgcmd in restricted.split() | |
440 |
_kwtemplater = kwtemplater(ui, repo, inc, exc, |
|
440 | _kwtemplater = kwtemplater(ui, repo, inc, exc, restrict) | |
441 |
|
441 | |||
442 | class kwrepo(repo.__class__): |
|
442 | class kwrepo(repo.__class__): | |
443 | def file(self, f, kwmatch=False): |
|
443 | def file(self, f, kwmatch=False): | |
@@ -449,7 +449,7 b' def reposetup(ui, repo):' | |||||
449 |
|
449 | |||
450 | def wread(self, filename): |
|
450 | def wread(self, filename): | |
451 | data = super(kwrepo, self).wread(filename) |
|
451 | data = super(kwrepo, self).wread(filename) | |
452 |
if |
|
452 | if restrict and _kwtemplater.matcher(filename): | |
453 | return _kwtemplater.shrink(data) |
|
453 | return _kwtemplater.shrink(data) | |
454 | return data |
|
454 | return data | |
455 |
|
455 |
General Comments 0
You need to be logged in to leave comments.
Login now