##// END OF EJS Templates
hgext: replace uses of hasattr with util.safehasattr
Augie Fackler -
r14945:11aad09a default
parent child Browse files
Show More
@@ -11,6 +11,7 b' import cPickle as pickle'
11 11 from mercurial import util
12 12 from mercurial.i18n import _
13 13 from mercurial import hook
14 from mercurial import util
14 15
15 16 class logentry(object):
16 17 '''Class logentry has the following attributes:
@@ -513,8 +514,8 b' def createchangeset(ui, log, fuzz=60, me'
513 514 e.comment == c.comment and
514 515 e.author == c.author and
515 516 e.branch == c.branch and
516 (not hasattr(e, 'branchpoints') or
517 not hasattr (c, 'branchpoints') or
517 (not util.safehasattr(e, 'branchpoints') or
518 not util.safehasattr (c, 'branchpoints') or
518 519 e.branchpoints == c.branchpoints) and
519 520 ((c.date[0] + c.date[1]) <=
520 521 (e.date[0] + e.date[1]) <=
@@ -16,7 +16,7 b' class convert_git(converter_source):'
16 16 # Windows does not support GIT_DIR= construct while other systems
17 17 # cannot remove environment variable. Just assume none have
18 18 # both issues.
19 if hasattr(os, 'unsetenv'):
19 if util.safehasattr(os, 'unsetenv'):
20 20 def gitopen(self, s, noerr=False):
21 21 prevgitdir = os.environ.get('GIT_DIR')
22 22 os.environ['GIT_DIR'] = self.path
@@ -54,7 +54,7 b' def _create_auth_baton(pool):'
54 54 if p:
55 55 providers.append(p)
56 56 else:
57 if hasattr(svn.client, 'get_windows_simple_provider'):
57 if util.safehasattr(svn.client, 'get_windows_simple_provider'):
58 58 providers.append(svn.client.get_windows_simple_provider(pool))
59 59
60 60 return svn.core.svn_auth_open(providers, pool)
@@ -73,7 +73,7 b' class SvnRaTransport(object):'
73 73 self.password = ''
74 74
75 75 # Only Subversion 1.4 has reparent()
76 if ra is None or not hasattr(svn.ra, 'reparent'):
76 if ra is None or not util.safehasattr(svn.ra, 'reparent'):
77 77 self.client = svn.client.create_context(self.pool)
78 78 ab = _create_auth_baton(self.pool)
79 79 if False:
@@ -11,6 +11,7 b''
11 11 # todo: socket permissions
12 12
13 13 from mercurial.i18n import _
14 from mercurial import util
14 15 import server
15 16 from client import client, QueryFailed
16 17
@@ -31,7 +32,7 b' def debuginotify(ui, repo, **opts):'
31 32 ui.write((' %s/\n') % path)
32 33
33 34 def reposetup(ui, repo):
34 if not hasattr(repo, 'dirstate'):
35 if not util.safehasattr(repo, 'dirstate'):
35 36 return
36 37
37 38 class inotifydirstate(repo.dirstate.__class__):
@@ -58,7 +58,7 b' from mercurial import commands, dispatch'
58 58 from mercurial.i18n import _
59 59
60 60 def _runpager(p):
61 if not hasattr(os, 'fork'):
61 if not util.safehasattr(os, 'fork'):
62 62 sys.stdout = util.popen(p, 'wb')
63 63 if util.isatty(sys.stderr):
64 64 sys.stderr = sys.stdout
@@ -36,7 +36,8 b' def relink(ui, repo, origin=None, **opts'
36 36 command is running. (Both repositories will be locked against
37 37 writes.)
38 38 """
39 if not hasattr(util, 'samefile') or not hasattr(util, 'samedevice'):
39 if (not util.safehasattr(util, 'samefile') or
40 not util.safehasattr(util, 'samedevice')):
40 41 raise util.Abort(_('hardlinks are not supported on this system'))
41 42 src = hg.repository(ui, ui.expandpath(origin or 'default-relink',
42 43 origin or 'default'))
General Comments 0
You need to be logged in to leave comments. Login now