[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Introducing 'unrecognized and 'ignored
From: |
Eric S. Raymond |
Subject: |
Re: Introducing 'unrecognized and 'ignored |
Date: |
Sat, 29 Dec 2007 06:45:51 -0500 |
User-agent: |
Mutt/1.5.15+20070412 (2007-04-11) |
Alexandru Harsanyi <address@hidden>:
> I had a look at the problem last night and wrote the code to load a
> cvsignore file and produce a regexp to match the ignored files, however the
> whole mechanism required by `vc-BACKEND-ignorable-file-p' is quite tricky
> to implement corectly (in a way that both Emacs and the backend agree 100%
> on what files are ignored). Here are two of the problems I found when I
> looked at an implementation for CVS:
>
> * CVS will ignore a file only if it is unregistered. For example .o files
> are ignored from a CVS status listing, but if an .o file is registered than
> that file will show up in the listing.
That is actually sensible behavior. From CVS, surprisingly so :-)
> This requires checking whether a
> file is registered or not, a thing which we try to avoid.
Not necessarily. See below.
> * There's a 'per-repository' cvsignore file at $CVSROOT/CVSROOT/cvsignore
> which Emacs cannot access directly for remote repositories.
That, on the other hand, is kind of a showstopper.
> With extended vc-state states I don't think there is a need for
> `vc-ignorable-file-p' at all: `vc-BACKEND-dir-state' should set the state
> for each registered file and for files it can register. `vc-dired-hook'
> can than simply look for the vc-state property and if it is missing it can
> assume that the file is ignored.
Thinking about it, you're right. We should consider that what
dir-state does is update the state properties for as many files as it
can, which means we can call (vc-state) on every file in the dired
listing and only get expensive operations for the ones dir-state
didn't report a status on.
Then the problem of speeding up vc-dired-hook will reduce to a simpler
one -- how to make the individual directory-status commands in each
VCS return information for as many files as possible? Ideally, we want
them to return status on *all* files beneath the current directory.
Some VCSes will make this easy. Mercurial, for example, has hg status -A,
which is documented to return status flags for all files. Now that we
have 'unregistered and 'ignored, this means that the individual
vc-state calls will never have to do their own check. Mercurial is
going to be really fast.
Some make it hard; CVS, for example. I don't know any way to make its
dir-state set 'ignored files, and it will set 'unregistered only if the
stay-local-p test fails and dir-state goes down the path that parses
vc-status output (something we want to avoid because it's dog-slow).
Most are in between. There is probably a way to beat Subversion into
reporting status on all files, but I don't know what it is yet.
I'll tackle this for Subversion -- would you look at making the CVS
dir-state better? The goal is to get it to somehow set 'ignored
and 'unregistered whenever appropriate.
There is also a minor can of worms near 'added. It's not really a
fully-supported state yet. It should be. And 'removed, too.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>