# HG changeset patch # User Christian Ebert # Date 1182181767 -7200 # Node ID d16332759801055ef6fb830a41f27f75a2ff4f95 # Parent c18c0c80b6c2da7af05c5b529e22845380243a19 Confine activation to specific commands; drop broken archive configuration diff -r c18c0c80b6c2 -r d16332759801 hgkw/keyword.py --- a/hgkw/keyword.py Fri Jun 15 08:56:26 2007 +0200 +++ b/hgkw/keyword.py Mon Jun 18 17:49:27 2007 +0200 @@ -106,6 +106,9 @@ 'Header': '{root}/{file},v {node|short} {date|utcdate} {author|user}', } +kwcommands = ('status', 'commit', 'update', 'revert', 'backout', 'diff', 'cat', + 'archive', 'pull', 'unbundle', 'import') + def utcdate(date): '''Returns hgdate in cvs-like UTC format.''' return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date[0])) @@ -224,21 +227,15 @@ This is done for local repos only, and only if there are files configured at all for keyword substitution.''' - if not repo.local(): + if not repo.local() or getcmd(ui) not in kwcommands: return - inc, exc, archive, noarchive = [], ['.hg*'], [], ['.hg*'] - for pat, opt in repo.ui.configitems('keyword'): - if opt == 'archive': - archive.append(pat) - elif opt == 'noarchive': - noarchive.append(pat) - elif opt == 'ignore': + inc, exc = [], ['.hg*'] + for pat, opt in ui.configitems('keyword'): + if opt != 'ignore': + inc.append(pat) + else: exc.append(pat) - else: - inc.append(pat) - if getcmd(repo.ui) == 'archive': - inc, exc = archive, noarchive if not inc: return