~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/versionedfile.py

  • Committer: Patch Queue Manager
  • Date: 2011-12-19 01:56:41 UTC
  • mfrom: (6379.4.8 urlutils-quote)
  • Revision ID: pqm@pqm.ubuntu.com-20111219015641-k7fyhyf6rfgk93m2
(jelmer) Include quote() and unquote() directly in bzrlib.urlutils. (Jelmer
 Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
from bzrlib.lazy_import import lazy_import
26
26
lazy_import(globals(), """
27
 
import urllib
28
 
 
29
27
from bzrlib import (
30
28
    annotate,
31
29
    bencode,
38
36
    multiparent,
39
37
    tsort,
40
38
    revision,
 
39
    urlutils,
41
40
    )
42
41
""")
43
42
from bzrlib.registry import Registry
821
820
 
822
821
    def map(self, key):
823
822
        """See KeyMapper.map()."""
824
 
        return urllib.quote(self._map(key))
 
823
        return urlutils.quote(self._map(key))
825
824
 
826
825
    def unmap(self, partition_id):
827
826
        """See KeyMapper.unmap()."""
828
 
        return self._unmap(urllib.unquote(partition_id))
 
827
        return self._unmap(urlutils.unquote(partition_id))
829
828
 
830
829
 
831
830
class PrefixMapper(URLEscapeMapper):
878
877
    def _escape(self, prefix):
879
878
        """Turn a key element into a filesystem safe string.
880
879
 
881
 
        This is similar to a plain urllib.quote, except
 
880
        This is similar to a plain urlutils.quote, except
882
881
        it uses specific safe characters, so that it doesn't
883
882
        have to translate a lot of valid file ids.
884
883
        """
891
890
 
892
891
    def _unescape(self, basename):
893
892
        """Escaped names are easily unescaped by urlutils."""
894
 
        return urllib.unquote(basename)
 
893
        return urlutils.unquote(basename)
895
894
 
896
895
 
897
896
def make_versioned_files_factory(versioned_file_factory, mapper):