The Hackerlab at regexps.com

最初のリビジョンのインポート

up: arch Meets hello-world
next: 変更点のチェックイン
prev: ソースのインベントリ Id

ちょっとおさらい: ここまでの例をならってるなら, この時点であるものは:

あなたの arch ユーザ ID arch へ自己紹介で, arch があなたを識別するために使う ID 文字列を設定しました.

あなたの最初のアーカイブ 新規アーカイブの作成で, あなたの最初のアーカイブを作成して, これをデフォルトアーカイブにしました. 新規プロジェクトの開始で, このアーカイブに hello-world プロジェクトを追加しました。

あなたの初期のソースツリー 新規ソースツリーの開始で, hello-world用のソースを, arch のプロジェクトツリーとして, 初期設定を始めました. ソースのインベントリ Idで, そのプロジェクトのソースファイルにインベントリ id を割り当てました.

さて, とうとう, hello-world のソースをアーカイブにインポートする時です. これは二つの段階を踏みます: (1) ログメッセージの生成; (2) ソースのインポート.

最初のログファイルを作成する

あなたは、アーカイブに hello-world の新規 リビジョン (revision) をまさに作成するところです: これは特定の時点で, そのプロジェクトがどのように見えるかの記録です.

新しいリビジョンを作成する場合は常に、 第一歩は, そのリビジョンのログファイルの作成です:


        % cd ~/wd/hello-world

        % tla make-log
        ++log.hello-world--mainline--0.1--lord@emf.net--2003-example


コマンドからの出力は、いまあなたが編集しなければならないファイル名です。 初期状態では次を含みます:

        Summary: 
        Keywords: 

このファイルを電子メールを書くように記入すべきです. Summary: 欄にはリビジョンの手短な説明を追加して, 本文に 完全な説明を加えます. ちょうど電子メールでのように、本文はブランク行で ヘッダから分離されなければなりません. 書き終えたら, ログは次のようになっているでしょう:

        Summary: initial import
        Keywords: 

        This is the initial import of `hello-world', the killer app
        that will propel our new .com company to a successful IPO.


vi ファンへの使用上の注意: ログメッセージのデフォルトのファイル名は + という文字から始まります。 vi は、+で始まる引数を, 通常の引数としてではなく, オプションとして扱うという意味において非標準的なプログラムです。 したがって、 vi のためにファイル名をタイプするときは 必ず ./ から入力してください. こんな具合です:

    % vi ./++log.hello-world--mainline--0.1--lord@emf.net--2003-example

または単にこうでも良いです:

    % vi `tla make-log`

近道のメモ: 本節では初期のインポートに伴なう ログエントリーを書くための"遠まわりな方法"を記述します. この段階を飛ばすような近道もあります: tla import-L-s オプションです. ここでは遠まわりな方法をひと通り見てみましたが, 近道の方法を 習うために, あとで tla import -H を試してはどうでしょうか.

最初のリビジョンをアーカイブに格納する

とうとう、アーカイブへソースを追加するよう arch に 依頼できます:

        % tla import
        [....]

注意: もし, 次のようなエラー These apparent source files lack inventory ids (これら見かけ上のソースファイルはインベントリ ID を欠落してます) を受けとったら, ソースのインベントリ Id を再読し、各ファイルを add するか、名前の id-tagging-method を変更してください.

いくつかの方法でそのコマンドの副作用を観察できます。

その一つとして, 私たちのプロジェクトのアーカイブに, どのリビジョンが存在するかを arch に問い合わせることができます:

        % tla revisions hello-world--mainline--0.1
        base-0

実際、より詳細を得ることができます:

        % tla revisions --summary --creator --date \
                          hello-world--mainline--0.1 
        base-0
            2003-01-28 00:45:50 GMT
            Tom (testing) Lord <lord@emf.net>
            initial import

プロジェクトツリーで何が変更されたでしょう? パッチログ と呼ばれるものを持っていることを思い出しましょう:

        % tla log-versions
        lord@emf.net--2003-example/hello-world--mainline--0.1

それには次のような項目があります:

        % tla logs hello-world--mainline--0.1
        base-0

        % tla logs --summary --creator --date \
                       hello-world--mainline--0.1
        base-0
            2003-01-28 00:45:50 GMT
            Tom (testing) Lord <lord@emf.net>
            initial import

        % tla cat-log hello-world--mainline--0.1--base-0
        Revision: hello-world--mainline--0.1--base-0
        Archive: lord@emf.net--2003-example
        Creator: Tom (testing) Lord <lord@emf.net>
        Date: Mon Jan 27 16:45:50 PST 2003
        Standard-date: 2003-01-28 00:45:50 GMT
        Summary: initial import
        Keywords: 
        New-files: ./hw.c ./main.c
        New-patches: \
          lord@emf.net--2003-example/hello-world--mainline--0.1--base-0

        This is the initial import of `hello-world', the killer app
        that will propel our new .com company to a successful IPO.

