Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 20380:c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
A message like this was sometimes shown when pushing:
remote: waiting for lock on repository foo held by 'mercurial:20858'
That could scare users, making them wonder whether the push actually succeeded.
To mitigate that fear, issue an additional "warning" such as:
got lock after 2 seconds
The return value from lock.lock.lock() was unused - instead we return the
delay.
This also adds the first test coverage for waiting for locks.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 06 Feb 2014 01:55:09 +0100 |
parents | a6cf48b2880d |
children | d4f804caa0ed |
comparison
equal
deleted
inserted
replaced
20379:b75a04502ced | 20380:c697b70f295f |
---|---|
1003 (desc, inst.locker)) | 1003 (desc, inst.locker)) |
1004 # default to 600 seconds timeout | 1004 # default to 600 seconds timeout |
1005 l = lockmod.lock(vfs, lockname, | 1005 l = lockmod.lock(vfs, lockname, |
1006 int(self.ui.config("ui", "timeout", "600")), | 1006 int(self.ui.config("ui", "timeout", "600")), |
1007 releasefn, desc=desc) | 1007 releasefn, desc=desc) |
1008 self.ui.warn(_("got lock after %s seconds\n") % l.delay) | |
1008 if acquirefn: | 1009 if acquirefn: |
1009 acquirefn() | 1010 acquirefn() |
1010 return l | 1011 return l |
1011 | 1012 |
1012 def _afterlock(self, callback): | 1013 def _afterlock(self, callback): |