Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 26320:3ac7acb99b04
localrepo: call lock.lock with releasefn as a keyword arg
We'll be adding an acquirefn argument soon, and this makes that clearer.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 22 Sep 2015 13:25:41 -0700 |
parents | 5c0f5db65c6b |
children | db4c192cb9b3 |
comparison
equal
deleted
inserted
replaced
26319:4b9bb1616195 | 26320:3ac7acb99b04 |
---|---|
1208 continue | 1208 continue |
1209 ce.refresh() | 1209 ce.refresh() |
1210 | 1210 |
1211 def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc): | 1211 def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc): |
1212 try: | 1212 try: |
1213 l = lockmod.lock(vfs, lockname, 0, releasefn, desc=desc) | 1213 l = lockmod.lock(vfs, lockname, 0, releasefn=releasefn, desc=desc) |
1214 except error.LockHeld as inst: | 1214 except error.LockHeld as inst: |
1215 if not wait: | 1215 if not wait: |
1216 raise | 1216 raise |
1217 self.ui.warn(_("waiting for lock on %s held by %r\n") % | 1217 self.ui.warn(_("waiting for lock on %s held by %r\n") % |
1218 (desc, inst.locker)) | 1218 (desc, inst.locker)) |
1219 # default to 600 seconds timeout | 1219 # default to 600 seconds timeout |
1220 l = lockmod.lock(vfs, lockname, | 1220 l = lockmod.lock(vfs, lockname, |
1221 int(self.ui.config("ui", "timeout", "600")), | 1221 int(self.ui.config("ui", "timeout", "600")), |
1222 releasefn, desc=desc) | 1222 releasefn=releasefn, desc=desc) |
1223 self.ui.warn(_("got lock after %s seconds\n") % l.delay) | 1223 self.ui.warn(_("got lock after %s seconds\n") % l.delay) |
1224 if acquirefn: | 1224 if acquirefn: |
1225 acquirefn() | 1225 acquirefn() |
1226 return l | 1226 return l |
1227 | 1227 |