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