Mercurial > hg
changeset 11087:dc2f37864348
keyword: simplify record switch in kwtemplater.overwrite
1) use kwtemplater.record attribute for clarity
2) drop optional context argument; consider the speed loss by
duplicating the dictionary lookup repo['.'] as negligible
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Sat, 01 May 2010 23:59:39 +0200 |
parents | c2601c216333 |
children | c4347e48b0d0 |
files | hgext/keyword.py |
diffstat | 1 files changed, 4 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/keyword.py Sun May 02 09:15:17 2010 +0200 +++ b/hgext/keyword.py Sat May 01 23:59:39 2010 +0200 @@ -160,12 +160,9 @@ Caveat: localrepository._link fails on Windows.''' return self.match(path) and not 'l' in flagfunc(path) - def overwrite(self, node, expand, candidates, recctx=None): + def overwrite(self, node, expand, candidates): '''Overwrites selected files expanding/shrinking keywords.''' - if recctx is None: - ctx = self.repo[node] - else: - ctx = recctx + ctx = self.repo[node] mf = ctx.manifest() if node is not None: # commit, record candidates = [f for f in ctx.files() if f in mf] @@ -175,7 +172,7 @@ msg = (expand and _('overwriting %s expanding keywords\n') or _('overwriting %s shrinking keywords\n')) for f in candidates: - if recctx is None: + if not self.record: data = self.repo.file(f).read(mf[f]) else: data = self.repo.wread(f) @@ -507,7 +504,7 @@ ret = orig(ui, repo, commitfunc, *pats, **opts) recctx = repo['.'] if ctx != recctx: - kwt.overwrite('.', True, None, recctx) + kwt.overwrite('.', True, None) return ret finally: wlock.release()