[PATCH 0/3] Permit directories ending in *.d or *.i
Goffredo Baroncelli
kreijack at aliceposta.it
Thu Jul 14 16:40:37 CDT 2005
Hi,
due to the internal repository architecture, mercurial doesn't allow the existence
of directories ending in '.d' or '.i'. This patches change how mercurial stores the file
under directories. In fact the file revlog of a file named 'a' is under
'.hg/data/a.d' and '.hg/data/a.i'. So if we add a file under a directory named 'a.d'
mercurial fails:
$ hg init
$ touch a
$ hg add a
$ hg ci -t "a added"
$ ls -l .hg/data
total 4
-rw-r--r-- 1 ghigo ghigo 0 2005-07-14 23:05 a.d
-rw-r--r-- 1 ghigo ghigo 76 2005-07-14 23:05 a.i
$ mkdir a.d
$ touch a.d/b
$ hg add a.d/b
$ hg ci -t "a.d/b added"
abort: File exists: /home/ghigo/mercurial/test1/.hg/data/a.d
transaction abort!
failed to truncate data/a.d/b.d
rollback completed
With this patches, mercurial stores the directories adding a '.dir' as postfix, so the
conflicts are avoided
$ hg init
$ touch a
$ mkdir a.d
$ touch a.d/b
$ hg add a a.d/b
$ hg ci -t "a and a.d/b added"
$ ls -l .hg/data .hg/data/a.d.dir/
.hg/data:
total 8
-rw-r--r-- 1 ghigo ghigo 0 2005-07-14 23:10 a.d
drwxr-xr-x 2 ghigo ghigo 4096 2005-07-14 23:10 a.d.dir
-rw-r--r-- 1 ghigo ghigo 76 2005-07-14 23:10 a.i
.hg/data/a.d.dir/:
total 4
-rw-r--r-- 1 ghigo ghigo 0 2005-07-14 23:10 b.d
-rw-r--r-- 1 ghigo ghigo 76 2005-07-14 23:10 b.i
In order to prevent strange behaviour, a file version are added to the .hg directory;
this file contains the version of the repository. If it is missing the revision is 0,
otherwise the revision is contained in the file.
The patch introduces the repository revision 1, which support the new style of directory
naming.
If a new repository is created ( init and or clone ), it will be in version 1 ( with the new
style of directory naming ). Otherwise hg works in compatible mode when the repository is
version 0, or in new style if the repository is version 1.
So the new mercurial are backward compatible; but also the 'old' mercurial support the
repository in version 1 if it is accessed via hg:// protocol. The 'old' mercurial doesn't
support the new style repository if it is accessed via filesystem.
A new command called repoupdated is added to update the repository version from 0 to 1.
The patches are three:
1) the first one is the core patch: it adds a class named filelog1; this class manages
the new style of directories naming
2) the second patch add the command repoupdate which update the repository from the
version 0 ( the actual one ) to the revision 1
3) the third patch, update the test
Comments are welcome.
Goffredo
--
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack AT inwind.it>
Key fingerprint = CE3C 7E01 6782 30A3 5B87 87C0 BB86 505C 6B2A CFF9
More information about the Mercurial
mailing list