# HG changeset patch
# User Pierre-Yves David <pierre-yves.da...@ens-lyon.org>
# Date 1476359267 -7200
#      Thu Oct 13 13:47:47 2016 +0200
# Node ID db0b3bc2e7ae19973240275fb9e3f964ecdeb019
# Parent  88cc944830d0c1895e527d6ca13687f1d5e1c785
eol: make sure we always release the wlock when writing cache

If any exception were to happen after we acquired the wlock, we could leave it
unreleased. We move the wlock release in a 'finally:' close as it should be.

diff --git a/hgext/eol.py b/hgext/eol.py
--- a/hgext/eol.py
+++ b/hgext/eol.py
@@ -360,7 +360,6 @@ def reposetup(ui, repo):
                     # Write the cache to update mtime and cache .hgeol
                     with self.vfs("eol.cache", "w") as f:
-                    wlock.release()
                 except error.LockUnavailable:
                     # If we cannot lock the repository and clear the
                     # dirstate, then a commit might not see all files
@@ -368,6 +367,9 @@ def reposetup(ui, repo):
                     # repository, then we can also not make a commit,
                     # so ignore the error.
+                finally:
+                    if wlock is not None:
+                        wlock.release()
         def commitctx(self, ctx, haserror=False):
             for f in sorted(ctx.added() + ctx.modified()):
Mercurial-devel mailing list

Reply via email to