Subject: Re: bug#62663: 28.2; vc-hg-state returns incorrect results on directories in some repos

From: Dmitry Gutov <[email-masked]>
Date: Thu, 13 Apr 2023 03:44:30 +0300

Hi! Thanks for the report.

On 04/04/2023 17:05, Spencer Baugh wrote:
> The problem is with vc-hg-state-fast, which parses Mercurial data
> structures instead of shelling out to hg.  This is a great idea but our
> parsing seems to be wrong right now in some way.
> 
> 1. Create a new hg repo with:
> 
> hg init
>    --config format.use_share_safe=false
>    --config format.use-persistent-nodemap=false
>    --config format.sparse-revlog=false
>    --config format.revlog-compression=zlib
> 
> (This is disabling some recent hg features which make vc-hg-state use
> the slow path.  You can verify that vc-hg-state-fast is going to run by
> checking that .hg/requirements is a subset of
> vc-hg-supported-requirements)
> 
> 2. touch foo && hg add foo && hg commit -m.
> 3. (vc-hg-state-slow ".")
> Returns 'up-to-date which is correct (because it shells out to hg)
> 4. (vc-hg-state ".")
> Returns 'unregistered which is wrong
> 
> To a user, this manifests as various hg commands failing with errors,
> often something like
> "vc-find-backend-function: Cannot open load file: No such file or directory, vc-nil"
> 
> This also happens on Emacs 29.
> 
> (Note that this is independent of my other bug about lack of support for
> certain repo requirements.  That bug is about expanding vc-hg-state-fast
> support to new repos; this bug is showing that the already existing
> support is buggy!)

Patches are welcome, of course.

I'm going to Cc the original author of that code, but that's just for 
courtesy.