bzr のリポジトリをアップグレード このエントリをはてなブックマークに登録


もりもりもりもり / , , ,

また 1 ヶ月ぶりになってしまいました。もりやまです。


さて、今回は最初に書いた bzr-svn のその後です。

最近 bzr update や bzr diff をしたときに、エラーで落ちてしまうようになって、いろいろ調べたところ、推奨リポジトリフォーマットが新しくなっていました。

bzr はリポジトリフォーマットがたくさんあるようです。bzr help current-formats を実行するとたくさん出てきます。

$ bzr help current-formats
Current Storage Formats

    (native) (default) New in 0.92: Pack-based format with data
    compatible with dirstate-tags format repositories. Interoperates
    with bzr repositories before 0.92 but cannot be read by bzr < 0.92. Previously called knitpack-experimental.  For more
    information, see http://doc.bazaar-

    (native) New in 1.0: A variant of pack-0.92 that supports rich-
    root data (needed for bzr-svn and bzr-git).

    (native) A format that allows a branch to indicate that there is
    another (stacked) repository that should be used to access data
    that is not present locally.

    (native) A variant of 1.6 that supports rich-root data (needed for
    bzr-svn and bzr-git).

    (native) A repository format using B+tree indexes. These indexes
    are smaller in size, have smarter caching and provide faster
    performance for most operations.

    (native) A variant of 1.9 that supports rich-root data (needed for
    bzr-svn and bzr-git).

    (native) A working-tree format that supports content filtering.

    (native) A variant of 1.14 that supports rich-root data (needed
    for bzr-svn and bzr-git).

    (native) Default format, rich root variant. (needed for bzr-svn
    and bzr-git).

    Subversion repository.

See ``bzr help formats`` for more about storage formats.

以前の記事で作ったリポジトリは rich-root-pack 形式なので、1.0 のときに追加された形式のようです。

bzr help formats も実行してみると、

$ bzr help formats
Storage Formats

To ensure that older clients do not access data incorrectly,
Bazaar's policy is to introduce a new storage format whenever
new features requiring new metadata are added. New storage
formats may also be introduced to improve performance and

Use the following guidelines to select a format (stopping
as soon as a condition is true):

* If you are working on an existing project, use whatever
  format that project is using. (Bazaar will do this for you
  by default).

* If you are using bzr-svn to interoperate with a Subversion
  repository, use 1.14-rich-root.

* If you are working on a project with big trees (5000+ paths)
  or deep history (5000+ revisions), use 1.14.

* Otherwise, use the default format - it is good enough for
  most projects.

If some of your developers are unable to use the most recent
version of Bazaar (due to distro package availability say), be
sure to adjust the guidelines above accordingly. For example,
you may need to select 1.9 instead of 1.14 if your project has
standardized on Bazaar 1.13.1 say.

Note: Many of the currently supported formats have two variants:
a plain one and a rich-root one. The latter include an additional
field about the root of the tree. There is no performance cost
for using a rich-root format but you cannot easily merge changes
from a rich-root format into a plain format. As a consequence,
moving a project to a rich-root format takes some co-ordination
in that all contributors need to upgrade their repositories
around the same time. (It is for this reason that we have delayed
making a rich-root format the default so far, though we will do
so at some appropriate time in the future.)

See ``bzr help current-formats`` for the complete list of
currently supported formats. See ``bzr help other-formats`` for
descriptions of any available experimental and deprecated formats.


* If you are using bzr-svn to interoperate with a Subversion
  repository, use 1.14-rich-root.

と述べられています。どうやら 1.14-rich-root 形式を使うのがいいようです。

当然ですが、bzr が 1.14 以降でないと使えません。手元の macports でインストールしてあるバージョンは以下のとおりです。

$ port installed bzr bzr-svn
The following ports are currently installed:
  bzr @1.15.1_0 (active)
  bzr-svn @0.6.1_0 (active)

それではリポジトリを 1.14-rich-root 形式にアップグレードしてみます。アップグレードのサブコマンドは upgrade です。まんまですね。

$ cd /path/to/bzr-svn-repo
$ bzr upgrade --1.14-rich-root
starting upgrade of file:///path/to/bzr-svn-repo/
making backup of file:///path/to/bzr-svn-repo/.bzr
  to file:///path/to/bzr-svn-repo/backup.bzr
starting repository conversion                                                                                                                                                                                                                                                                                            
repository converted                                                                                                                                                                                                                                                                                                      

これで変換完了です。変換前はエラーで落ちていた update や diff も、変換後はすんなり通るようになりました。

bzr に手を出してそろそろ半年になりますが、なかなかいい感じです。なにより svn からの乗り換えが楽です。

git ほど速くはないですが、使い勝手は git より上じゃないかと思います。

ぜひ bzr 使ってみてください。

  1. メモからはじめる情報共有 DocBase 無料トライアルを開始
  2. DocBase 資料をダウンロード






we use!!Ruby on RailsAmazon Web Services