/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/delta.py

  • Committer: Vincent Ladeuil
  • Date: 2008-12-10 09:33:06 UTC
  • mto: (3941.1.1 bzr.integration)
  • mto: This revision was merged to the branch mainline in revision 3942.
  • Revision ID: v.ladeuil+lp@free.fr-20081210093306-j4l1wiesc76519fy
Make the filter work for paths and file ids.

* bzrlib/tests/test_delta.py:
(TestDeltaShow): Fix failing tests, the previous commit was wrong.
(TestDeltaShow._get_delta): Baah, fix status outputs.
(TestDeltaShow.test_delta_show_short_status_single_file_id_filter):
Test for file id filter.

* bzrlib/delta.py:
(TreeDelta): Rename path_filter to filter and pass it the file id
too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
 
111
111
    def show(self, to_file, show_ids=False, show_unchanged=False,
112
112
             short_status=False, indent='',
113
 
             path_filter=None):
 
113
             filter=None):
114
114
        """Output this delta in status-like form to to_file.
115
115
 
116
116
        :param to_file: A file-like object where the output is displayed.
124
124
        :param indent: Added at the beginning of all output lines (for merged
125
125
            revisions).
126
126
 
127
 
        :param path_filter: A callable recieving a path and returning True if
128
 
            the path should be displayed.
 
127
        :param filter: A callable receiving a path and a file id and
 
128
            returning True if the path should be displayed.
129
129
        """
130
130
 
131
131
        def decorate_path(path, kind, meta_modified=None):
171
171
 
172
172
                for item in files:
173
173
                    path, file_id, kind = item[:3]
174
 
                    if (path_filter is not None and not path_filter(path)):
 
174
                    if (filter is not None and not filter(path, file_id)):
175
175
                        continue
176
176
                    if not header_shown and not short_status:
177
177
                        to_file.write(indent + long_status_name + ':\n')