/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: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from __future__ import absolute_import
18
18
 
19
 
from breezy import (
 
19
from bzrlib import (
20
20
    osutils,
21
21
    )
22
 
from .sixish import (
23
 
    StringIO,
24
 
    )
25
 
from .trace import is_quiet
 
22
from bzrlib.trace import is_quiet
26
23
 
27
24
 
28
25
class TreeDelta(object):
112
109
 
113
110
    def get_changes_as_text(self, show_ids=False, show_unchanged=False,
114
111
                            short_status=False):
115
 
        output = StringIO()
 
112
        import StringIO
 
113
        output = StringIO.StringIO()
116
114
        report_delta(output, self, short_status, show_ids, show_unchanged)
117
115
        return output.getvalue()
118
116
 
203
201
                output_file.write((fmt % args) + '\n')
204
202
        self.output = output
205
203
        if self.output is None:
206
 
            from . import trace
 
204
            from bzrlib import trace
207
205
            self.output = trace.note
208
206
        self.suppress_root_add = suppress_root_add
209
207
        self.modified_map = {'kind changed': 'K',
314
312
    :param reporter: The _ChangeReporter that will report the changes.
315
313
    """
316
314
    versioned_change_map = {
317
 
        (True, True): 'unchanged',
318
 
        (True, False): 'removed',
319
 
        (False, True): 'added',
 
315
        (True, True)  : 'unchanged',
 
316
        (True, False) : 'removed',
 
317
        (False, True) : 'added',
320
318
        (False, False): 'unversioned',
321
319
        }
322
320
    for (file_id, path, content_change, versioned, parent_id, name, kind,
349
347
        reporter.report(file_id, path, versioned_change, renamed, modified,
350
348
                        exe_change, kind)
351
349
 
352
 
 
353
 
def report_delta(to_file, delta, short_status=False, show_ids=False,
354
 
        show_unchanged=False, indent='', predicate=None, classify=True):
 
350
def report_delta(to_file, delta, short_status=False, show_ids=False, 
 
351
         show_unchanged=False, indent='', filter=None, classify=True):
355
352
    """Output this delta in status-like form to to_file.
356
353
 
357
354
    :param to_file: A file-like object where the output is displayed.
367
364
    :param indent: Added at the beginning of all output lines (for merged
368
365
        revisions).
369
366
 
370
 
    :param predicate: A callable receiving a path and a file id and
 
367
    :param filter: A callable receiving a path and a file id and
371
368
        returning True if the path should be displayed.
372
369
 
373
370
    :param classify: Add special symbols to indicate file kind.
418
415
 
419
416
            for item in files:
420
417
                path, file_id, kind = item[:3]
421
 
                if (predicate is not None and not predicate(path, file_id)):
 
418
                if (filter is not None and not filter(path, file_id)):
422
419
                    continue
423
420
                if not header_shown and not short_status:
424
421
                    to_file.write(indent + long_status_name + ':\n')