Mercurial > hg
changeset 26031:0b57b77f9b3e
devel-warn: issue a warning when writing bookmarks without holding the wlock
I saw an issue in an extension that we develop where we were writing bookmarks
without holding the wlock. Another extension was taking a lock at the same time
and wiped out the bookmarks we were about to write. This patch adds a
devel-warning to urge people to fix their invalid code.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Sat, 01 Aug 2015 05:43:39 -0700 |
parents | 5243890224ff |
children | a3d5da8b641e |
files | mercurial/bookmarks.py |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bookmarks.py Thu Aug 13 19:37:47 2015 -0500 +++ b/mercurial/bookmarks.py Sat Aug 01 05:43:39 2015 -0700 @@ -90,6 +90,11 @@ can be copied back on rollback. ''' repo = self._repo + if (repo.ui.configbool('devel', 'all-warnings') + or repo.ui.configbool('devel', 'check-locks')): + l = repo._wlockref and repo._wlockref() + if l is None or not l.held: + repo.ui.develwarn('bookmarks write with no wlock') self._writerepo(repo) repo.invalidatevolatilesets()