Subject: bug#63470: [PATCH] Use faster option for running vc-hg status

From: Spencer Baugh <[email-masked]>
Date: Wed, 17 May 2023 07:47:09 -0400

On Wed, May 17, 2023, 07:39 Eli Zaretskii <[email-masked]> wrote:

> > From: Spencer Baugh <[email-masked]>
> > Cc: Dmitry Gutov <[email-masked]>,  [email-masked]
> > Date: Tue, 16 May 2023 16:39:49 -0400
> >
> > Eli Zaretskii <[email-masked]> writes:
> >
> > >> Date: Fri, 12 May 2023 23:10:05 +0300
> > >> Cc: [email-masked]
> > >> From: Dmitry Gutov <[email-masked]>
> > >>
> > >> On 12/05/2023 22:57, Spencer Baugh wrote:
> > >> >
> > >> > I could add a user option to revert to the old behavior, if you
> want.
> > >>
> > >> We could cache it like we do with vc-git--program-version. That's a
> > >> simple memoization that doesn't take the host into account (though
> that
> > >> could be implemented, too).
> > >
> > > Yes, that'd be a good-enough solution.
> > >
> > >> But it'd really make things easier if we're just allowed to rely on
> some
> > >> new enough versions of Git and Hg.
> > >
> > > It isn't easy to be backward-compatible, but we should strive at doing
> > > that.
> >
> > OK, revised backwards-compatible patch attached.
>
> Thanks, but I'd prefer to call the new function only once, and record
> the result in some variable.  We do such things in umpteen other
> places, so it looks strange to test the version each time only in this
> case.
>

Isn't that what I'm doing? I record the version in a variable and only
compute it once.

Also, the way I'm doing it exactly matches how vc-git does it.

Do you mean a variable that controls whether to use the new argument
method? Should the result be computed at load time or at first use of the
variable?

>
> If you are afraid that somehow the version could change while the
> Emacs session runs, we could add a command to recompute the version.
> I think it's reasonable to ask the user to do this by hand, since
> installing a new version of Mercurial should be something users are
> aware of.
>