413
413
self.outf.write(page_bytes[:header_end])
414
414
page_bytes = data
415
415
self.outf.write('\nPage %d\n' % (page_idx,))
416
decomp_bytes = zlib.decompress(page_bytes)
417
self.outf.write(decomp_bytes)
418
self.outf.write('\n')
416
if len(page_bytes) == 0:
417
self.outf.write('(empty)\n');
419
decomp_bytes = zlib.decompress(page_bytes)
420
self.outf.write(decomp_bytes)
421
self.outf.write('\n')
420
423
def _dump_entries(self, trans, basename):
482
485
d.destroy_workingtree()
488
class cmd_repair_workingtree(Command):
489
__doc__ = """Reset the working tree state file.
491
This is not meant to be used normally, but more as a way to recover from
492
filesystem corruption, etc. This rebuilds the working inventory back to a
493
'known good' state. Any new modifications (adding a file, renaming, etc)
494
will be lost, though modified files will still be detected as such.
496
Most users will want something more like "bzr revert" or "bzr update"
497
unless the state file has become corrupted.
499
By default this attempts to recover the current state by looking at the
500
headers of the state file. If the state file is too corrupted to even do
501
that, you can supply --revision to force the state of the tree.
504
takes_options = ['revision', 'directory',
506
help='Reset the tree even if it doesn\'t appear to be'
511
def run(self, revision=None, directory='.', force=False):
512
tree, _ = WorkingTree.open_containing(directory)
513
self.add_cleanup(tree.lock_tree_write().unlock)
517
except errors.BzrError:
518
pass # There seems to be a real error here, so we'll reset
521
raise errors.BzrCommandError(
522
'The tree does not appear to be corrupt. You probably'
523
' want "bzr revert" instead. Use "--force" if you are'
524
' sure you want to reset the working tree.')
528
revision_ids = [r.as_revision_id(tree.branch) for r in revision]
530
tree.reset_state(revision_ids)
531
except errors.BzrError, e:
532
if revision_ids is None:
533
extra = (', the header appears corrupt, try passing -r -1'
534
' to set the state to the last commit')
537
raise errors.BzrCommandError('failed to reset the tree state'
485
541
class cmd_revno(Command):
486
542
__doc__ = """Show current revision number.
1964
2024
RegistryOption('format',
1965
2026
help='Diff format to use.',
1966
2027
lazy_registry=('bzrlib.diff', 'format_registry'),
1967
value_switches=False, title='Diff format'),
2028
title='Diff format'),
1969
2030
aliases = ['di', 'dif']
1970
2031
encoding_type = 'exact'
4587
4648
@display_command
4588
4649
def run(self, verbose=False):
4589
import bzrlib.plugin
4590
from inspect import getdoc
4592
for name, plugin in bzrlib.plugin.plugins().items():
4593
version = plugin.__version__
4594
if version == 'unknown':
4596
name_ver = '%s %s' % (name, version)
4597
d = getdoc(plugin.module)
4599
doc = d.split('\n')[0]
4601
doc = '(no description)'
4602
result.append((name_ver, doc, plugin.path()))
4603
for name_ver, doc, path in sorted(result):
4604
self.outf.write("%s\n" % name_ver)
4605
self.outf.write(" %s\n" % doc)
4607
self.outf.write(" %s\n" % path)
4608
self.outf.write("\n")
4650
from bzrlib import plugin
4651
self.outf.writelines(
4652
plugin.describe_plugins(show_paths=verbose))
4611
4655
class cmd_testament(Command):
4673
4717
self.add_cleanup(branch.lock_read().unlock)
4674
4718
tree = _get_one_revision_tree('annotate', revision, branch=branch)
4675
4719
self.add_cleanup(tree.lock_read().unlock)
4720
if wt is not None and revision is None:
4677
4721
file_id = wt.path2id(relpath)
4679
4723
file_id = tree.path2id(relpath)
4680
4724
if file_id is None:
4681
4725
raise errors.NotVersionedError(filename)
4682
file_version = tree.inventory[file_id].revision
4683
4726
if wt is not None and revision is None:
4684
4727
# If there is a tree and we're not annotating historical
4685
4728
# versions, annotate the working tree's content.
4686
4729
annotate_file_tree(wt, file_id, self.outf, long, all,
4687
4730
show_ids=show_ids)
4732
file_version = tree.inventory[file_id].revision
4689
4733
annotate_file(branch, file_version, file_id, long, all, self.outf,
4690
4734
show_ids=show_ids)
6060
6104
takes_options = ['directory',
6061
6105
Option('ignored', help='Delete all ignored files.'),
6062
Option('detritus', help='Delete conflict files, merge'
6106
Option('detritus', help='Delete conflict files, merge and revert'
6063
6107
' backups, and failed selftest dirs.'),
6064
6108
Option('unknown',
6065
6109
help='Delete files unknown to bzr (default).'),