Mercurial > hg-stable
comparison hgext/fsmonitor/watchmanclient.py @ 50951:d718eddf01d9
safehasattr: drop usage in favor of hasattr
The two functions should now be equivalent at least in their usage in core.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 31 Aug 2023 23:56:15 +0200 |
parents | 642e31cb55f0 |
children |
comparison
equal
deleted
inserted
replaced
50950:7a8ea1397816 | 50951:d718eddf01d9 |
---|---|
67 if self._watchmanclient is not None: | 67 if self._watchmanclient is not None: |
68 self._watchmanclient.setTimeout(timeout) | 68 self._watchmanclient.setTimeout(timeout) |
69 | 69 |
70 def getcurrentclock(self): | 70 def getcurrentclock(self): |
71 result = self.command(b'clock') | 71 result = self.command(b'clock') |
72 if not util.safehasattr(result, 'clock'): | 72 if not hasattr(result, 'clock'): |
73 raise Unavailable( | 73 raise Unavailable( |
74 b'clock result is missing clock value', invalidate=True | 74 b'clock result is missing clock value', invalidate=True |
75 ) | 75 ) |
76 return result.clock | 76 return result.clock |
77 | 77 |