diff hgext/keyword.py @ 6051:1038b1458d7a

keyword: safeguards against erroneous behaviour or aborts prevent issues due to global [keyword] filename patterns: - add email to nokwcommands - protect everything under .hg from expansion (tested with qcommit) - exclude everything starting with .hg* just in case prevent abort when pulling from bundlerepo: - do not set up kwrepo for bundlerepo expansion inside a bundle is nonsense bundlerepo issue spotted and test case provided by pmezard.
author Christian Ebert <blacktrash@gmx.net>
date Wed, 06 Feb 2008 23:14:33 +0100
parents adf73753eb7d
children 75425961e955
line wrap: on
line diff
--- a/hgext/keyword.py	Thu Feb 07 15:56:20 2008 +0100
+++ b/hgext/keyword.py	Wed Feb 06 23:14:33 2008 +0100
@@ -88,7 +88,7 @@
 
 # hg commands that do not act on keywords
 nokwcommands = ('add addremove bundle copy export grep identify incoming init'
-                ' log outgoing push remove rename rollback tip convert')
+                ' log outgoing push remove rename rollback tip convert email')
 
 # hg commands that trigger expansion only when writing to working dir,
 # not when reading filelog, and unexpand when reading from working dir
@@ -410,8 +410,12 @@
     This is done for local repos only, and only if there are
     files configured at all for keyword substitution.'''
 
-    if not repo.local():
-        return
+    try:
+        if (not repo.local() or '.hg' in repo.root.split('/')
+            or repo._url.startswith('bundle:')):
+            return
+    except AttributeError:
+        pass
 
     hgcmd, func, args, opts, cmdopts = dispatch._parse(ui, sys.argv[1:])
     if hgcmd in nokwcommands.split():
@@ -426,7 +430,7 @@
         if node1 is not None and node1 != repo.changectx().node():
             hgcmd = 'diff1'
 
-    inc, exc = [], ['.hgtags']
+    inc, exc = [], ['.hg*']
     for pat, opt in ui.configitems('keyword'):
         if opt != 'ignore':
             inc.append(pat)