hgkw/keyword.py
changeset 292 783c1310e20f
parent 290 b05795ad5632
child 293 a7d568671575
--- a/hgkw/keyword.py	Wed Nov 07 13:40:58 2007 +0100
+++ b/hgkw/keyword.py	Thu Nov 08 13:03:24 2007 +0100
@@ -80,7 +80,7 @@
         Or, better, use bundle/unbundle to share changes.
 '''
 
-from mercurial import commands, cmdutil, context, dispatch
+from mercurial import commands, cmdutil, context, fancyopts
 from mercurial import filelog, localrepo, revlog, templater, util
 from mercurial.i18n import _
 import re, shutil, sys, tempfile, time
@@ -394,12 +394,18 @@
     This is done for local repos only, and only if there are
     files configured at all for keyword substitution.'''
 
-    nokwcommands = ['add', 'addremove', 'bundle', 'clone', 'copy', 'export',
+    nokwcommands = ('add', 'addremove', 'bundle', 'clone', 'copy', 'export',
                     'grep', 'identify', 'incoming', 'init', 'outgoing', 'push',
-                    'remove', 'rename', 'rollback', 'convert']
+                    'remove', 'rename', 'rollback', 'convert')
 
-    if (not repo.local() or
-        dispatch._parse(ui, sys.argv[1:])[0] in nokwcommands):
+    def _getcmd():
+        '''Simplified argument parsing as we are only interested in command.'''
+        args = fancyopts.fancyopts(sys.argv[1:], commands.globalopts, {})
+        if args:
+            aliases, i = cmdutil.findcmd(ui, args[0], commands.table)
+            return aliases[0]
+
+    if not repo.local() or _getcmd() in nokwcommands:
         return
 
     inc, exc = [], ['.hgtags']