最初のチェックアウト

たいていの場合、Subversion リポジトリからプロジェクトを チェックアウト することで始まります。 リポジトリをチェックアウトすると、あなたのマシンにはリポジトリの「作業コピー」ができます。このコピーはコマンドラインで指定した Subversion リポジトリの HEAD (最新のリビジョン) になります。

$ svn checkout http://svn.collab.net/repos/svn/trunk
A    trunk/Makefile.in
A    trunk/ac-helpers
A    trunk/ac-helpers/install.sh
A    trunk/ac-helpers/install-sh
A    trunk/build.conf
…
リビジョン 8810 をチェックアウトしました。

Although the above example checks out the trunk directory, you can just as easily check out any deep subdirectory of a repository by specifying the subdirectory in the checkout URL:

$ svn checkout \
      http://svn.collab.net/repos/svn/trunk/subversion/tests/cmdline/
A    cmdline/revert_tests.py
A    cmdline/diff_tests.py
A    cmdline/autoprop_tests.py
A    cmdline/xmltests
A    cmdline/xmltests/svn-test.sh
…
Checked out revision 8810.

Since Subversion uses a 「copy-modify-merge」 model instead of 「lock-modify-unlock」 (see バージョン管理モデル項), you can start right in making changes to the files and directories in your working copy. Your working copy is just like any other collection of files and directories on your system. You can edit and change them, move them around, you can even delete the entire working copy and forget about it.

警告

While your working copy is 「just like any other collection of files and directories on your system」, you can edit files at will, but you must tell Subversion about everything else that you do. For example, if you want to copy or move an item in a working copy, you should use svn copy or svn move instead of the copy and move commands provided by your operating system. We'll talk more about them later in this chapter.

Unless you're ready to commit the addition of a new file or directory, or changes to existing ones, there's no need to further notify the Subversion server that you've done anything.

リポジトリのURLを唯一の引数として作業コピーをチェックアウトする こともできますが、リポジトリURLの後に、ディレクトリを指定することも できます。この場合、指定した新規のディレクトリ中に作業コピーを作ろうとします。 たとえば:

$  svn checkout http://svn.collab.net/repos/svn/trunk subv
A    subv/Makefile.in
A    subv/ac-helpers
A    subv/ac-helpers/install.sh
A    subv/ac-helpers/install-sh
A    subv/build.conf
…
リビジョン 8810 をチェックアウトしました。

That will place your working copy in a directory named subv instead of a directory named trunk as we did previously. The directory subv will be created if it doesn't already exist.

パスワードキャッシュの無効化

When you perform a Subversion operation that requires you to authenticate, by default Subversion caches your authentication credentials on disk. This is done for convenience, so that you don't have to continually re-enter your password for future operations. If you're concerned about caching your Subversion passwords,[3] you can disable caching either permanently or on a case-by-case basis.

To disable password caching for a particular one-time command, pass the --no-auth-cache option on the commandline. To permanently disable caching, you can add the line store-passwords = no to your local machine's Subversion configuration file. See クライアント証明のキャッシュ項 for details.

別のユーザとしての認証

Since Subversion caches auth credentials by default (both username and password), it conveniently remembers who you were acting as the last time you modified you working copy. But sometimes that's not helpful—particularly if you're working in a shared working copy, like a system configuration directory or a webserver document root. In this case, just pass the --username option on the commandline and Subversion will attempt to authenticate as that user, prompting you for a password if necessary.



[3] Of course, you're not terribly worried—first because you know that you can't really delete anything from Subversion and, secondly, because your Subversion password isn't the same as any of the other three million passwords you have, right? Right?