# HG changeset patch # User Christian Ebert # Date 1268834647 -3600 # Node ID 2017d7b24abe361cdf39908f458c3b40ca70cd82 # Parent 876f5dff4e59b8f60265578954cd88ddadc570b9# Parent c118a9c5ca24efa874f2d0fa17ccdc88e7b41312 (stable) merge Even though this is a fake standalone branch, we do not include the patch that removed extension path detection in kwdemo. diff -r 876f5dff4e59 -r 2017d7b24abe hgkw/keyword.py --- a/hgkw/keyword.py Thu Mar 11 19:48:38 2010 +0100 +++ b/hgkw/keyword.py Wed Mar 17 15:04:07 2010 +0100 @@ -162,16 +162,13 @@ Caveat: localrepository._link fails on Windows.''' return self.match(path) and not 'l' in flagfunc(path) - def overwrite(self, node, expand, files): + def overwrite(self, node, expand, candidates): '''Overwrites selected files expanding/shrinking keywords.''' ctx = self.repo[node] mf = ctx.manifest() if node is not None: # commit - files = [f for f in ctx.files() if f in mf] - notify = self.ui.debug - else: # kwexpand/kwshrink - notify = self.ui.note - candidates = [f for f in files if self.iskwfile(f, ctx.flags)] + candidates = [f for f in ctx.files() if f in mf] + candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)] if candidates: self.restrict = True # do not expand when reading msg = (expand and _('overwriting %s expanding keywords\n') @@ -189,7 +186,7 @@ else: found = self.re_kw.search(data) if found: - notify(msg % f) + self.ui.note(msg % f) self.repo.wwrite(f, data, mf.flags(f)) if node is None: self.repo.dirstate.normal(f) @@ -289,9 +286,7 @@ for k, v in sorted(items): ui.write('%s = %s\n' % (k, v)) - msg = 'hg keyword config and expansion example' fn = 'demo.txt' - branchname = 'demobranch' tmpdir = tempfile.mkdtemp('', 'kwdemo.') ui.note(_('creating temporary repository at %s\n') % tmpdir) repo = localrepo.localrepository(ui, tmpdir, True) @@ -337,24 +332,17 @@ keywords = '$' + '$\n$'.join(sorted(kwmaps.keys())) + '$\n' repo.wopener(fn, 'w').write(keywords) repo.add([fn]) - path = repo.wjoin(fn) - ui.note(_('\nkeywords written to %s:\n') % path) + ui.note(_('\nkeywords written to %s:\n') % fn) ui.note(keywords) - ui.note('\nhg -R "%s" branch "%s"\n' % (tmpdir, branchname)) - # silence branch command if not verbose - quiet = ui.quiet - ui.quiet = not ui.verbose - commands.branch(ui, repo, branchname) - ui.quiet = quiet + repo.dirstate.setbranch('demobranch') for name, cmd in ui.configitems('hooks'): if name.split('.', 1)[0].find('commit') > -1: repo.ui.setconfig('hooks', name, '') - ui.note(_('unhooked all commit hooks\n')) - ui.note('hg -R "%s" ci -m "%s"\n' % (tmpdir, msg)) + msg = _('hg keyword configuration and expansion example') + ui.note("hg ci -m '%s'\n" % msg) repo.commit(text=msg) ui.status(_('\n\tkeywords expanded\n')) ui.write(repo.wread(fn)) - ui.debug('\nremoving temporary repository %s\n' % tmpdir) shutil.rmtree(tmpdir, ignore_errors=True) def expand(ui, repo, *pats, **opts): diff -r 876f5dff4e59 -r 2017d7b24abe tests/test-keyword.out --- a/tests/test-keyword.out Thu Mar 11 19:48:38 2010 +0100 +++ b/tests/test-keyword.out Wed Mar 17 15:04:07 2010 +0100 @@ -213,7 +213,7 @@ demo.txt = [keywordmaps] Xinfo = {author}: {desc} -$Xinfo: test: hg keyword config and expansion example $ +$Xinfo: test: hg keyword configuration and expansion example $ % cat expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $ do not process $Id: