Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bookmarks.py @ 48699:21ac6aedd5e5
transaction: do not rely on a global variable to post_finalize file
We can just add a new argument to the `addfilegenerator` function. This is more
explicit and therefor clearer and less error prone.
Differential Revision: https://phab.mercurial-scm.org/D12125
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 31 Jan 2022 18:38:15 +0100 |
parents | dfbfa802876b |
children | 6000f5b25c9b |
line wrap: on
line diff
--- a/mercurial/bookmarks.py Mon Jan 31 08:44:48 2022 +0100 +++ b/mercurial/bookmarks.py Mon Jan 31 18:38:15 2022 +0100 @@ -212,7 +212,11 @@ The transaction is then responsible for updating the file content.""" location = b'' if bookmarksinstore(self._repo) else b'plain' tr.addfilegenerator( - b'bookmarks', (b'bookmarks',), self._write, location=location + b'bookmarks', + (b'bookmarks',), + self._write, + location=location, + post_finalize=True, ) tr.hookargs[b'bookmark_moved'] = b'1'