Show More
@@ -498,8 +498,7 b' class UnknownVersion(Abort):' | |||||
498 |
|
498 | |||
499 | class LockError(IOError): |
|
499 | class LockError(IOError): | |
500 | def __init__(self, errno, strerror, filename, desc): |
|
500 | def __init__(self, errno, strerror, filename, desc): | |
501 | # TODO: figure out if this should be bytes or str |
|
501 | # _type: (int, str, bytes, bytes) -> None | |
502 | # _type: (int, str, str, bytes) -> None |
|
|||
503 | IOError.__init__(self, errno, strerror, filename) |
|
502 | IOError.__init__(self, errno, strerror, filename) | |
504 | self.desc = desc |
|
503 | self.desc = desc | |
505 |
|
504 | |||
@@ -508,7 +507,7 b' class LockError(IOError):' | |||||
508 |
|
507 | |||
509 | class LockHeld(LockError): |
|
508 | class LockHeld(LockError): | |
510 | def __init__(self, errno, filename, desc, locker): |
|
509 | def __init__(self, errno, filename, desc, locker): | |
511 |
LockError.__init__(self, errno, |
|
510 | LockError.__init__(self, errno, 'Lock held', filename, desc) | |
512 | self.locker = locker |
|
511 | self.locker = locker | |
513 |
|
512 | |||
514 |
|
513 |
@@ -12,6 +12,7 b' import os' | |||||
12 | import signal |
|
12 | import signal | |
13 | import socket |
|
13 | import socket | |
14 | import time |
|
14 | import time | |
|
15 | import typing | |||
15 | import warnings |
|
16 | import warnings | |
16 |
|
17 | |||
17 | from .i18n import _ |
|
18 | from .i18n import _ | |
@@ -154,8 +155,12 b' def trylock(ui, vfs, lockname, timeout, ' | |||||
154 | if delay == warningidx: |
|
155 | if delay == warningidx: | |
155 | printwarning(ui.warn, inst.locker) |
|
156 | printwarning(ui.warn, inst.locker) | |
156 | if timeout <= delay: |
|
157 | if timeout <= delay: | |
|
158 | assert isinstance(inst.filename, bytes) | |||
157 | raise error.LockHeld( |
|
159 | raise error.LockHeld( | |
158 |
errno.ETIMEDOUT, |
|
160 | errno.ETIMEDOUT, | |
|
161 | typing.cast(bytes, inst.filename), | |||
|
162 | l.desc, | |||
|
163 | inst.locker, | |||
159 | ) |
|
164 | ) | |
160 | time.sleep(1) |
|
165 | time.sleep(1) | |
161 | delay += 1 |
|
166 | delay += 1 | |
@@ -290,8 +295,13 b' class lock:' | |||||
290 | locker, |
|
295 | locker, | |
291 | ) |
|
296 | ) | |
292 | else: |
|
297 | else: | |
|
298 | assert isinstance(why.filename, bytes) | |||
|
299 | assert isinstance(why.strerror, str) | |||
293 | raise error.LockUnavailable( |
|
300 | raise error.LockUnavailable( | |
294 |
why.errno, |
|
301 | why.errno, | |
|
302 | why.strerror, | |||
|
303 | typing.cast(bytes, why.filename), | |||
|
304 | self.desc, | |||
295 | ) |
|
305 | ) | |
296 |
|
306 | |||
297 | if not self.held: |
|
307 | if not self.held: |
@@ -243,7 +243,7 b' class statichttprepository(' | |||||
243 | def wlock(self, wait=True): |
|
243 | def wlock(self, wait=True): | |
244 | raise error.LockUnavailable( |
|
244 | raise error.LockUnavailable( | |
245 | 0, |
|
245 | 0, | |
246 | _(b'lock not available'), |
|
246 | pycompat.sysstr(_(b'lock not available')), | |
247 | b'lock', |
|
247 | b'lock', | |
248 | _(b'cannot lock static-http repository'), |
|
248 | _(b'cannot lock static-http repository'), | |
249 | ) |
|
249 | ) | |
@@ -251,7 +251,7 b' class statichttprepository(' | |||||
251 | def lock(self, wait=True): |
|
251 | def lock(self, wait=True): | |
252 | raise error.LockUnavailable( |
|
252 | raise error.LockUnavailable( | |
253 | 0, |
|
253 | 0, | |
254 | _(b'lock not available'), |
|
254 | pycompat.sysstr(_(b'lock not available')), | |
255 | b'lock', |
|
255 | b'lock', | |
256 | _(b'cannot lock static-http repository'), |
|
256 | _(b'cannot lock static-http repository'), | |
257 | ) |
|
257 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now