4413
4413
class cmd_pack(Command):
4414
"""Compress the data within a repository."""
4414
"""Compress the data within a repository.
4416
This opration compresses the data within a bazaar repository. As
4417
bazaar supports automatic packing of repository, this operation is
4418
normally not required to be done manually.
4420
During the pack operation, bazaar takes a backup of existing data,
4421
i.e. pack files. This backup is eventually removed by bazaar
4422
automatically when it is safe to do so. To save disk space by removing
4423
the backed up pack files, the --clean-obsolete-packs option may be
4427
It may not be safe to use this options with certain transports
4428
like SFTP, HTTP, NFS etc.
4416
4431
_see_also = ['repositories']
4417
4432
takes_args = ['branch_or_repo?']
4434
Option('clean-obsolete-packs', 'Delete obsolete packs to save disk space.'),
4419
def run(self, branch_or_repo='.'):
4437
def run(self, branch_or_repo='.', clean_obsolete_packs=False):
4420
4438
dir = bzrdir.BzrDir.open_containing(branch_or_repo)[0]
4422
4440
branch = dir.open_branch()
4423
4441
repository = branch.repository
4424
4442
except errors.NotBranchError:
4425
4443
repository = dir.open_repository()
4444
repository.pack(clean_obsolete_packs=clean_obsolete_packs)
4429
4447
class cmd_plugins(Command):