[ANN] caseguard - an extension for case-folding collision prevention
Adrian Buehlmann
adrian at cadifra.com
Wed Feb 3 17:46:52 CST 2010
On 03.02.2010 21:01, alexandru wrote:
> Hello,
>
> I have been working for a while on caseguard, an extension that helps Mercurial users avoid case-folding collisions by verifying that the files they are adding to a repository differ in more than just case to anything that's already tracked (i.e. if the repo tracks 'file', adding 'FILE' will be blocked since it would cause a collision)
>
> The extension is available at http://bitbucket.org/alexandru/caseguard/
>
> The extension also protects against using `hg rm' to delete files that don't match exactly what's tracked by the repository (i.e. `hg rm file' will fail if the repo tracks 'FILE', not 'file'). Simple `hg addremove' protection is currently included, but please refer to the BUGS file included with the extension for more information on current issues with that.
>
> I am aware of two other extensions that deal with case-folding collisions: CaseFold and Casestop. Caseguard is different as it only prevents problematic additions on the user side, as opposed to checking the merge and/or update stages (as CaseFold does). Caseguard doesn't handle incoming changesets that might cause case-folds. The hope is that even users on case-sensitive filesystems would use caseguard, knowing that other developers involved in their projects may use a case-insensitive FS.
>
>
> As this is my first serious foray in Mercurial development, any and all feedback is greatly appreciated.
It seems you have thought about cross-platform projects, I mean projects that
have contributors on let's say both Linux and Windows.
Windows exhibits the problem that it has a whole plethora of nasty forbidden/
reserved file names [1] (very carefully read "Naming Conventions").
We have dealt with them -inside- Mercurial's store (.hg/store) when introducing
the fncache repository layout [2] (see also mercurial/store.py in the sources).
A nice case is for example a directory named 'aux', which people on Linux
happily create, but on Windows, it is a reserved name used for a device (which
probably no one cares about anymore these days, but it is reserved forever). You
can't create a file with a path element name being 'aux' on Windows.
("Do not end a file or directory name with a space or a period" is also a very
nice one :-).
The net effect is that you can clone a repository containing such a filename
to Windows (provided you use the fnache repo format [3] on the target side), but
you cannot checkout any revision containing a Windows-forbidden/reserved file
name there.
If some user on Linux checks in such a file, the Windows users will not be
able to checkout the affected revisions of the repo. They will have to ask
a Linux user to move such files to under a different name. Bisecting onto
such a revision is also not very nice then ("The ship has sailed" [4]).
It might be interesting to extend your extension to include checks for
problematic filenames in general. Not just case-folding collisions.
What I could be looking for would be, for example, issuing a warning
for a Linux user if he adds a file having 'aux' as a path component,
or any other filename which is forbidden/reserved on Windows.
(See also http://mercurial.selenic.com/bts/issue1713, where our friendly
helpful folks at MS introduced yet another horror with explorer on Vista
and Windows 7).
[1] http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
[2] http://mercurial.selenic.com/wiki/fncacheRepoFormat
[3] http://www.selenic.com/mercurial/hgrc.5.html#format
[4] http://mercurial.selenic.com/wiki/FAQ#FAQ.2BAC8-CommonProblems.I_committed_a_change_containing_nuclear_launch_codes.2C_how_do_I_delete_it_permanently.3F
More information about the Mercurial-devel
mailing list