Mon, 03 May 2021 12:28:36 +0200 revlog: only use the `_indexfp` method for read operation
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 12:28:36 +0200] rev 47219
revlog: only use the `_indexfp` method for read operation This will avoid "other" code to not overlook `_writing` usage. We introduces private method dedicated to writing to make use the right option are always used. Differential Revision: https://phab.mercurial-scm.org/D10610
Mon, 03 May 2021 12:28:26 +0200 revlog: use `_writing` in `rewrite_sidedata`
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 12:28:26 +0200] rev 47218
revlog: use `_writing` in `rewrite_sidedata` Special cases aren't special enough to break the rules. Differential Revision: https://phab.mercurial-scm.org/D10609
Mon, 03 May 2021 12:28:15 +0200 revlog: open files in 'r+' instead of 'a+'
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 12:28:15 +0200] rev 47217
revlog: open files in 'r+' instead of 'a+' The code doing actual writing is already doing the necessary seeking, so we could safely use 'r+'. This make the file objecs usable in more situation, like updating the sidedata information during pull. revlog: forcibly move the file cursor at the right location before writing This is a paranoid change in case the changelog computation moved the cursors under our feets. This is not known to happens right now. Differential Revision: https://phab.mercurial-scm.org/D10608
Mon, 03 May 2021 12:28:05 +0200 revlog: pass a transaction object to `rewrite_sidedata`
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 12:28:05 +0200] rev 47216
revlog: pass a transaction object to `rewrite_sidedata` The `_writing` context need one, so we update the function signature before considering using `_writing` in rewrite_sidedata. Differential Revision: https://phab.mercurial-scm.org/D10607
Mon, 03 May 2021 12:27:53 +0200 revlog: rename variable in `rewrite_sidedata` to match other code
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 12:27:53 +0200] rev 47215
revlog: rename variable in `rewrite_sidedata` to match other code Let's call the index file object and `ifh` and the data file object `dfh` as the rest of the revlog code. This will make future change clearer. Differential Revision: https://phab.mercurial-scm.org/D10606
Mon, 03 May 2021 12:27:42 +0200 revlog: introduce a mandatory `_writing` context to update revlog content
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 03 May 2021 12:27:42 +0200] rev 47214
revlog: introduce a mandatory `_writing` context to update revlog content Before this change, various revlog methods where managing the opening and closing of the revlog files manually and passing the file descriptor alors the call path. To simplify the tracking of the write operation by a future docket, we need something more organised. As a result, we introduce a `revlog._writing` context manager that will wrap each revlog update operation. The file descriptor are kept in the existing `revlog._writinghandles` parameter that was already used by the `addgroup` logic. All this change is internal to the revlog only, the "public" interface is not affected. The `addrevision` and `addgroup` logic are still responsible for setup up this context. However this new context give us multiple benefits: * all writer use a same, unified, logic, * this context is programmatically enforced, * each write "session" as a clearly identified start and end. The post-pull sidedata update logic is still doing writing by end and will be adjusted in a later changesets. This change affect the concurrency checker test, because register the state of the file in the transaction sooner in `addrevision` (about as early as what `addgroup` would do), so the abort is rollbacking the other commit. I don't want to weaken the current main logic. Differential Revision: https://phab.mercurial-scm.org/D10605
(0) -30000 -10000 -3000 -1000 -300 -100 -30 -10 -6 +6 +10 +30 +100 +300 +1000 +3000 tip