SubversionのリポジトリレイアウトとBranchの考え方メモ

SubversionリポジトリレイアウトとBranchの基本的な考え方を、公式ドキュメントの引用ベースでメモしておく。

レイアウト

Repository Layout

There are some standard, recommended ways to organize a repository. Most people create a trunk directory to hold the “main line” of development, a branches directory to contain branch copies, and a tags directory to contain tag copies.

Of course, you're free to ignore these common layouts. You can create any sort of variation, whatever works best for you or your team. Remember that whatever you choose, it's not a permanent commitment. You can reorganize your repository at any time. Because branches and tags are ordinary directories, the svn move command can move or rename them however you wish.

Planning Your Repository Organization

Your first decision is whether to use a single repository for multiple projects, or to give each project its own repository, or some compromise of these two.

There are benefits to using a single repository for multiple projects, most obviously the lack of duplicated maintenance.

Also, remember that Subversion uses repository-global revision numbers. While those numbers don't have any particular magical powers, some folks still don't like the fact that even though no changes have been made to their project lately, the youngest revision number for the repository keeps climbing because other projects are actively adding new revisions.

【3つのパターン例】

/
   calc/
      trunk/
      tags/
      branches/
   calendar/
      trunk/
      tags/
      branches/
   spreadsheet/
      trunk/
      tags/
      branches/
   …
/
   utils/
      calc/
         trunk/
         tags/
         branches/
      calendar/
         trunk/
         tags/
         branches/
      …
   office/
      spreadsheet/
         trunk/
         tags/
         branches/
      …
/
   trunk/
      calc/
      calendar/
      spreadsheet/
      …
   tags/
      calc/
      calendar/
      spreadsheet/
      …
   branches/
      calc/
      calendar/
      spreadsheet/
      …

Branch

What's a Branch?

This is the basic concept of a branch―namely, a line of development that exists independently of another line, yet still shares a common history if you look far enough back in time.

Common Branching Patterns
  • Release Branches:メインの開発は常にtrunkで行い、リリースのタイミングで「/branches/1.0.」等にブランチ。バグフィックスはブランチにも適用する。が、実際に配布したコードをリファレンス的に残しておきたいので、「/tags/1.0.0」のようにスナップショットを置いておく。
  • Feature Branches:(宿題)