changeset 17618:7840d81a80ec

store: use native fncache encoding function if available This currently falls back to Python for hashed encoding.
author Bryan O'Sullivan <bryano@fb.com>
date Tue, 18 Sep 2012 16:25:20 -0700
parents 4038071af82a
children 431e3e827ab0
files mercurial/store.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/store.py	Tue Sep 18 16:09:02 2012 -0700
+++ b/mercurial/store.py	Tue Sep 18 16:25:20 2012 -0700
@@ -422,8 +422,16 @@
 def _plainhybridencode(f):
     return _hybridencode(f, False)
 
-def _dothybridencode(f):
-    return _hybridencode(f, True)
+_pathencode = getattr(parsers, 'pathencode', None)
+if _pathencode:
+    def _dothybridencode(f):
+        ef = _pathencode(f)
+        if ef is None:
+            return _hashencode(dotencode(f), True)
+        return ef
+else:
+    def _dothybridencode(f):
+        return _hybridencode(f, True)
 
 class fncachestore(basicstore):
     def __init__(self, path, openertype, dotencode):