/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/git/tree.py

Add recurse_nested argument to Tree.iter_entries_by_dir.

Merged from https://code.launchpad.net/~jelmer/brz/follow-tree-references-iter-entries-by-dir/+merge/374108

Show diffs side-by-side

added added

removed removed

Lines of Context:
526
526
                yield self._get_file_ie(store, child_path, name, mode, hexsha,
527
527
                                        file_id)
528
528
 
529
 
    def iter_entries_by_dir(self, specific_files=None):
 
529
    def iter_entries_by_dir(self, specific_files=None,
 
530
                            recurse_nested=False):
530
531
        if self.tree is None:
531
532
            return
532
533
        if specific_files is not None:
547
548
                    continue
548
549
                child_path = posixpath.join(path, name)
549
550
                child_path_decoded = child_path.decode('utf-8')
 
551
                if recurse_nested and S_ISGITLINK(mode):
 
552
                    mode = stat.S_IFDIR
 
553
                    store = self._get_submodule_store(child_path)
 
554
                    hexsha = store[hexsha].tree
550
555
                if stat.S_ISDIR(mode):
551
556
                    if (specific_files is None or
552
557
                            any([p for p in specific_files if p.startswith(
1217
1222
                else:
1218
1223
                    yield (posixpath.join(basepath, path), value)
1219
1224
 
1220
 
    def iter_entries_by_dir(self, specific_files=None):
 
1225
    def iter_entries_by_dir(self, specific_files=None,
 
1226
                            recurse_nested=False):
1221
1227
        with self.lock_read():
1222
1228
            if specific_files is not None:
1223
1229
                specific_files = set(specific_files)
1228
1234
            if specific_files is None or u"" in specific_files:
1229
1235
                ret[(u"", u"")] = root_ie
1230
1236
            dir_ids = {u"": root_ie.file_id}
1231
 
            for path, value in self._recurse_index_entries():
 
1237
            for path, value in self._recurse_index_entries(
 
1238
                    recurse_nested=recurse_nested):
1232
1239
                if self.mapping.is_special_file(path):
1233
1240
                    continue
1234
1241
                path = path.decode("utf-8")