( )⚙ D11686 dirstate: add a concept of "fallback" flags to dirstate item

This is an archive of the discontinued Mercurial Phabricator instance.

dirstate: add a concept of "fallback" flags to dirstate item
ClosedPublic

Authored by marmoute on Oct 18 2021, 9:20 PM.

Details

Summary

The concept is defined and "used" by the flag code, but it is neither persisted
nor set anywhere yet. We currently focus on defining the semantic of the
attribute. More to come in the next changesets

Check the inline documentation for details.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

marmoute created this revision.Oct 18 2021, 9:20 PM

Nice! I'd love an experimental UI for this if this is the last py2 release, but even if it's just used in the background so that rebasing/amending added files stops dropping these bits, it would be a major benefit.

I glossed over the rust code, so if someone familiar with it could make a pass, I'd appreciate it.

mercurial/dirstate.py
295–296

Is there a reason we don't need a similar elif for exec in the symlink case above? (What if there's a symlink fallback, but not exec fallback?)

Also, is symlink and exec mutually exclusive? I'd think not for the platforms where it's read from the filesystem, but maybe that's sanitized away somewhere?

mercurial/pure/parsers.py
291

/True is/ True if/ (same issue below for symlink function)

324

This cast ends up masking out the None, which is not what has_fallback_exec seems to expect. Or am I misunderstanding? (Same comment for symlink below)

Alphare requested changes to this revision.Oct 19 2021, 4:15 AM
Alphare added a subscriber: Alphare.

Adding my comments on top of Matt's.

mercurial/cext/parsers.c
512

Why are these called *_get_has_*? Is it a convention or just accidental?

rust/hg-core/src/dirstate/entry.rs
25

Shouldn't those be in the flags in the form of 4 total bits?

This revision now requires changes to proceed.Oct 19 2021, 4:15 AM
marmoute marked an inline comment as done.Oct 19 2021, 7:36 AM

Nice! I'd love an experimental UI for this if this is the last py2 release,

I am not sure 6.0 would be the last py2 release since we still do not have python3 packaging for TortoiseHG …

but even if it's just used in the background so that rebasing/amending added files stops dropping these bits, it would be a major benefit.

I do not think we will have the time to do more than implement basic flag semantic in 6.0. Putting them to use will have to wait until 6.1 am I afraid.

I glossed over the rust code, so if someone familiar with it could make a pass, I'd appreciate it.

mercurial/cext/parsers.c
512

This is the getter of the has_fallback_xxx property. So the name is legitimate.

mercurial/dirstate.py
295–296

The "FS" code return l regarless of the x status if this is a symlink. The logic you comment comply with that. If we have a symlink_fallback but no symlink_flag, we still need to check for x. However if we have fallback for both but non set, we know we have no flag.

mercurial/pure/parsers.py
324

good catch, thanks.

rust/hg-core/src/dirstate/entry.rs
25

Yes they should. I remember thinking about it, but apparently then forgot about that.

Fixing it.

marmoute updated this revision to Diff 30891.Oct 19 2021, 7:49 AM
Alphare accepted this revision.Oct 19 2021, 8:12 AM
This revision is now accepted and ready to land.Oct 19 2021, 8:12 AM