[PATCH 0 of 5] introduce fncache repo layout

Adrian Buehlmann adrian at cadifra.com
Wed Jul 30 14:21:43 CDT 2008


On 30.07.2008 20:48, Adrian Buehlmann wrote:
> Furthermore I've tweaked store.hybridencode: I've abandoned
> the "X" -> "_x" encoding for the directory/filler parts of the hashed names
> and just used lower() plus the usual encoding (~xx for reserved stuff).
> 
> For example, this encodes
> data/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT.i
> to
> dh/au~78/second/x.prn/fourth/fi~3afth/sixth/seventh/eighth/nineth/tenth/loremia20419e358ddff1bf8751e38288aff1d7c32ec05.i
> 
> Since we fold directories anyway for hashed ("dh/..") files, we can fold the case
> too. A tracked dir named "Foo" rarely coexists next to a "foo". If it does, the
> hash values will keep the files separate.

Another question is: why switch encodings at all?

I'm referring to (in patch 4):

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py

[snip]

+def hybridencode(path):
+    '''encodes path with a length limit

[snip]

+    if not path.startswith('data/'):
+        return path
+    ndpath = path[len('data/'):]
+    res = 'df/' + auxencode(encodefilename(ndpath))
+    if len(res) > MAX_PATH_LEN_IN_HGSTORE:
+        digest = sha.new(path).hexdigest()

Why not eliminate that "if" and simply hybrid-hash *all* paths?

This would eliminate the dependency on "encodefilename" (for new repos).


More information about the Mercurial-devel mailing list