/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 breezy/tests/matchers.py

  • Committer: Jelmer Vernooij
  • Date: 2018-06-11 11:24:20 UTC
  • mfrom: (6973.3.5 less-file-id)
  • Revision ID: jelmer@jelmer.uk-20180611112420-n8g7s0xk77o90sbd
Merge lp:~jelmer/brz/less-file-id

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
        Matcher.__init__(self)
139
139
        self.entries = entries
140
140
 
141
 
    def get_tree_layout(self, tree):
 
141
    def get_tree_layout(self, tree, include_file_ids):
142
142
        """Get the (path, file_id) pairs for the current tree."""
143
143
        with tree.lock_read():
144
144
            for path, ie in tree.iter_entries_by_dir():
145
 
                if ie.parent_id is None:
146
 
                    yield (u"", ie.file_id)
 
145
                if path != u'':
 
146
                    path += ie.kind_character()
 
147
                if include_file_ids:
 
148
                    yield (path, ie.file_id)
147
149
                else:
148
 
                    yield (path+ie.kind_character(), ie.file_id)
 
150
                    yield path
149
151
 
150
152
    @staticmethod
151
153
    def _strip_unreferenced_directories(entries):
174
176
        return 'HasLayout(%r)' % self.entries
175
177
 
176
178
    def match(self, tree):
177
 
        actual = list(self.get_tree_layout(tree))
178
 
        if self.entries and isinstance(self.entries[0], (str, text_type)):
179
 
            actual = [path for (path, fileid) in actual]
 
179
        include_file_ids = self.entries and not isinstance(self.entries[0], (str, text_type))
 
180
        actual = list(self.get_tree_layout(tree, include_file_ids=include_file_ids))
180
181
        if not tree.has_versioned_directories():
181
182
            entries = list(self._strip_unreferenced_directories(self.entries))
182
183
        else:
211
212
                    kind = self.previous_tree.kind(previous_path)
212
213
                    if kind == 'directory':
213
214
                        previous_path += '/'
214
 
                if ie.parent_id is None:
 
215
                if path == u'':
215
216
                    yield (u"", previous_path)
216
217
                else:
217
218
                    yield (path+ie.kind_character(), previous_path)