##// END OF EJS Templates
eol: handle LockUnavailable error (issue2569)...
Martin Geisler -
r13475:c7bef25c stable
parent child Browse files
Show More
@@ -82,7 +82,7 b' used.'
82 """
82 """
83
83
84 from mercurial.i18n import _
84 from mercurial.i18n import _
85 from mercurial import util, config, extensions, match
85 from mercurial import util, config, extensions, match, error
86 import re, os
86 import re, os
87
87
88 # Matches a lone LF, i.e., one that is not part of CRLF.
88 # Matches a lone LF, i.e., one that is not part of CRLF.
@@ -254,13 +254,16 b' def reposetup(ui, repo):'
254 for f, e in self.dirstate._map.iteritems():
254 for f, e in self.dirstate._map.iteritems():
255 self.dirstate._map[f] = (e[0], e[1], -1, 0)
255 self.dirstate._map[f] = (e[0], e[1], -1, 0)
256 self.dirstate._dirty = True
256 self.dirstate._dirty = True
257 # Touch the cache to update mtime. TODO: are we sure this
257 # Touch the cache to update mtime.
258 # always enought to update the mtime, or should we write a
259 # bit to the file?
260 self.opener("eol.cache", "w").close()
258 self.opener("eol.cache", "w").close()
261 finally:
259 wlock.release()
262 if wlock is not None:
260 except error.LockUnavailable:
263 wlock.release()
261 # If we cannot lock the repository and clear the
262 # dirstate, then a commit might not see all files
263 # as modified. But if we cannot lock the
264 # repository, then we can also not make a commit,
265 # so ignore the error.
266 pass
264
267
265 def commitctx(self, ctx, error=False):
268 def commitctx(self, ctx, error=False):
266 for f in sorted(ctx.added() + ctx.modified()):
269 for f in sorted(ctx.added() + ctx.modified()):
@@ -383,3 +383,18 b' Mixed tests'
383 % hg commit
383 % hg commit
384 % hg status
384 % hg status
385 $ rm -r mixed
385 $ rm -r mixed
386
387 Test issue2569 -- eol extension takes write lock on reading:
388
389 $ echo '[extensions]' >> $HGRCPATH
390 $ echo 'eol =' >> $HGRCPATH
391 $ hg init repo
392 $ cd repo
393 $ touch .hgeol
394 $ hg status
395 ? .hgeol
396 $ chmod -R -w .hg
397 $ sleep 1
398 $ touch .hgeol
399 $ hg status --traceback
400 ? .hgeol
General Comments 0
You need to be logged in to leave comments. Login now