largefile: fix up hasattr usage
authorMatt Mackall <mpm@selenic.com>
Thu, 29 Sep 2011 16:48:48 -0500
changeset 15169 aa262fff87ac
parent 15168 cfccd3bee7b3
child 15170 c1a4a3220711
largefile: fix up hasattr usage
hgext/largefiles/basestore.py
hgext/largefiles/lfutil.py
hgext/largefiles/overrides.py
hgext/largefiles/uisetup.py
--- a/hgext/largefiles/basestore.py	Sat Sep 24 17:35:45 2011 +0200
+++ b/hgext/largefiles/basestore.py	Thu Sep 29 16:48:48 2011 -0500
@@ -179,7 +179,7 @@
 
     # The path could be a scheme so use Mercurial's normal functionality
     # to resolve the scheme to a repository and use its path
-    path = hasattr(remote, 'url') and remote.url() or remote.path
+    path = util.safehasattr(remote, 'url') and remote.url() or remote.path
 
     match = _scheme_re.match(path)
     if not match:                       # regular filesystem path
--- a/hgext/largefiles/lfutil.py	Sat Sep 24 17:35:45 2011 +0200
+++ b/hgext/largefiles/lfutil.py	Thu Sep 29 16:48:48 2011 -0500
@@ -170,7 +170,7 @@
     except ImportError:
         # Mercurial <= 1.8
         opener = util.opener(admin)
-    if hasattr(repo.dirstate, '_validate'):
+    if util.safehasattr(repo.dirstate, '_validate'):
         lfdirstate = largefiles_dirstate(opener, ui, repo.root,
             repo.dirstate._validate)
     else:
--- a/hgext/largefiles/overrides.py	Sat Sep 24 17:35:45 2011 +0200
+++ b/hgext/largefiles/overrides.py	Thu Sep 29 16:48:48 2011 -0500
@@ -483,7 +483,7 @@
             oldmatch = None # for the closure
             def override_match(ctxorrepo, pats=[], opts={}, globbed=False,
                     default='relpath'):
-                if hasattr(ctxorrepo, 'match'):
+                if util.safehasattr(ctxorrepo, 'match'):
                     ctx0 = ctxorrepo
                 else:
                     ctx0 = ctxorrepo[None]
--- a/hgext/largefiles/uisetup.py	Sat Sep 24 17:35:45 2011 +0200
+++ b/hgext/largefiles/uisetup.py	Thu Sep 29 16:48:48 2011 -0500
@@ -69,7 +69,7 @@
     extensions.wrapfunction(hg, 'merge', overrides.hg_merge)
 
     extensions.wrapfunction(archival, 'archive', overrides.override_archive)
-    if hasattr(cmdutil, 'bailifchanged'):
+    if util.safehasattr(cmdutil, 'bailifchanged'):
         extensions.wrapfunction(cmdutil, 'bailifchanged',
             overrides.override_bailifchanged)
     else: