Mercurial > hg
comparison mercurial/bookmarks.py @ 48685: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 |
comparison
equal
deleted
inserted
replaced
48684:568f63b5a30f | 48685:21ac6aedd5e5 |
---|---|
210 """record that bookmarks have been changed in a transaction | 210 """record that bookmarks have been changed in a transaction |
211 | 211 |
212 The transaction is then responsible for updating the file content.""" | 212 The transaction is then responsible for updating the file content.""" |
213 location = b'' if bookmarksinstore(self._repo) else b'plain' | 213 location = b'' if bookmarksinstore(self._repo) else b'plain' |
214 tr.addfilegenerator( | 214 tr.addfilegenerator( |
215 b'bookmarks', (b'bookmarks',), self._write, location=location | 215 b'bookmarks', |
216 (b'bookmarks',), | |
217 self._write, | |
218 location=location, | |
219 post_finalize=True, | |
216 ) | 220 ) |
217 tr.hookargs[b'bookmark_moved'] = b'1' | 221 tr.hookargs[b'bookmark_moved'] = b'1' |
218 | 222 |
219 def _writerepo(self, repo): | 223 def _writerepo(self, repo): |
220 """Factored out for extensibility""" | 224 """Factored out for extensibility""" |