# HG changeset patch # User Yuya Nishihara # Date 1429280578 -32400 # Node ID 61aea11fb83dd661dc47000ef2b96955d323d068 # Parent 82fe5721302973f90b594239772a05f447c493aa tags: do not abort if failed to write lock file to save cache LockHeld wasn't enough to suppress error during acquiring lock. If .hg directory is read-only, LockUnavailable will be raised. $ chmod ugo-w .hg $ hg identify abort: could not lock working directory of ...: Permission denied diff -r 82fe57213029 -r 61aea11fb83d mercurial/tags.py --- a/mercurial/tags.py Thu Apr 16 20:58:41 2015 -0500 +++ b/mercurial/tags.py Fri Apr 17 23:22:58 2015 +0900 @@ -502,9 +502,9 @@ try: lock = repo.wlock(wait=False) - except error.LockHeld: + except error.LockError: repo.ui.log('tagscache', - 'not writing .hg/%s because lock held\n' % + 'not writing .hg/%s because lock cannot be acquired\n' % (_fnodescachefile)) return diff -r 82fe57213029 -r 61aea11fb83d tests/test-tags.t --- a/tests/test-tags.t Thu Apr 16 20:58:41 2015 -0500 +++ b/tests/test-tags.t Fri Apr 17 23:22:58 2015 +0900 @@ -114,7 +114,7 @@ 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...| 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y| -And again, but now unable to write tag cache: +And again, but now unable to write tag cache or lock file: #if unix-permissions $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1 @@ -122,6 +122,11 @@ $ hg identify b9154636be93 tip $ chmod 755 .hg/cache + + $ chmod 555 .hg + $ hg identify + b9154636be93 tip + $ chmod 755 .hg #endif Tag cache debug info written to blackbox log @@ -144,7 +149,7 @@ b9154636be93 tip $ hg blackbox -l 5 1970/01/01 00:00:00 bob> identify - 1970/01/01 00:00:00 bob> not writing .hg/cache/hgtagsfnodes1 because lock held + 1970/01/01 00:00:00 bob> not writing .hg/cache/hgtagsfnodes1 because lock cannot be acquired 1970/01/01 00:00:00 bob> 0/1 cache hits/lookups in * seconds (glob) 1970/01/01 00:00:00 bob> writing .hg/cache/tags2-visible with 1 tags 1970/01/01 00:00:00 bob> identify exited 0 after * seconds (glob)