diff hgext/narrow/narrowtemplates.py @ 36472:d0d5eef57fb0

narrow: drop safehasattr() checks for always-present repo.narrowmatch I've added checks for repo.narrowmatch().always() in order to restore some of the fast paths for non-narrow repos. Differential Revision: https://phab.mercurial-scm.org/D2495
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 28 Feb 2018 10:38:09 -0800
parents 02cd2fb6de72
children 7b74afec6772
line wrap: on
line diff
--- a/hgext/narrow/narrowtemplates.py	Wed Feb 28 12:56:01 2018 -0800
+++ b/hgext/narrow/narrowtemplates.py	Wed Feb 28 10:38:09 2018 -0800
@@ -10,7 +10,6 @@
 from mercurial import (
     registrar,
     revlog,
-    util,
 )
 
 keywords = {}
@@ -33,8 +32,8 @@
 def outsidenarrow(repo, ctx, templ, **args):
     """String. 'outsidenarrow' if the change affects no tracked files,
     else ''."""
-    if util.safehasattr(repo, 'narrowmatch'):
-        m = repo.narrowmatch()
+    m = repo.narrowmatch()
+    if not m.always():
         if not any(m(f) for f in ctx.files()):
             return 'outsidenarrow'
     return ''