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