# HG changeset patch # User Christian Ebert # Date 1244580143 -7200 # Node ID fdb3a5bf2c5c82d0b578a28a09920723a51441f5 # Parent 9353633b1611db59a236230d19fb2013186f483b (0.9.2compat) update doc strings and help diff -r 9353633b1611 -r fdb3a5bf2c5c hgkw/keyword.py --- a/hgkw/keyword.py Tue Jun 09 22:32:14 2009 +0200 +++ b/hgkw/keyword.py Tue Jun 09 22:42:23 2009 +0200 @@ -2,8 +2,8 @@ # # Copyright 2007, 2008 Christian Ebert # -# This software may be used and distributed according to the terms -# of the GNU General Public License, incorporated herein by reference. +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2, incorporated herein by reference. # # $Id$ # @@ -11,8 +11,8 @@ # # There are many good reasons why this is not needed in a distributed # SCM, still it may be useful in very small projects based on single -# files (like LaTeX packages), that are mostly addressed to an audience -# not running a version control system. +# files (like LaTeX packages), that are mostly addressed to an +# audience not running a version control system. # # For in-depth discussion refer to # . @@ -36,15 +36,15 @@ '''keyword expansion in local repositories -This extension expands RCS/CVS-like or self-customized $Keywords$ -in tracked text files selected by your configuration. +This extension expands RCS/CVS-like or self-customized $Keywords$ in +tracked text files selected by your configuration. -Keywords are only expanded in local repositories and not stored in -the change history. The mechanism can be regarded as a convenience -for the current user or for archive distribution. +Keywords are only expanded in local repositories and not stored in the +change history. The mechanism can be regarded as a convenience for the +current user or for archive distribution. -Configuration is done in the [keyword] and [keywordmaps] sections -of hgrc files. +Configuration is done in the [keyword] and [keywordmaps] sections of +hgrc files. Example: @@ -54,26 +54,28 @@ x* = ignore Note: the more specific you are in your filename patterns - the less you lose speed in huge repos. + the less you lose speed in huge repositories. For [keywordmaps] template mapping and expansion demonstration and control run "hg kwdemo". An additional date template filter {date|utcdate} is provided. -The default template mappings (view with "hg kwdemo -d") can be replaced -with customized keywords and templates. -Again, run "hg kwdemo" to control the results of your config changes. +The default template mappings (view with "hg kwdemo -d") can be +replaced with customized keywords and templates. Again, run "hg +kwdemo" to control the results of your config changes. Before changing/disabling active keywords, run "hg kwshrink" to avoid -the risk of inadvertedly storing expanded keywords in the change history. +the risk of inadvertently storing expanded keywords in the change +history. To force expansion after enabling it, or a configuration change, run "hg kwexpand". -Also, when committing with the record extension or using mq's qrecord, be aware -that keywords cannot be updated. Again, run "hg kwexpand" on the files in -question to update keyword expansions after all changes have been checked in. +Also, when committing with the record extension or using mq's qrecord, +be aware that keywords cannot be updated. Again, run "hg kwexpand" on +the files in question to update keyword expansions after all changes +have been checked in. Expansions spanning more than one line and incremental expansions, like CVS' $Log$, are not supported. A keyword template map @@ -446,11 +448,11 @@ def demo(ui, repo, *args, **opts): '''print [keywordmaps] configuration and an expansion example - Show current, custom, or default keyword template maps - and their expansions. + Show current, custom, or default keyword template maps and their + expansions. - Extend current configuration by specifying maps as arguments - and optionally by reading from an additional hgrc file. + Extend current configuration by specifying maps as arguments and + optionally by reading from an additional hgrc file. Override current keyword template maps with "default" option. ''' @@ -467,7 +469,7 @@ fn = 'demo.txt' branchname = 'demobranch' tmpdir = tempfile.mkdtemp('', 'kwdemo.') - ui.note(_('creating temporary repo at %s\n') % tmpdir) + ui.note(_('creating temporary repository at %s\n') % tmpdir) repo = localrepo.localrepository(ui, tmpdir, True) ui.setconfig('keyword', fn, '') if args or opts.get('rcfile'): @@ -520,7 +522,7 @@ fmt = ui.verbose and ' in %s' % path or '' demostatus('%s keywords expanded%s' % (kwstatus, fmt)) ui.write(repo.wread(fn)) - ui.debug(_('\nremoving temporary repo %s\n') % tmpdir) + ui.debug(_('\nremoving temporary repository %s\n') % tmpdir) shutil.rmtree(tmpdir, ignore_errors=True) def expand(ui, repo, *pats, **opts): @@ -536,9 +538,9 @@ def files(ui, repo, *pats, **opts): '''print files currently configured for keyword expansion - Crosscheck which files in working directory are potential targets for - keyword expansion. - That is, files matched by [keyword] config patterns but not symlinks. + Crosscheck which files in working directory are potential targets + for keyword expansion. That is, files matched by [keyword] config + patterns but not symlinks. ''' kwt = kwtools['templater'] status = _status(ui, repo, kwt, opts.get('untracked'), *pats, **opts) @@ -576,8 +578,8 @@ def shrink(ui, repo, *pats, **opts): '''revert expanded keywords in the working directory - Run before changing/disabling active keywords - or if you experience problems with "hg import" or "hg merge". + Run before changing/disabling active keywords or if you experience + problems with "hg import" or "hg merge". kwshrink refuses to run if given files contain local changes. ''' @@ -591,8 +593,7 @@ if file matches user configuration. Wraps commit to overwrite configured files with updated keyword substitutions. - This is done for local repos only, and only if there are - files configured at all for keyword substitution.''' + Monkeypatches patch and webcommands.''' try: if (not repo.local() or kwtools['hgcmd'] in nokwcommands.split() diff -r 9353633b1611 -r fdb3a5bf2c5c tests/test-keyword.out --- a/tests/test-keyword.out Tue Jun 09 22:32:14 2009 +0200 +++ b/tests/test-keyword.out Tue Jun 09 22:42:23 2009 +0200 @@ -1,32 +1,34 @@ % help keyword extension - keyword expansion in local repositories -This extension expands RCS/CVS-like or self-customized $Keywords$ -in tracked text files selected by your configuration. -Keywords are only expanded in local repositories and not stored in -the change history. The mechanism can be regarded as a convenience -for the current user or for archive distribution. -Configuration is done in the [keyword] and [keywordmaps] sections -of hgrc files. +This extension expands RCS/CVS-like or self-customized $Keywords$ in +tracked text files selected by your configuration. +Keywords are only expanded in local repositories and not stored in the +change history. The mechanism can be regarded as a convenience for the +current user or for archive distribution. +Configuration is done in the [keyword] and [keywordmaps] sections of +hgrc files. Example: [keyword] # expand keywords in every python file except those matching "x*" **.py = x* = ignore Note: the more specific you are in your filename patterns - the less you lose speed in huge repos. + the less you lose speed in huge repositories. For [keywordmaps] template mapping and expansion demonstration and control run "hg kwdemo". An additional date template filter {date|utcdate} is provided. -The default template mappings (view with "hg kwdemo -d") can be replaced -with customized keywords and templates. -Again, run "hg kwdemo" to control the results of your config changes. +The default template mappings (view with "hg kwdemo -d") can be +replaced with customized keywords and templates. Again, run "hg +kwdemo" to control the results of your config changes. Before changing/disabling active keywords, run "hg kwshrink" to avoid -the risk of inadvertedly storing expanded keywords in the change history. +the risk of inadvertently storing expanded keywords in the change +history. To force expansion after enabling it, or a configuration change, run "hg kwexpand". -Also, when committing with the record extension or using mq's qrecord, be aware -that keywords cannot be updated. Again, run "hg kwexpand" on the files in -question to update keyword expansions after all changes have been checked in. +Also, when committing with the record extension or using mq's qrecord, +be aware that keywords cannot be updated. Again, run "hg kwexpand" on +the files in question to update keyword expansions after all changes +have been checked in. Expansions spanning more than one line and incremental expansions, like CVS' $Log$, are not supported. A keyword template map "Log = {desc}" expands to the first line of the changeset description.