~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/status.py

  • Committer: Martin Packman
  • Date: 2012-01-05 10:37:58 UTC
  • mto: This revision was merged to the branch mainline in revision 6427.
  • Revision ID: martin.packman@canonical.com-20120105103758-wzftnmsip5iv9n2g
Revert addition of get_message_encoding function

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
def report_changes(to_file, old, new, specific_files, 
35
35
                   show_short_reporter, show_long_callback, 
36
36
                   short=False, want_unchanged=False, 
37
 
                   want_unversioned=False, show_ids=False):
 
37
                   want_unversioned=False, show_ids=False, classify=True):
38
38
    """Display summary of changes.
39
39
 
40
40
    This compares two trees with regards to a list of files, and delegates 
59
59
        files.
60
60
    :param show_ids: If set, includes each file's id.
61
61
    :param want_unversioned: If False, only shows versioned files.
 
62
    :param classify: Add special symbols to indicate file kind.
62
63
    """
63
64
 
64
65
    if short:
76
77
            delta.unversioned if not new.is_ignored(unversioned[0])]
77
78
        show_long_callback(to_file, delta, 
78
79
                           show_ids=show_ids,
79
 
                           show_unchanged=want_unchanged)
 
80
                           show_unchanged=want_unchanged,
 
81
                           classify=classify)
80
82
 
81
83
 
82
84
def show_tree_status(wt, show_unchanged=None,
88
90
                     short=False,
89
91
                     verbose=False,
90
92
                     versioned=False,
 
93
                     classify=True,
91
94
                     show_long_callback=_mod_delta.report_delta):
92
95
    """Display summary of changes.
93
96
 
117
120
    :param verbose: If True, show all merged revisions, not just
118
121
        the merge tips
119
122
    :param versioned: If True, only shows versioned files.
 
123
    :param classify: Add special symbols to indicate file kind.
120
124
    :param show_long_callback: A callback: message = show_long_callback(to_file, delta, 
121
125
        show_ids, show_unchanged, indent, filter), only used with the long output
122
126
    """
153
157
        try:
154
158
            for hook in hooks['pre_status']:
155
159
                hook(StatusHookParams(old, new, to_file, versioned,
156
 
                    show_ids, short, verbose))
 
160
                    show_ids, short, verbose, specific_files=specific_files))
157
161
 
158
162
            specific_files, nonexistents \
159
163
                = _filter_nonexistent(specific_files, old, new)
161
165
 
162
166
            # Reporter used for short outputs
163
167
            reporter = _mod_delta._ChangeReporter(output_file=to_file,
164
 
                unversioned_filter=new.is_ignored)
 
168
                unversioned_filter=new.is_ignored, classify=classify)
165
169
            report_changes(to_file, old, new, specific_files, 
166
170
                           reporter, show_long_callback, 
167
171
                           short=short, want_unchanged=show_unchanged, 
168
 
                           want_unversioned=want_unversioned, show_ids=show_ids)
 
172
                           want_unversioned=want_unversioned, show_ids=show_ids,
 
173
                           classify=classify)
169
174
 
170
175
            # show the ignored files among specific files (i.e. show the files
171
176
            # identified from input that we choose to ignore). 
217
222
                raise errors.PathsDoNotExist(nonexistents)
218
223
            for hook in hooks['post_status']:
219
224
                hook(StatusHookParams(old, new, to_file, versioned,
220
 
                    show_ids, short, verbose))
 
225
                    show_ids, short, verbose, specific_files=specific_files))
221
226
        finally:
222
227
            old.unlock()
223
228
            new.unlock()
411
416
    """
412
417
 
413
418
    def __init__(self, old_tree, new_tree, to_file, versioned, show_ids,
414
 
            short, verbose):
 
419
            short, verbose, specific_files=None):
415
420
        """Create a group of post_status hook parameters.
416
421
 
417
422
        :param old_tree: Start tree (basis tree) for comparison.
421
426
        :param show_ids: Show internal object ids.
422
427
        :param short: Use short status indicators.
423
428
        :param verbose: Verbose flag.
 
429
        :param specific_files: If set, a list of filenames whose status should be
 
430
            shown.  It is an error to give a filename that is not in the working
 
431
            tree, or in the working inventory or in the basis inventory.
424
432
        """
425
433
        self.old_tree = old_tree
426
434
        self.new_tree = new_tree
429
437
        self.show_ids = show_ids
430
438
        self.short = short
431
439
        self.verbose = verbose
 
440
        self.specific_files = specific_files
432
441
 
433
442
    def __eq__(self, other):
434
443
        return self.__dict__ == other.__dict__
435
444
 
436
445
    def __repr__(self):
437
 
        return "<%s(%s, %s, %s, %s, %s, %s, %s)>" % (self.__class__.__name__,
 
446
        return "<%s(%s, %s, %s, %s, %s, %s, %s, %s)>" % (self.__class__.__name__,
438
447
            self.old_tree, self.new_tree, self.to_file, self.versioned,
439
 
            self.show_ids, self.short, self.verbose)
 
448
            self.show_ids, self.short, self.verbose, self.specific_files)
440
449
 
441
450
 
442
451
def _show_shelve_summary(params):
444
453
 
445
454
    :param params: StatusHookParams.
446
455
    """
 
456
    # Don't show shelves if status of specific files is being shown, only if
 
457
    # no file arguments have been passed
 
458
    if params.specific_files:
 
459
        return
447
460
    get_shelf_manager = getattr(params.new_tree, 'get_shelf_manager', None)
448
461
    if get_shelf_manager is None:
449
462
        return