Skip to content

Draft: [DO-NOT-MERGE] dirstate: fixed bug with the wrongly used check_invalidated wrapper

Denis Matsiusheuski requested to merge topic/default/dirstate-fix into branch/default

The goal of this MR is to fix the bug in the dirstate connected to the wrongly used check_invalidated wrapper.

The requires_changing_files_or_status decorator wrongly used the check_invalidated wrapper. One checked condition in the requires_changing_files_or_status is the "self._running_status > 0". At the same time the "self._running_status > 0" can lead to invalidated context, and check_invalidated raises the error in this case. Thus the check_invalidated should not be used in requires_changing_files_or_status.

Because of this bug it is not possible to use Mercurial API with repositories with largefiles extensions. For instance see the bug in TortoiseHg: mercurial/tortoisehg/thg#5892 (closed).

Simple test case to reproduce the bug:

  1. Unpack the test_mercurial_api.zip archive. It contains the test_mercurial_api.py script and rep1 repository.
  2. Run the test_mercurial_api.py. It fails with the error: mercurial.error.ProgrammingError: calling wrap after the dirstate was invalidated. Notes:
  • Note that the repo1 repository uses the largefiles extension.
  • Note that the bug is reproduced on Windows (I used Windows 11 Pro). I couldn't reproduce it on Ubuntu 22.04.2.

Merge request reports

Loading