[PATCH v2] store: rewrite fncache path mangling code in C
Adrian Buehlmann
adrian at cadifra.com
Sat Sep 1 07:13:13 CDT 2012
On 2012-08-31 19:10, Adrian Buehlmann wrote:
> The hashmangle and hashencode functions in your C-code roughly
> correspond to this pile of (hairy) Python code in store.py:
>
> digest = _sha(path).hexdigest()
> aep = auxencode(lowerencode(ndpath))
> _root, ext = os.path.splitext(aep)
> parts = aep.split('/')
> basename = parts[-1]
> sdirs = []
> for p in parts[:-1]:
> d = p[:_dirprefixlen]
> if d[-1] in '. ':
> # Windows can't access dirs ending in period or space
> d = d[:-1] + '_'
I fail to see where in the C code this wrinkle is supposed to be done. Which
seems to correlate with the failing testcases
A = 'data/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt'
-B = 'dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilenaf93030515d9849cfdca52937c2204d19f83913e5.txt'
+B = 'dh/project /resource/anotherl/followed/andanoth/andthenanextremelylongfilenaf93030515d9849cfdca52937c2204d19f83913e5.txt'
A = 'data/Project.Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt'
-B = 'dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilena0fd7c506f5c9d58204444fc67e9499006bd2d445.txt'
+B = 'dh/project./resource/anotherl/followed/andanoth/andthenanextremelylongfilena0fd7c506f5c9d58204444fc67e9499006bd2d445.txt'
I reported.
> t = '/'.join(sdirs) + '/' + d
> if len(t) > _maxshortdirslen:
> break
> sdirs.append(d)
> dirs = '/'.join(sdirs)
> if len(dirs) > 0:
> dirs += '/'
> res = 'dh/' + dirs + digest + ext
> spaceleft = _maxstorepathlen - len(res)
> if spaceleft > 0:
> filler = basename[:spaceleft]
> res = 'dh/' + dirs + filler + digest + ext
More information about the Mercurial-devel
mailing list