[Commented On] D11488: dirstate: Don’t drop unrelated data in DirstateMap::set_entry

SimonSapin phabricator at mercurial-scm.org
Thu Sep 23 15:42:35 UTC 2021


SimonSapin added a comment.


  This is called by `dirstatemap.py`:
  
  - In `set_tracked` when an entry already existed but wasn’t tracked (for example `hg add` just after `hg rm`)
  - In `set_possibly_dirty`
  - In `__setitem__`
  - (And in `set_clean`, but that one also calls `copymap().pop(filename)` anyway)
  
  So my guess as to why no test was affected is that this isn’t called super often, and most tests don’t also check copy tracing information. It would be good to have a CLI-level integration test that’s affected by this but I don’t know how to make one. When and how are used copy source info stored in the dirstate?
  
  I would not be in favor of adding dirstatemap.py unit tests (at least at the moment) because it’s an internal API that keep changing. As to a low-level unit test for this specific `DirstateMap::set_entry` Rust method, I feel it could only be trivial like "1. Do X 2. Check X is done" and not helpful at finding actual bugs. What matters here is what semantics are expected or not by callers.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11488/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11488

To: SimonSapin, #hg-reviewers
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210923/e899b511/attachment-0002.html>


More information about the Mercurial-patches mailing list