Show More
@@ -9,8 +9,14 b' from __future__ import absolute_import' | |||
|
9 | 9 | |
|
10 | 10 | import getpass |
|
11 | 11 | |
|
12 |
from mercurial import |
|
|
13 | from mercurial.utils import procutil | |
|
12 | from mercurial import ( | |
|
13 | encoding, | |
|
14 | util, | |
|
15 | ) | |
|
16 | from mercurial.utils import ( | |
|
17 | procutil, | |
|
18 | stringutil, | |
|
19 | ) | |
|
14 | 20 | |
|
15 | 21 | from . import pywatchman |
|
16 | 22 | |
@@ -23,12 +29,14 b' class Unavailable(Exception):' | |||
|
23 | 29 | self.warn = False |
|
24 | 30 | self.invalidate = invalidate |
|
25 | 31 | |
|
26 |
def __ |
|
|
32 | def __bytes__(self): | |
|
27 | 33 | if self.warn: |
|
28 | 34 | return b'warning: Watchman unavailable: %s' % self.msg |
|
29 | 35 | else: |
|
30 | 36 | return b'Watchman unavailable: %s' % self.msg |
|
31 | 37 | |
|
38 | __str__ = encoding.strmethod(__bytes__) | |
|
39 | ||
|
32 | 40 | |
|
33 | 41 | class WatchmanNoRoot(Unavailable): |
|
34 | 42 | def __init__(self, root, msg): |
@@ -98,10 +106,12 b' class client(object):' | |||
|
98 | 106 | return self._watchmanclient.query(*watchmanargs) |
|
99 | 107 | except pywatchman.CommandError as ex: |
|
100 | 108 | if b'unable to resolve root' in ex.msg: |
|
101 |
raise WatchmanNoRoot( |
|
|
109 | raise WatchmanNoRoot( | |
|
110 | self._root, stringutil.forcebytestr(ex.msg) | |
|
111 | ) | |
|
102 | 112 | raise Unavailable(ex.msg) |
|
103 | 113 | except pywatchman.WatchmanError as ex: |
|
104 | raise Unavailable(str(ex)) | |
|
114 | raise Unavailable(stringutil.forcebytestr(ex)) | |
|
105 | 115 | |
|
106 | 116 | def command(self, *args): |
|
107 | 117 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now