import からのリビジョンの名前

import はアーカイブに新しいリビジョンを作成しました。 それが作成したリビジョンは base-0 と呼ばれます. そのリビジョンの長い名前を作るのは, そこに カテゴリ、ブランチおよびバージョンを前置するとできます:

        hello-world--mainline--0.1--base-0
        ^^^^^^^^^^^  ^^^^^^^^  ^^^  ^^^^^^
             |          |       |     |
             |          |       |    パッチレベル名
             |          |       |
             |          |     バージョン番号
             |          |
             |     ブランチ名
             |
         カテゴリ名

アーカイブ名を加えると, 完全修飾リビジョン名 (fully qualified revision name) と呼ばれるものになります. これはリビジョンの大域的に唯一な識別子です:

    lord@emf.net--2003-example/hello-world--mainline--0.1--base-0
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
                |
          アーカイブ名

完全修飾名は、後の章で分散リポジトリについて習うにつれて重要性が増すことでしょう.

それはどのように作動するか -- import は何をするか

import がアーカイブに何をしたかを調べましょう:

        # cd to the directory for the version we are working 
        # on:
        # 
        % cd ~/{archives}
        % cd 2003-example/
        % cd hello-world/
        % cd hello-world--mainline/
        % cd hello-world--mainline--0.1/
        % ls
        base-0

リビジョンに対して新しい base-0 ディレクトリを作成しました.

        % cd base-0
        % ls
        +revision-lock
        hello-world--mainline--0.1--base-0.src.tar.gz
        log

いつものように, +revision-lock ファイルは arch があらゆる状況下で, アーカイブを一貫した状態に 維持するため内部的に使うものです.

log ファイルは、あなたが書いたログメッセージの コピーで, 付加的なヘッダが追加されてます:

        % cat log
        Revision: hello-world--mainline--0.1--base-0
        Archive: lord@emf.net--2003-example
        Creator: Tom (testing) Lord <lord@emf.net>
        Date: Mon Jan 27 16:45:50 PST 2003
        Standard-date: 2003-01-28 00:45:50 GMT
        Summary: initial import
        Keywords: 
        New-files: ./hw.c ./main.c
        New-patches: \
          lord@emf.net--2003-example/hello-world--mainline--0.1--base-0

        This is the initial import of `hello-world', the killer app
        that will propel our new .com company to a successful IPO.


最後に、圧縮された tar ファイルはあなたのプロジェクトツリーのソースファイルのコピーです。

        % tar ztf hello-world--mainline--0.1--base-0.src.tar.gz
        hello-world--mainline--0.1--base-0/
        hello-world--mainline--0.1--base-0/hw.c
        hello-world--mainline--0.1--base-0/main.c
        hello-world--mainline--0.1--base-0/{arch}/
        hello-world--mainline--0.1--base-0/{arch}/.arch-project-tree
        hello-world--mainline--0.1--base-0/{arch}/=tagging-method
        hello-world--mainline--0.1--base-0/{arch}/hello-world/
        [....]

tar ファイルがあなたのプロジェクトツリーからのすべてのファイルを含むとは限らないことに気づくでしょう. 特に、それは次のコマンドでリストされるファイルを含んでいます:

        % cd ~/wd/hello-world

        % tla inventory --source --both --all
        [....]

最後に、プロジェクトツリーの {arch} サブディレクトリの中を捜し回れば、二つ新しい物を発見するでしょう:

        % ls
        ++default-version       =tagging-method
        ++pristine-trees        hello-world

ディレクトリ ++pristine-trees は、 あなたが丁度インポートしたツリーのコピーを(ある深さで)含みます. これは他の arch コマンドで使われるキャッシュコピーです。 (注: arch の将来のリリースでは、 ++pristine-trees サブディレクトリは別の仕組みのものに 取って代わりそうです.)

もし hello-world (パッチログ)ディレクトリに注意して 調べると, あなたが丁度作成したリビジョンのログファイルのローカルなコピー (にそのログファイルに余分なヘッダが加えられたもの) を見つけることができます

arch Meets hello-world: A Tutorial Introduction to The arch Revision Control System
The Hackerlab at regexps.com