Mercurial > hg
comparison mercurial/bookmarks.py @ 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 | aa323b53e3f9 |
children | 46dec89fe888 |
comparison
equal
deleted
inserted
replaced
26030:5243890224ff | 26031:0b57b77f9b3e |
---|---|
88 | 88 |
89 We also store a backup of the previous state in undo.bookmarks that | 89 We also store a backup of the previous state in undo.bookmarks that |
90 can be copied back on rollback. | 90 can be copied back on rollback. |
91 ''' | 91 ''' |
92 repo = self._repo | 92 repo = self._repo |
93 if (repo.ui.configbool('devel', 'all-warnings') | |
94 or repo.ui.configbool('devel', 'check-locks')): | |
95 l = repo._wlockref and repo._wlockref() | |
96 if l is None or not l.held: | |
97 repo.ui.develwarn('bookmarks write with no wlock') | |
93 self._writerepo(repo) | 98 self._writerepo(repo) |
94 repo.invalidatevolatilesets() | 99 repo.invalidatevolatilesets() |
95 | 100 |
96 def _writerepo(self, repo): | 101 def _writerepo(self, repo): |
97 """Factored out for extensibility""" | 102 """Factored out for extensibility""" |