The Subversion functions work quite well for me, after some searching. I needed some time though to find out how they all worked together, but this is a basic example of svn_fs_is_file:
<?php
# Get a handle to the on-disk repository. Note that this
# is NOT a checked out project, but the actual svn repository!
$repos_handle = svn_repos_open('/var/lib/svn');
$fs_handle = svn_repos_fs($repos_handle);
# Now we need to open a revision because that's what the
# svn_fs_* methods need. You'll probably want the latest
# revision and we have a helper method for that.
$youngest_rev = svn_fs_youngest_rev($fs_handle);
$fs_rev_handle = svn_fs_revision_root($fs_handle, $youngest_rev);
# Now we can actually start doing stuff, for example the
# svn_fs_is_file call:
print_r(svn_fs_is_file($fs_rev_handle, '/a-file.txt'));
?>
There is one important thing to note about this all. You cannot let the handles expire while doing any calls to svn_fs_*. When implementing a helper class, I cached the first and third handle, but not the second one. PHP crashes hard when you do this. Keep references to all handles you get while you're calling the svn_fs_* methods.
SVN 関数
目次
- svn_add — 作業ディレクトリ内のアイテムの追加を予約する
- svn_auth_get_parameter — 認証パラメータを取得する
- svn_auth_set_parameter — 認証パラメータを設定する
- svn_blame — ファイルの SVN blame を取得する
- svn_cat — リポジトリ内のファイルの内容を返す
- svn_checkout — リポジトリから作業コピーをチェックアウトする
- svn_cleanup — 作業コピーディレクトリを再帰的にクリーンアップし、中途半端な操作を解消してロックを削除する
- svn_client_version — SVN クライアントライブラリのバージョンを返す
- svn_commit — 変更内容を、ローカルの作業コピーからリポジトリに送信する
- svn_diff — ふたつのパスの差分を再帰的に取得する
- svn_export — SVN ディレクトリの内容をエクスポートする
- svn_fs_abort_txn — トランザクションを中断し、成功したら true、失敗したら false を返す
- svn_fs_apply_text — 置換に使用するストリームを作成して返す
- svn_fs_begin_txn2 — 新しいトランザクションを作成する
- svn_fs_change_node_prop — 成功したら true、失敗したら false を返す
- svn_fs_check_path — 指定したリポジトリの fsroot パスにどんなアイテムが存在するかを調べる
- svn_fs_contents_changed — コンテンツが変更されている場合に true、されていない場合に false を返す
- svn_fs_copy — ファイルやディレクトリをコピーし、成功したら true、失敗したら false を返す
- svn_fs_delete — ファイルやディレクトリを削除し、成功したら true、失敗したら false を返す
- svn_fs_dir_entries — 指定したパスのディレクトリを列挙し、ディレクトリ名とファイルタイプのハッシュを返す
- svn_fs_file_contents — 指定したバージョンの fs から、ファイルの中身を読み込むためのストリームを返す
- svn_fs_file_length — 指定したバージョンの fs から、ファイルの長さを返す
- svn_fs_is_dir — ディレクトリを指すパスである場合に true、それ以外の場合に false を返す
- svn_fs_is_file — ファイルを指すパスである場合に true、それ以外の場合に false を返す
- svn_fs_make_dir — 空のディレクトリを作成し、成功したら true、失敗したら false を返す
- svn_fs_make_file — 空のファイルを作成し、成功したら true、失敗したら false を返す
- svn_fs_node_created_rev — fsroot 配下のパスが作成されたリビジョンを返す
- svn_fs_node_prop — ノードのプロパティの値を返す
- svn_fs_props_changed — プロパティが変更されている場合に true、それ以外の場合に false を返す
- svn_fs_revision_prop — 指定したプロパティの値を取得する
- svn_fs_revision_root — リポジトリのルートの指定したバージョンのハンドルを取得する
- svn_fs_txn_root — トランザクションのルートを作成して返す
- svn_fs_youngest_rev — ファイルシステム内で一番若いリビジョン番号を返す
- svn_import — バージョン管理されていないパスをリポジトリにインポートする
- svn_log — 指定したリポジトリ URL のコミットログメッセージを返す
- svn_ls — 指定したリポジトリ URL のディレクトリ内の一覧を返す (オプションでリビジョン番号も指定可能)
- svn_mkdir — 作業コピーあるいはリポジトリ内にディレクトリを作成する
- svn_repos_create — 新しい subversion リポジトリを指定したパスに作成する
- svn_repos_fs_begin_txn_for_commit — 新しいトランザクションを作成する
- svn_repos_fs_commit_txn — トランザクションをコミットし、新しいリビジョンを返す
- svn_repos_fs — リポジトリ用に、ファイルシステム上のハンドルを取得する
- svn_repos_hotcopy — repospath にあるリポジトリのホットコピーを作成し、destpath にコピーする
- svn_repos_open — リポジトリの共有ロックをオープンする
- svn_repos_recover — 指定したパスのリポジトリのリカバリ処理を実行する
- svn_revert — 作業コピーへの変更を取り消す
- svn_status — 作業コピー内のファイルやディレクトリの状態を返す
- svn_update — 作業コピーをアップデートする
SVN 関数
Pieter van Ginkel
22-Mar-2008 05:23
22-Mar-2008 05:23
tbrendstrup
19-Mar-2008 06:49
19-Mar-2008 06:49
"[Editorial note: These constants are defined by the Subversion library itself and may change without notice (although things tend to be quite stable).]"
The subversion developers have a policy not to change stuff like this without changing the major version number, so these should be valid at least until subversion 2.0.0 is released. (more values might be added, but the existing ones won't change).
pierre dot beaumadier at rhapso dot fr
03-Oct-2007 10:59
03-Oct-2007 10:59
[Editorial note: These constants are defined by the Subversion library itself and may change without notice (although things tend to be quite stable).]
For information, here are the numeric values I got for the constants :
Working copy status constants :
* svn_wc_status_none => 1
* svn_wc_status_unversioned => 2
* svn_wc_status_normal => 3
* svn_wc_status_added => 4
* svn_wc_status_missing => 5
* svn_wc_status_deleted => 6
* svn_wc_status_replaced => 7
* svn_wc_status_modified => 8
* svn_wc_status_merged => 9
* svn_wc_status_conflicted => 10
* svn_wc_status_ignored => 11
* svn_wc_status_obstructed => 12
* svn_wc_status_external => 13
* svn_wc_status_incomplete => 14
Node type constants :
* svn_node_none => 0
* svn_node_file => 1
* svn_node_dir => 2
* svn_node_unknown => 3
