##// END OF EJS Templates
store: use fast C implementation of encodedir() if it's available...
Adrian Buehlmann -
r17607:cc58dc47 default
parent child Browse files
Show More
@@ -6,22 +6,22 b''
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from i18n import _
9 import osutil, scmutil, util
9 import osutil, scmutil, util, parsers
10 10 import os, stat, errno
11 11
12 12 _sha = util.sha1
13 13
14 14 # This avoids a collision between a file named foo and a dir named
15 15 # foo.i or foo.d
16 def encodedir(path):
16 def _encodedir(path):
17 17 '''
18 >>> encodedir('data/foo.i')
18 >>> _encodedir('data/foo.i')
19 19 'data/foo.i'
20 >>> encodedir('data/foo.i/bla.i')
20 >>> _encodedir('data/foo.i/bla.i')
21 21 'data/foo.i.hg/bla.i'
22 >>> encodedir('data/foo.i.hg/bla.i')
22 >>> _encodedir('data/foo.i.hg/bla.i')
23 23 'data/foo.i.hg.hg/bla.i'
24 >>> encodedir('data/foo.i\\ndata/foo.i/bla.i\\ndata/foo.i.hg/bla.i\\n')
24 >>> _encodedir('data/foo.i\\ndata/foo.i/bla.i\\ndata/foo.i.hg/bla.i\\n')
25 25 'data/foo.i\\ndata/foo.i.hg/bla.i\\ndata/foo.i.hg.hg/bla.i\\n'
26 26 '''
27 27 return (path
@@ -29,6 +29,8 b' def encodedir(path):'
29 29 .replace(".i/", ".i.hg/")
30 30 .replace(".d/", ".d.hg/"))
31 31
32 encodedir = getattr(parsers, 'encodedir', _encodedir)
33
32 34 def decodedir(path):
33 35 '''
34 36 >>> decodedir('data/foo.i')
General Comments 0
You need to be logged in to leave comments. Login now