Mercurial > hgsubversion
changeset 1404:c79fdd5f615d
cleanup: stop using hasattr
Use hg's util.safehasattr when possible, and a getattr trick when not.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Tue, 10 May 2016 23:02:37 -0400 |
parents | 94eb844fd4ab |
children | 85981b27e740 |
files | hgsubversion/svnexternals.py hgsubversion/svnmeta.py hgsubversion/svnwrap/svn_swig_wrapper.py |
diffstat | 3 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/svnexternals.py +++ b/hgsubversion/svnexternals.py @@ -488,7 +488,7 @@ class svnsubrepo(subrepo.svnsubrepo): def dirty(self, ignoreupdate=False): # You cannot compare anything with HEAD. Just accept it # can be anything. - if hasattr(self, '_wcrevs'): + if hgutil.safehasattr(self, '_wcrevs'): wcrevs = self._wcrevs() else: wcrev = self._wcrev()
--- a/hgsubversion/svnmeta.py +++ b/hgsubversion/svnmeta.py @@ -221,7 +221,7 @@ class SVNMeta(object): @property def editor(self): - if not hasattr(self, '_editor'): + if not hgutil.safehasattr(self, '_editor'): self._editor = editor.HgEditor(self) return self._editor
--- a/hgsubversion/svnwrap/svn_swig_wrapper.py +++ b/hgsubversion/svnwrap/svn_swig_wrapper.py @@ -170,7 +170,7 @@ def _create_auth_baton(pool, password_st providers.append(p) else: for p in platform_specific: - if hasattr(core, p): + if getattr(core, p, None) is not None: try: providers.append(getattr(core, p)()) except RuntimeError: