compat: use 'safehasattr' over 'hasattr'
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 21 Jul 2017 09:50:26 +0200
changeset 2751 4f560f117fff
parent 2750 bd3824d1b795
child 2752 4457aa1d81aa
compat: use 'safehasattr' over 'hasattr' 'hasattr' is broken in python 2.
hgext3rd/evolve/compat.py
--- a/hgext3rd/evolve/compat.py	Fri Jul 14 07:19:15 2017 +0530
+++ b/hgext3rd/evolve/compat.py	Fri Jul 21 09:50:26 2017 +0200
@@ -8,7 +8,8 @@
 
 from mercurial import (
     hg,
-    obsolete
+    obsolete,
+    util,
 )
 
 try:
@@ -23,7 +24,7 @@
 
 eh = exthelper.exthelper()
 
-if not hasattr(hg, '_copycache'):
+if not util.safehasattr(hg, '_copycache'):
     # exact copy of relevantmarkers as in Mercurial-176d1a0ce385
     # this fixes relevant markers computation for version < hg-4.3
     @eh.wrapfunction(obsolete.obsstore, 'relevantmarkers')