Subject: Re: bug#79024: 31.0.50; Multiple working trees support for VC

From: Spencer Baugh <[email-masked]>
Date: Wed, 23 Jul 2025 13:08:28 -0400

Sean Whitton <[email-masked]> writes:

> Hello,
>
> On Fri 18 Jul 2025 at 10:36am +01, Sean Whitton wrote:
>
>> Dmitry, what do you think about a new project-prompter-predicate which
>> project prompters should use to filter the list of projects offered?  VC
>> could bind that to something which only lets through related worktrees.
>
> I've got a second extension of project.el to ask about.
>
> Mercurial doesn't maintain records of shared repositories.
> The first repository knows nothing about shares created from it, and
> each share only has a reference back to the first repository.
>
> Therefore, to support the VC API for other working trees, Emacs needs to
> maintain records of its own about other working trees for Mercurial
> repositories.
>
> Initially I'll implement this by just looking it up each time but that
> will get slow.  project--list's docstring talks about storing metadata
> there.  Could I perhaps treat the entries in project--list as plists or
> alists, and push some entries there?  I could use symbols with a vc--
> prefix as the keys into the lists, indicating this is not data that
> project.el itself should have much to do with?  Or what do you think?

IMO it would be fine to just look this up each time.

The predicate passed to project-prompter would take the root directory
of the project and decide whether that should be included in the prompt;
and for hg shares, that would just be looking at .hg/sharedpath and
checking if it has the right contents.  I think that one filesystem
access is an acceptable cost, I don't think Emacs will need to maintain
records of its own beyond the existing project--list.