changeset 17584:61cd71dc3797

store: refactor splitting off of "data/" in _hybridencode() encodefilename() already calls encodedir(). Note that encodedir() skips the encoding if the path doesn't start with "data/".
author Adrian Buehlmann <adrian@cadifra.com>
date Sat, 15 Sep 2012 21:43:14 +0200
parents 54c832922e85
children 8ed2783f338f
files mercurial/store.py
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/store.py	Mon Sep 17 21:53:50 2012 +0200
+++ b/mercurial/store.py	Sat Sep 15 21:43:14 2012 +0200
@@ -200,13 +200,11 @@
     '''
     if not path.startswith('data/'):
         return path
-    # escape directories ending with .i and .d
-    path = encodedir(path)
-    ndpath = path[len('data/'):]
-    res = 'data/' + '/'.join(auxencode(encodefilename(ndpath)))
+    res = '/'.join(auxencode(encodefilename(path)))
     if len(res) > _maxstorepathlen:
+        path = encodedir(path)
         digest = _sha(path).hexdigest()
-        parts = auxencode(lowerencode(ndpath))
+        parts = auxencode(lowerencode(path))[1:]
         _root, ext = os.path.splitext(parts[-1])
         basename = parts[-1]
         sdirs = []