--- a/mercurial/store.py Wed Dec 12 13:09:36 2012 -0800
+++ b/mercurial/store.py Wed Dec 12 13:09:37 2012 -0800
@@ -255,22 +255,17 @@
return res
def _pathencode(path):
+ de = encodedir(path)
if len(path) > _maxstorepathlen:
- return None
- ef = _encodefname(encodedir(path)).split('/')
+ return _hashencode(de, True)
+ ef = _encodefname(de).split('/')
res = '/'.join(_auxencode(ef, True))
if len(res) > _maxstorepathlen:
- return None
+ return _hashencode(de, True)
return res
_pathencode = getattr(parsers, 'pathencode', _pathencode)
-def _dothybridencode(f):
- ef = _pathencode(f)
- if ef is None:
- return _hashencode(encodedir(f), True)
- return ef
-
def _plainhybridencode(f):
return _hybridencode(f, False)
@@ -456,7 +451,7 @@
class fncachestore(basicstore):
def __init__(self, path, vfstype, dotencode):
if dotencode:
- encode = _dothybridencode
+ encode = _pathencode
else:
encode = _plainhybridencode
self.encode = encode
--- a/tests/test-hybridencode.py Wed Dec 12 13:09:36 2012 -0800
+++ b/tests/test-hybridencode.py Wed Dec 12 13:09:37 2012 -0800
@@ -5,7 +5,7 @@
print "A = '%s'" % s.encode("string_escape")
# show the result of the C implementation, if available
- h = store._dothybridencode(s)
+ h = store._pathencode(s)
print "B = '%s'" % h.encode("string_escape")
# compare it with reference implementation in Python
--- a/tests/test-pathencode.py Wed Dec 12 13:09:36 2012 -0800
+++ b/tests/test-pathencode.py Wed Dec 12 13:09:37 2012 -0800
@@ -154,7 +154,7 @@
def runtests(rng, seed, count):
nerrs = 0
for p in genpath(rng, count):
- h = store._dothybridencode(p) # uses C implementation, if available
+ h = store._pathencode(p) # uses C implementation, if available
r = store._hybridencode(p, True) # reference implementation in Python
if h != r:
if nerrs == 0: