Rustext's DirstateItem has no attribute 'v2_data', fsmonitor tries to access it.

Sietse Brouwer sbbrouwer at gmail.com
Sun Oct 22 23:16:34 UTC 2023


Hello everyone,

I am writing about an AttributeError caused by fsmonitor trying to access
someDirstateItem.v2_data(), which is not exposed by
`mercurial.rustext.dirstate.DirstateItem` (but is exposed by
`mercurial.pure.parsers.DirstateItem`). Steps to reproduce and some
investigation below this e-mail.

I'll file a bug and try my hand at a fix, but first I have a question: does
anybody know which module it is that needs fixing?
- is hgext/fsmonitor/__init__.py wrong to try to access
DirStateItem.v2_data()?
- Or is rust/hg-cpython/src/dirstate/item.rs:DirstateItem wrong in that it
lacks a method `v2_data`, when its Python counterpart has it?

Kind regards,
Sietse
Sietse Brouwer

Steps to reproduce:

    hg clone https://www.mercurial-scm.org/repo/hg-stable
    cd hg-stable
    hg up 6.5.2   # latest; but bug exists at least from 6.4.4
    make PURE=--rust local
    HGRCPATH= ./hg --config 'extensions.fsmonitor=' diff "set:tracked()"

    # The above gives a long traceback that ends in
      File "/home/sbrouwer/lib/mercurial-main/hgext/fsmonitor/__init__.py",
line 354, in <setcomp>
        or bool((e.v2_data()[0] & mask) ^ has_mtime)
    AttributeError: 'mercurial.rustext.dirstate.DirstateItem' object has no
attribute 'v2_data'

Further investigation:

- error goes away when building with `make PURE=--pure local`
- error goes away when the extension fsmonitor is disabled
- error is not affected by turning repo dirstate storage format v2 on/off
(via `hg debugupgrade --config format.use-dirstate-v2=1 --run` to turn on,
or =0 to turn off.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20231023/70331d3a/attachment.html>


More information about the Mercurial-devel mailing list