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.
40
40
This compares two trees with regards to a list of files, and delegates
76
77
delta.unversioned if not new.is_ignored(unversioned[0])]
77
78
show_long_callback(to_file, delta,
79
show_unchanged=want_unchanged)
80
show_unchanged=want_unchanged,
82
84
def show_tree_status(wt, show_unchanged=None,
117
120
:param verbose: If True, show all merged revisions, not just
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
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,
170
175
# show the ignored files among specific files (i.e. show the files
171
176
# identified from input that we choose to ignore).
197
to_file.write("%s %s\n" % (prefix, conflict))
202
to_file.write("%s %s\n" % (prefix, unicode(conflict)))
198
203
# Show files that were requested but don't exist (and are
199
204
# not versioned). We don't involve delta in this; these
200
205
# paths are really the province of just the status
379
384
These are all empty initially, because by default nothing should get
382
_mod_hooks.Hooks.__init__(self)
383
self.create_hook(_mod_hooks.HookPoint('post_status',
387
_mod_hooks.Hooks.__init__(self, "bzrlib.status", "hooks")
388
self.add_hook('post_status',
384
389
"Called with argument StatusHookParams after Bazaar has "
385
390
"displayed the status. StatusHookParams has the attributes "
386
391
"(old_tree, new_tree, to_file, versioned, show_ids, short, "
387
392
"verbose). The last four arguments correspond to the command "
388
393
"line options specified by the user for the status command. "
389
394
"to_file is the output stream for writing.",
391
self.create_hook(_mod_hooks.HookPoint('pre_status',
396
self.add_hook('pre_status',
392
397
"Called with argument StatusHookParams before Bazaar "
393
398
"displays the status. StatusHookParams has the attributes "
394
399
"(old_tree, new_tree, to_file, versioned, show_ids, short, "
395
400
"verbose). The last four arguments correspond to the command "
396
401
"line options specified by the user for the status command. "
397
402
"to_file is the output stream for writing.",
401
406
class StatusHookParams(object):
445
450
:param params: StatusHookParams.
447
manager = params.new_tree.get_shelf_manager()
452
get_shelf_manager = getattr(params.new_tree, 'get_shelf_manager', None)
453
if get_shelf_manager is None:
455
manager = get_shelf_manager()
448
456
shelves = manager.active_shelves()
450
params.to_file.write('%d shelves exist. '
451
'See "bzr shelve --list" for details.\n' % len(shelves))
458
singular = '%d shelf exists. '
459
plural = '%d shelves exist. '
460
if len(shelves) == 1:
464
params.to_file.write(fmt % len(shelves))
465
params.to_file.write('See "bzr shelve --list" for details.\n')
454
468
hooks = StatusHooks()