/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to mapping.py

Add convenience method for getting missing objects iterator.

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
        # We must just hope they are valid UTF-8..
128
128
        if path == "":
129
129
            return ROOT_ID
130
 
        if type(path) is unicode:
131
 
            path = path.encode("utf-8")
132
130
        return escape_file_id(path)
133
131
 
134
132
    def is_control_file(self, path):
574
572
        self.mapping = mapping
575
573
 
576
574
    def lookup_file_id(self, path):
577
 
        assert type(path) is str
578
575
        try:
579
 
            file_id = self.file_ids[path]
 
576
            return self.file_ids[path]
580
577
        except KeyError:
581
 
            file_id = self.mapping.generate_file_id(path)
582
 
        assert type(file_id) is str
583
 
        return file_id
 
578
            return self.mapping.generate_file_id(path)
584
579
 
585
580
    def lookup_path(self, file_id):
586
581
        if self.paths is None:
588
583
            for k, v in self.file_ids.iteritems():
589
584
                self.paths[v] = k
590
585
        try:
591
 
            path = self.paths[file_id]
 
586
            return self.paths[file_id]
592
587
        except KeyError:
593
588
            return self.mapping.parse_file_id(file_id)
594
 
        else:
595
 
            assert type(path) is str
596
 
            return path