Mercurial > public > mercurial-scm > hg
comparison mercurial/filelog.py @ 8531:810387f59696
filelog encoding: move the encoding/decoding into store
the escaping of directories ending with .i or .d doesn't
really belong to filelog.
we put the encoding/decoding in store instead, for backwards
compat, streamclone and the fncache file format still uses the
partially encoded filenames.
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 20 May 2009 18:35:47 +0200 |
parents | 46293a0c7e9f |
children | 25e572394f5c |
comparison
equal
deleted
inserted
replaced
8530:03196ac9a8b9 | 8531:810387f59696 |
---|---|
8 import revlog | 8 import revlog |
9 | 9 |
10 class filelog(revlog.revlog): | 10 class filelog(revlog.revlog): |
11 def __init__(self, opener, path): | 11 def __init__(self, opener, path): |
12 revlog.revlog.__init__(self, opener, | 12 revlog.revlog.__init__(self, opener, |
13 "/".join(("data", self.encodedir(path + ".i")))) | 13 "/".join(("data", path + ".i"))) |
14 | |
15 # This avoids a collision between a file named foo and a dir named | |
16 # foo.i or foo.d | |
17 def encodedir(self, path): | |
18 return (path | |
19 .replace(".hg/", ".hg.hg/") | |
20 .replace(".i/", ".i.hg/") | |
21 .replace(".d/", ".d.hg/")) | |
22 | |
23 def decodedir(self, path): | |
24 return (path | |
25 .replace(".d.hg/", ".d/") | |
26 .replace(".i.hg/", ".i/") | |
27 .replace(".hg.hg/", ".hg/")) | |
28 | 14 |
29 def read(self, node): | 15 def read(self, node): |
30 t = self.revision(node) | 16 t = self.revision(node) |
31 if not t.startswith('\1\n'): | 17 if not t.startswith('\1\n'): |
32 return t | 18 return t |