D7118: rust-dirstatemap: remove additional lookups in traverse

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Fri Oct 18 08:40:46 EDT 2019


yuja added a comment.


  >   >> +++ b/mercurial/dirstate.py
  >   >> @@ -919,6 +919,9 @@
  >   >>
  >   >>   matchalways = match.always()
  >   >>   matchtdir = match.traversedir
  >   >>   dmap = self._map
  >   >>
  >   >> +        if rustmod is not None:
  >   >> +            dmap = self._map._rustmap
  >   >
  >   > If it's the same trick, can't it be abstracted away? `if rustmod` seems weird.
  >   The main issue I faced is that Python classes built from `rust-cpython` cannot be subclassed, so we have to resort to an additional level of indirection. IIRC, the main reason was that there was no way of enforcing a subclass to call `super()` which would result in the Rust class not being initialized properly. Or maybe I'm missing the point?
  
  I mean there could be a unified `self._map._map` call if we need to take
  the internal map from both py dirstatemap and rust dirstatemap.

REPOSITORY
  rHG Mercurial

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

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

To: Alphare, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list