wiki:TipAndDoc/project/trac/repository

Version 2 (modified by mitty, 10 years ago) (diff)

--

Migration from a single-repository setup

  • 4 repositories and 2 tracs
    • リポジトリとTracのリスト
      subversion repository list trac environment list
    • Tracのリポジトリブラウザとタイムライン
      trac browser with single repository trac timeline with single repository

step by step

  1. remove "repository_dir" from trac.ini
    • diff -u /var/trac/lab/test/conf/trac.ini.20110101 /var/trac/lab/test/conf/trac.ini
      --- /var/trac/lab/test/conf/trac.ini.20110101   2011-01-01 15:24:22.593393957 +0900
      +++ /var/trac/lab/test/conf/trac.ini    2011-01-02 19:46:06.503404153 +0900
      @@ -14,4 +14,3 @@
       [trac]
       authz_file = /path/to/config/files/passwd/svn-authz.lab
       authz_module_name = test
      -repository_dir = /var/svn/lab/test
      
    • Tracのリポジトリブラウザとタイムラインから、エントリが消える
      trac browser with repository_dir removed trac timeline with repository_dir removed
  2. add "[repositories]" to trac.ini
    • diff -u /var/trac/lab/test/conf/trac.ini.20110101 /var/trac/lab/test/conf/trac.ini
      --- /var/trac/lab/test/conf/trac.ini.20110101   2011-01-01 15:24:22.593393957 +0900
      +++ /var/trac/lab/test/conf/trac.ini    2011-01-02 22:35:21.763411095 +0900
      @@ -11,7 +11,17 @@
       name = test
       url = https://lab.mitty.jp/trac/test/
      
      +[repositories]
      +lab.test.dir = /var/svn/lab/lab.test
      +lab.test.type = svn
      +lab.test.url = http://lab.mitty.jp/svn/lab.test/
      +test.dir = /var/svn/lab/test
      +test.type = svn
      +test.url = http://lab.mitty.jp/svn/test/
      +test2.dir = /var/svn/lab/test2
      +test2.type = svn
      +test2.url = http://lab.mitty.jp/svn/test2/
      +
       [trac]
       authz_file = /path/to/config/files/passwd/svn-authz.lab
       authz_module_name = test
      -repository_dir = /var/svn/lab/test
      
    • resyncするまではリポジトリの情報が見れない
      trac browser with [repositories] added to trac.ini
  3. resync repositories
    1. sudo trac-admin /var/trac/lab/test/ repository resync "*"
      Resyncing repository history for lab.test...
      3 revisions cached.
      Resyncing repository history for test...
      4 revisions cached.
      Resyncing repository history for test2...
      2 revisions cached.
      Done.
      
    • resync後のリポジトリブラウザとタイムライン
      trac browser with resynced [repositories] trac timeline with resynced [repositories]
    • それまでの「/trunk」ではアクセスが出来なくなる
      trac browser /trunk with resynced [repositories]
    • svn commitしても、リポジトリの情報は更新されない
      • D:\tmp>svn ci lab.test -m " * mkdir 4 for lab.test"
        Adding         lab.test\trunk\4
        
        Committed revision 4.
        
      • 「lab.test」リポジトリはrevisionが「3」のまま
        no change found in trac browser on svn commit
  4. add ".alias = lab.test" to trac.ini
    • diff -u /var/trac/lab/test/conf/trac.ini.20110101 /var/trac/lab/test/conf/trac.ini
      --- /var/trac/lab/test/conf/trac.ini.20110101   2011-01-01 15:24:22.593393957 +0900
      +++ /var/trac/lab/test/conf/trac.ini    2011-01-02 23:00:13.925906625 +0900
      @@ -11,7 +11,19 @@
       name = test
       url = https://lab.mitty.jp/trac/test/
      
      +[repositories]
      
      (snip)
      
      +test2.url = http://lab.mitty.jp/svn/test2/
      +
      +.alias = lab.test
      +
       [trac]
      
      (snip)
      
    • 「規定のリポジトリ」が表示される
      trac browser with '.alias = ' added
      • revisionも「4」に更新される
    • 「/trunk」でのアクセスが復活する
      trac browser /trunk with '.alias = ' added
  5. add ".hidden = true"
    • diff -u /var/trac/lab/test/conf/trac.ini.20110101 /var/trac/lab/test/conf/trac.ini
      --- /var/trac/lab/test/conf/trac.ini.20110101   2011-01-01 15:24:22.593393957 +0900
      +++ /var/trac/lab/test/conf/trac.ini    2011-01-02 23:06:31.585907819 +0900
      @@ -11,7 +11,20 @@
       name = test
       url = https://lab.mitty.jp/trac/test/
      
      +[repositories]
      
      (snip)
      
      +
      +.alias = lab.test
      +.hidden = true
      +
       [trac]
      
      (snip)
      
    • 「規定のリポジトリ」が表示されなくなる
      trac browser with '.hidden = ' added
    • 「/trunk」では、「規定のリポジトリ」の「/trunk」に今まで通りアクセスできる
      trac browser /trunk with '.hidden = ' added
  6. change ".alias" to "test" from "lab.test"
    • diff -u /var/trac/lab/test/conf/trac.ini.20110101 /var/trac/lab/test/conf/trac.ini
      --- /var/trac/lab/test/conf/trac.ini.20110101   2011-01-01 15:24:22.593393957 +0900
      +++ /var/trac/lab/test/conf/trac.ini    2011-01-02 23:08:53.633399243 +0900
      @@ -11,7 +11,19 @@
       name = test
       url = https://lab.mitty.jp/trac/test/
      
      +[repositories]
      
      (snip)
      
      +test2.url = http://lab.mitty.jp/svn/test2/
      +
      +.alias = test
      +
       [trac]
      
      (snip)
      
    • ".alias"を変更することで「規定のリポジトリ」が変更される
      trac browser with '.alias = ' changed trac browser /trunk with '.alias = ' changed
    • タイムラインには変化はない
      trac timeline with '.alias = ' changed
  7. add post-commit to each repositories and symlink trac environment
    1. sudo ln -s /path/to/config/files/svn/hooks/post-commit /var/svn/lab/lab/hooks/
    2. sudo ln -s /path/to/config/files/svn/hooks/post-commit /var/svn/lab/test/hooks/
    3. sudo ln -s /path/to/config/files/svn/hooks/post-commit /var/svn/lab/test2/hooks/
    4. sudo ln -s test /var/trac/lab/lab.test
    5. sudo ln -s test /var/trac/lab/test2
    • ln -sを使って、post-commitが正常に「test」を更新できるようにする
    • 副作用として、「test」が三つ表示される
      trac environment list with symlink
  8. add .tracignore
    1. sudo vim /path/to/config/files/trac/conf/lab.tracignore
      .*
      lab.test
      test2
      
    2. sudo ln -s /path/to/config/files/trac/conf/lab.tracignore /var/trac/lab/.tracignore
    • .tracignoreを追加し、不必要なTracを一覧に表示させない
      trac environment list with symlink and .tracignore
    • 表示はさせないが、URLを知っていればアクセスは出来る

test post-commit

  • post-commitにより、リポジトリの更新はTrac側に通知される
    • D:\tmp>svn ci lab.test -m " * mkdir 5 for lab.test"
      Adding         lab.test\trunk\5
      
      Committed revision 5.
      
    • cat /var/trac/lab/test/log/svn-hooks-lab.test.log
      Changeset 5 added
      OK
      
    • 「lab.test」のrevisionが「5」に更新される
      trac browser cache updated by svn post-commit hook script

Attachments (24)

Download all attachments as: .zip