On 10/23/23 01:16, Sietse Brouwer wrote:
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.
Thanks for reporting this, fsmonitor is untested and not something we
recommend mixing with Rust (because Rust is tested should give you the
performance you're looking for without the flakiness). Can I ask why
you're using fsmonitor?
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?
I wrote this "fix" when we reworked the dirstate API because people at
Mozilla use fsmonitor but without the Rust extensions, and we'd broken
their workflow. I didn't realize we didn't expose the same interface
from the Rust entry, but I'm not surprised, since it shouldn't be
exposed past the serialization or FFI layers.
IMO what needs fixing is fsmonitor. It should use the public API until
we figure out that accessing `not e.has_time or e.has_ambiguous_time` is
slower than the bitmask hack I used last time.
Do you want to send the fix, or should I do it?
I hope this helps,
Raphaël
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.)
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@lists.mercurial-scm.org
https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@lists.mercurial-scm.org
https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel