/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 bzrlib/revisiontree.py

extend list_files() with from_dir and recursive parameters

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
    def has_filename(self, filename):
114
114
        return bool(self.inventory.path2id(filename))
115
115
 
116
 
    def list_files(self, include_root=False):
 
116
    def list_files(self, include_root=False, from_dir=None, recursive=True):
117
117
        # The only files returned by this are those from the version
118
 
        entries = self.inventory.iter_entries()
119
 
        # skip the root for compatability with the current apis.
120
 
        if self.inventory.root is not None and not include_root:
 
118
        inv = self.inventory
 
119
        if from_dir is None:
 
120
            from_dir_id = None
 
121
        else:
 
122
            from_dir_id = inv.path2id(from_dir)
 
123
        entries = inv.iter_entries(from_dir=from_dir_id, recursive=recursive)
 
124
        if inv.root is not None and not include_root and from_dir is None:
121
125
            # skip the root for compatability with the current apis.
122
126
            entries.next()
123
127
        for path, entry in entries: