# HG changeset patch # User Matt Mackall # Date 2011-09-29 21:48:48 # Node ID aa262fff87ac028affbe72d3a47d0cb31d07710b # Parent cfccd3bee7b3e8d03525f5f60ca248a45b31fb21 largefile: fix up hasattr usage diff --git a/hgext/largefiles/basestore.py b/hgext/largefiles/basestore.py --- a/hgext/largefiles/basestore.py +++ b/hgext/largefiles/basestore.py @@ -179,7 +179,7 @@ def _openstore(repo, remote=None, put=Fa # 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 diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -170,7 +170,7 @@ def openlfdirstate(ui, repo): 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: diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -483,7 +483,7 @@ def override_revert(orig, ui, repo, *pat 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] diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py --- a/hgext/largefiles/uisetup.py +++ b/hgext/largefiles/uisetup.py @@ -69,7 +69,7 @@ def uisetup(ui): 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: