Make command line check even more private
authorChristian Ebert <blacktrash@gmx.net>
Tue, 01 Jan 2008 19:16:13 +0100
changeset 318 12d26936a315
parent 317 b18631f0dbdc
child 319 2da9ab0bc400
Make command line check even more private
hgkw/keyword.py
--- a/hgkw/keyword.py	Sat Dec 29 18:45:47 2007 +0100
+++ b/hgkw/keyword.py	Tue Jan 01 19:16:13 2008 +0100
@@ -404,18 +404,19 @@
     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',
-                    'grep', 'identify', 'incoming', 'init', 'outgoing', 'push',
-                    'remove', 'rename', 'rollback', 'convert')
-
-    def _getcmd():
-        '''Simplified argument parsing as we are only interested in command.'''
+    def kwbailout():
+        '''Obtains command via simplified cmdline parsing,
+        returns True if keyword expansion not needed.'''
+        nokwcommands = ('add', 'addremove', 'bundle', 'clone', 'copy',
+                        'export', 'grep', 'identify', 'incoming', 'init',
+                        'outgoing', 'push', 'remove', 'rename', 'rollback',
+                        'convert')
         args = fancyopts.fancyopts(sys.argv[1:], commands.globalopts, {})
         if args:
             aliases, i = cmdutil.findcmd(ui, args[0], commands.table)
-            return aliases[0]
+            return aliases[0] in nokwcommands
 
-    if not repo.local() or _getcmd() in nokwcommands:
+    if not repo.local() or kwbailout():
         return
 
     inc, exc = [], ['.hgtags']