This will make my next patch simpler.
Details
Details
Diff Detail
Diff Detail
- Repository
 - rHG Mercurial
 - Lint
 Lint Skipped - Unit
 Unit Tests Skipped 
( )
This will make my next patch simpler.
| Lint Skipped | 
| Unit Tests Skipped | 
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/fsmonitor/__init__.py (2 lines) | |||
| M | hgext/fsmonitor/watchmanclient.py (8 lines) | 
| Commit | Parents | Author | Summary | Date | 
|---|---|---|---|---|
| 7a19a2c8be97 | 12addcc7956c | Augie Fackler | Jul 23 2019, 2:36 PM | 
| if repo_has_depth_one_nested_repo(repo): | if repo_has_depth_one_nested_repo(repo): | ||||
| return | return | ||||
| fsmonitorstate = state.state(repo) | fsmonitorstate = state.state(repo) | ||||
| if fsmonitorstate.mode == 'off': | if fsmonitorstate.mode == 'off': | ||||
| return | return | ||||
| try: | try: | ||||
| client = watchmanclient.client(repo) | client = watchmanclient.client(repo.ui, repo._root) | ||||
| except Exception as ex: | except Exception as ex: | ||||
| _handleunavailable(ui, fsmonitorstate, ex) | _handleunavailable(ui, fsmonitorstate, ex) | ||||
| return | return | ||||
| repo._fsmonitorstate = fsmonitorstate | repo._fsmonitorstate = fsmonitorstate | ||||
| repo._watchmanclient = client | repo._watchmanclient = client | ||||
| dirstate, cached = localrepo.isfilecached(repo, 'dirstate') | dirstate, cached = localrepo.isfilecached(repo, 'dirstate') | ||||
| return 'Watchman unavailable: %s' % self.msg | return 'Watchman unavailable: %s' % self.msg | ||||
| class WatchmanNoRoot(Unavailable): | class WatchmanNoRoot(Unavailable): | ||||
| def __init__(self, root, msg): | def __init__(self, root, msg): | ||||
| self.root = root | self.root = root | ||||
| super(WatchmanNoRoot, self).__init__(msg) | super(WatchmanNoRoot, self).__init__(msg) | ||||
| class client(object): | class client(object): | ||||
| def __init__(self, repo, timeout=1.0): | def __init__(self, ui, root, timeout=1.0): | ||||
| err = None | err = None | ||||
| if not self._user: | if not self._user: | ||||
| err = "couldn't get user" | err = "couldn't get user" | ||||
| warn = True | warn = True | ||||
| if self._user in repo.ui.configlist('fsmonitor', 'blacklistusers'): | if self._user in ui.configlist('fsmonitor', 'blacklistusers'): | ||||
| err = 'user %s in blacklist' % self._user | err = 'user %s in blacklist' % self._user | ||||
| warn = False | warn = False | ||||
| if err: | if err: | ||||
| raise Unavailable(err, warn) | raise Unavailable(err, warn) | ||||
| self._timeout = timeout | self._timeout = timeout | ||||
| self._watchmanclient = None | self._watchmanclient = None | ||||
| self._root = repo.root | self._root = root | ||||
| self._ui = repo.ui | self._ui = ui | ||||
| self._firsttime = True | self._firsttime = True | ||||
| def settimeout(self, timeout): | def settimeout(self, timeout): | ||||
| self._timeout = timeout | self._timeout = timeout | ||||
| if self._watchmanclient is not None: | if self._watchmanclient is not None: | ||||
| self._watchmanclient.setTimeout(timeout) | self._watchmanclient.setTimeout(timeout) | ||||
| def getcurrentclock(self): | def getcurrentclock(self): | ||||