~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Parth Malwankar
  • Date: 2010-03-25 04:24:52 UTC
  • mto: This revision was merged to the branch mainline in revision 5166.
  • Revision ID: parth.malwankar@gmail.com-20100325042452-s27zhxa8y3vmbadi
initial support for 'pack --clean-obsolete-packs'. tested only manually.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4411
4411
 
4412
4412
 
4413
4413
class cmd_pack(Command):
4414
 
    """Compress the data within a repository."""
 
4414
    """Compress the data within a repository.
 
4415
 
 
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.
 
4419
 
 
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
 
4424
    used.
 
4425
 
 
4426
    Warning:
 
4427
    It may not be safe to use this options with certain transports
 
4428
    like SFTP, HTTP, NFS etc.
 
4429
    """
4415
4430
 
4416
4431
    _see_also = ['repositories']
4417
4432
    takes_args = ['branch_or_repo?']
 
4433
    takes_options = [
 
4434
        Option('clean-obsolete-packs', 'Delete obsolete packs to save disk space.'),
 
4435
        ]
4418
4436
 
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]
4421
4439
        try:
4422
4440
            branch = dir.open_branch()
4423
4441
            repository = branch.repository
4424
4442
        except errors.NotBranchError:
4425
4443
            repository = dir.open_repository()
4426
 
        repository.pack()
 
4444
        repository.pack(clean_obsolete_packs=clean_obsolete_packs)
4427
4445
 
4428
4446
 
4429
4447
class cmd_plugins(Command):