Search code examples
bazaar

BZR: Is it possible to completely delete old revisions?


Is it possible to remove some old revisions in order to compact database? I don't mean to revert anything or remove sth from the middle. I would like to just delete from database everything older than specified date. Is it possible?


Solution

  • "Deleting old revisions" is not possible.

    If you want to compact storage, I can think of 2 options.

    1. Run bzr reconcile. The main function of this command is to fix inconsistencies detected by bzr check, but as its help says, it may do some additional optimizations too:

      At the same time it is run it may recompress data resulting in a potential saving in disk space or performance gain.

      You may want to take a backup of the repo before you do this!

    2. Replace your repository and branches with a clean new replica. You can create replicas of a Bazaar branch using the bzr branch or bzr push commands with a target location outside of your current shared repository (if you are using one), and the new replica branches will be automatically optimized and compact.

    Example: replicate the standalone branch /srv/mybranch into /newsrv/mybranch:

    bzr branch /srv/mybranch /newsrv/mybranch
    

    Example: replicate the shared repository /srv/repo into /newsrv/newrepo:

    bzr init-repo /newsrv/newrepo --no-trees
    cd /srv/repo
    bzr branches -R | while read branch; do bzr push -d "$branch" /newsrv/newrepo/"$branch" --create; done