[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: autorevert and vc

From: Andre Spiegel
Subject: Re: autorevert and vc
Date: Tue, 30 Mar 2004 22:51:46 +0200

On Tue, 2004-03-30 at 17:17, Luc Teirlinck wrote:

> It apparently does not seem to take that much CPU to update the
> VC-state (without reverting the buffer) every five seconds, whether
> it is needed or not. [...] I do not know very much about VC, but at 
> first sight, I would be inclined to believe that probably the real
> way to do it would be to check the file modification times of the
> control files.

When you call vc-find-file-hook to recompute the version control state,
all that happens for CVS, RCS and SCCS is a check of file modification
times or permissions (for MCVS it's similar, SVN and Arch are slightly
more expensive, I think).

The idea is that backends can provide a vc-BACKEND-state-heuristic
function, which guesses the state by doing a fast operation like a
permission check or mtime check.  If no state-heuristic function is
provided, then each computation of the state likely involves an
expensive call to the backend system.

So, you might fine-tune your algorithm to only re-compute the vc-state
every five seconds *if* the backend has a state-heuristic function. 
(You can use vc-find-backend-function to determine that.)

Stefan's suggestion (vc-stale-state-p) is potentially more generic, but
perhaps it's better to wait until there is a backend where the existing
mechanism really isn't expressive enough.  Stefan, what do you think?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]