comparison mercurial/lock.py @ 36640:c77c925987d7

py3: pass a system-string filename to sub-classes of IOError
author Yuya Nishihara <yuya@tcha.org>
date Sat, 03 Mar 2018 10:08:13 -0500
parents c303eda316be
children f6efb3c08c19
comparison
equal deleted inserted replaced
36639:334da951a50b 36640:c77c925987d7
196 self._parentheld = True 196 self._parentheld = True
197 self.held = 1 197 self.held = 1
198 return 198 return
199 locker = self._testlock(locker) 199 locker = self._testlock(locker)
200 if locker is not None: 200 if locker is not None:
201 raise error.LockHeld(errno.EAGAIN, 201 raise error.LockHeld(
202 self.vfs.join(self.f), self.desc, 202 errno.EAGAIN,
203 locker) 203 encoding.strfromlocal(self.vfs.join(self.f)),
204 self.desc, locker)
204 else: 205 else:
205 raise error.LockUnavailable(why.errno, why.strerror, 206 raise error.LockUnavailable(why.errno, why.strerror,
206 why.filename, self.desc) 207 why.filename, self.desc)
207 208
208 if not self.held: 209 if not self.held:
209 # use empty locker to mean "busy for frequent lock/unlock 210 # use empty locker to mean "busy for frequent lock/unlock
210 # by many processes" 211 # by many processes"
211 raise error.LockHeld(errno.EAGAIN, 212 raise error.LockHeld(errno.EAGAIN,
212 self.vfs.join(self.f), self.desc, "") 213 encoding.strfromlocal(self.vfs.join(self.f)),
214 self.desc, "")
213 215
214 def _readlock(self): 216 def _readlock(self):
215 """read lock and return its value 217 """read lock and return its value
216 218
217 Returns None if no lock exists, pid for old-style locks, and host:pid 219 Returns None if no lock exists, pid for old-style locks, and host:pid