Mercurial > public > mercurial-scm > hg-stable
changeset 12685:a247751652ba
keyword: enforce subn method via boolean switch
There are only 2 patterns to choose, and so far only 1 case
where kwtemplater.re_kw.subn is applied on data read from
the working directory: when recording added files.
With this change the code reflects more closely the boolean
character of the switch and underlines the special case.
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Sun, 10 Oct 2010 00:38:57 +0100 |
parents | 8348599c68d7 |
children | fe31f834a9ff |
files | hgext/keyword.py |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/keyword.py Sun Oct 10 00:30:09 2010 +0100 +++ b/hgext/keyword.py Sun Oct 10 00:38:57 2010 +0100 @@ -194,7 +194,7 @@ expansion are not symbolic links.''' return [f for f in cand if self.match(f) and not 'l' in ctx.flags(f)] - def overwrite(self, ctx, candidates, lookup, expand, recsubn=None): + def overwrite(self, ctx, candidates, lookup, expand, rekw=False): '''Overwrites selected files expanding/shrinking keywords.''' if self.restrict or lookup: # exclude kw_copy candidates = self.iskwfile(candidates, ctx) @@ -204,8 +204,7 @@ if self.restrict or expand and lookup: mf = ctx.manifest() fctx = ctx - subn = (self.restrict and self.re_kw.subn or - recsubn or self.re_kwexp.subn) + subn = (self.restrict or rekw) and self.re_kw.subn or self.re_kwexp.subn msg = (expand and _('overwriting %s expanding keywords\n') or _('overwriting %s shrinking keywords\n')) for f in candidates: @@ -578,8 +577,8 @@ modified = [f for f in modified if f in changed] added = [f for f in added if f in changed] kwt.restrict = False - kwt.overwrite(recctx, modified, False, True, kwt.re_kwexp.subn) - kwt.overwrite(recctx, added, False, True, kwt.re_kw.subn) + kwt.overwrite(recctx, modified, False, True) + kwt.overwrite(recctx, added, False, True, True) kwt.restrict = True return ret finally: