~ubuntu-branches/debian/jessie/bzr-git/jessie

« back to all changes in this revision

Viewing changes to mapping.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-07-31 00:18:45 UTC
  • mfrom: (1.1.11 upstream) (8.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100731001845-su2xo23q9xdqdcyu
* New upstream release.
* Bump standards version to 3.9.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import stat
23
23
 
24
24
from bzrlib import (
 
25
    bencode,
25
26
    errors,
26
27
    foreign,
27
28
    trace,
28
29
    )
29
 
try:
30
 
    from bzrlib import bencode
31
 
except ImportError:
32
 
    from bzrlib.util import bencode
33
30
from bzrlib.inventory import (
34
31
    ROOT_ID,
35
32
    )
130
127
        # We must just hope they are valid UTF-8..
131
128
        if path == "":
132
129
            return ROOT_ID
 
130
        if type(path) is unicode:
 
131
            path = path.encode("utf-8")
133
132
        return escape_file_id(path)
134
133
 
135
134
    def is_control_file(self, path):
576
575
 
577
576
    def lookup_file_id(self, path):
578
577
        try:
579
 
            return self.file_ids[path]
 
578
            file_id = self.file_ids[path]
580
579
        except KeyError:
581
 
            return self.mapping.generate_file_id(path)
 
580
            file_id = self.mapping.generate_file_id(path)
 
581
        assert type(file_id) is str
 
582
        return file_id
582
583
 
583
584
    def lookup_path(self, file_id):
584
585
        if self.paths is None: