~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/__init__.py

  • Committer: Martin Pool
  • Date: 2006-06-20 07:55:43 UTC
  • mfrom: (1798 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1799.
  • Revision ID: mbp@sourcefrog.net-20060620075543-b10f6575d4a4fa32
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
import bzrlib
33
33
import bzrlib.errors as errors
34
34
from bzrlib.errors import BzrError, UnlistableStore, TransportNotPossible
35
 
from bzrlib.symbol_versioning import *
 
35
from bzrlib.symbol_versioning import (deprecated_function, zero_eight)
36
36
from bzrlib.trace import mutter
37
 
from bzrlib.transport import Transport, urlescape
 
37
from bzrlib.transport import Transport
38
38
from bzrlib.transport.local import LocalTransport
 
39
import bzrlib.urlutils as urlutils
39
40
 
40
41
######################################################################
41
42
# stores
294
295
                self._check_fileid(suffix)
295
296
        else:
296
297
            suffixes = []
 
298
        fileid = self._escape_file_id(fileid)
297
299
        if self._prefixed:
298
300
            # hash_prefix adds the '/' separator
299
 
            prefix = self.hash_prefix(fileid)
 
301
            prefix = self.hash_prefix(fileid, escaped=True)
300
302
        else:
301
303
            prefix = ''
302
 
        fileid = self._escape_file_id(fileid)
303
304
        path = prefix + fileid
304
305
        full_path = u'.'.join([path] + suffixes)
305
 
        return urlescape(full_path)
 
306
        return urlutils.escape(full_path)
306
307
 
307
308
    def _escape_file_id(self, file_id):
308
309
        """Turn a file id into a filesystem safe string.
323
324
             for c in file_id]
324
325
        return ''.join(r)
325
326
 
326
 
    def hash_prefix(self, fileid):
 
327
    def hash_prefix(self, fileid, escaped=False):
327
328
        # fileid should be unescaped
328
 
        if self._escaped:
 
329
        if not escaped and self._escaped:
329
330
            fileid = self._escape_file_id(fileid)
330
331
        return "%02x/" % (adler32(fileid) & 0xff)
331
332