bitx_subdir

Subdirectory clone (extension module for mizchi/bit)

git
subdir
moon add mizchi/bitx_subdir@0.46.4
Download zip
Author
Version
0.46.4
License
Apache-2.0
Last updated
4 days ago
Downloads
52
README

#
SubdirError

pub suberror SubdirError {
SubdirNotFound(String)
InvalidPath(String)
CommitNotFound(
ObjectId
)
TreeNotFound(
ObjectId
)
IoError(String)
}

サブディレクトリ関連のエラー

#
SubdirError::to_string

fn SubdirError::to_string(self : SubdirError) -> String

#
DiffEntry

差分エントリ

#
DiffEntry::path

fn DiffEntry::path(self : DiffEntry) -> String

#
DiffEntry::to_string

fn DiffEntry::to_string(self : DiffEntry) -> String

#
SubdirCommit

pub struct SubdirCommit {
id :
ObjectId

subdir_tree :
ObjectId

message : String
author : String
timestamp : Int64
prev_commit :
ObjectId
?
}

サブディレクトリに影響するコミット情報

#
SubdirConfig

pub struct SubdirConfig {
worktree_path : String?
track_history : Bool
}

サブディレクトリリポジトリの設定

#
SubdirConfig::default

fn SubdirConfig::default() -> SubdirConfig

デフォルト設定を作成

#
SubdirInfo

pub struct SubdirInfo {
path : String
git_dir : String
config_path : String
initialized : Bool
}

初期化済みサブディレクトリの情報

#
SubdirInitConfig

pub struct SubdirInitConfig {
create_wrapper : Bool
verbose_marker : Bool
}

サブディレクトリ初期化の設定

#
SubdirInitConfig::default

#
SubdirInitConfig::new

fn SubdirInitConfig::new(create_wrapper? : Bool, verbose_marker? : Bool) -> SubdirInitConfig

#
SubdirRepo

pub struct SubdirRepo {
git_dir : String
subdir_path : String
current_commit :
ObjectId
?
subdir_tree :
ObjectId
?
bitfs :
Fs

config : SubdirConfig
}

SubdirRepo - サブディレクトリを独立リポジトリのように扱う

Git リポジトリの特定サブディレクトリを、擬似的な独立リポジトリとして操作できる。
  • サブディレクトリがルートとして見える
  • そのディレクトリに影響するコミット履歴のみを表示
  • 変更をコミットすると元リポジトリに反映

#
SubdirRepo::base_commit

現在のベースコミットを取得

#
SubdirRepo::commit

fn SubdirRepo::commit(self : SubdirRepo, fs : &
FileSystem
, rfs : &
RepoFileSystem
, message : String, author? : String, timestamp? : Int64) ->
ObjectId
raise SubdirError

サブディレクトリの変更を元リポジトリにコミット

#
SubdirRepo::diff

fn SubdirRepo::diff(self : SubdirRepo) -> Array[DiffEntry]

サブディレクトリの差分を取得

#
SubdirRepo::from_branch

fn SubdirRepo::from_branch(rfs : &
RepoFileSystem
, git_dir : String, branch : String, subdir_path : String, config? : SubdirConfig) -> SubdirRepo raise SubdirError

ブランチからサブディレクトリリポジトリを作成

#
SubdirRepo::from_commit

fn SubdirRepo::from_commit(rfs : &
RepoFileSystem
, git_dir : String, commit_id :
ObjectId
, subdir_path : String, config? : SubdirConfig) -> SubdirRepo raise SubdirError

コミットからサブディレクトリリポジトリを作成

#
SubdirRepo::from_head

fn SubdirRepo::from_head(rfs : &
RepoFileSystem
, git_dir : String, subdir_path : String, config? : SubdirConfig) -> SubdirRepo raise SubdirError

HEAD からサブディレクトリリポジトリを作成

#
SubdirRepo::fs

Fs を取得(内部アクセス用)

#
SubdirRepo::is_dirty

fn SubdirRepo::is_dirty(self : SubdirRepo) -> Bool

変更があるかどうか

#
SubdirRepo::load_workdir

fn SubdirRepo::load_workdir(self : SubdirRepo, rfs : &
RepoFileSystem
, workdir : String) -> Unit

ワーキングディレクトリの変更を bitfs に読み込む rfs: 実際のファイルシステム(OsFs など) workdir: ワーキングディレクトリのルートパス

#
SubdirRepo::log

サブディレクトリに影響するコミット履歴を取得

アルゴリズム:
  1. 開始コミットから親方向に辿る
  2. 各コミットでサブディレクトリのツリーIDを取得
  3. 前のコミットとツリーIDが異なる場合、そのコミットを含める

#
SubdirRepo::path

fn SubdirRepo::path(self : SubdirRepo) -> String

サブディレクトリのパスを取得

#
SubdirRepo::tree_id

サブディレクトリのツリーIDを取得

#
add_module_sparse_patterns

fn add_module_sparse_patterns(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, subdir_path : String, new_patterns : Array[String]) -> Unit raise SubdirError

モジュールの sparse checkout にパターンを追加

#
create_commit_in_repo

fn create_commit_in_repo(fs : &
FileSystem
, git_dir : String, tree_id :
ObjectId
, parent_id :
ObjectId
, message : String, author : String, timestamp : Int64) ->
ObjectId
raise SubdirError

Create a commit in the repository (public API for subdir-push)

#
deinit_module

fn deinit_module(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, repo_root : String, subdir_path : String) -> Unit

モジュールを削除

#
deinit_subdir

fn deinit_subdir(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, repo_root : String, subdir_path : String) -> Unit

初期化を解除

#
disable_module_sparse

fn disable_module_sparse(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, subdir_path : String) -> Unit raise SubdirError

モジュールの sparse checkout を無効化

#
extract_subdir_tree

コミットからサブディレクトリのツリーIDを抽出

#
generate_shell_env

fn generate_shell_env(git_dir : String, repo_root : String, subdir_path : String) -> Array[(String, String)]

シェル起動用の環境変数設定を生成

#
generate_shell_rc

fn generate_shell_rc(subdir_path : String) -> String

シェル起動用の RC スクリプトを生成

#
get_subdir_info

fn get_subdir_info(rfs : &
RepoFileSystem
, git_dir : String, _repo_root : String, subdir_path : String) -> SubdirInfo?

初期化済みサブディレクトリの情報を取得

#
init_module

fn init_module(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, repo_root : String, subdir_path : String) -> Unit raise SubdirError

サブディレクトリをモジュールとして初期化

#
init_module_sparse

fn init_module_sparse(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, subdir_path : String, cone? : Bool) -> Unit raise SubdirError

モジュールの sparse checkout を初期化

#
init_subdir

fn init_subdir(fs : &
FileSystem
, git_dir : String, repo_root : String, subdir_path : String, config : SubdirInitConfig) -> SubdirInfo raise SubdirError

サブディレクトリを初期化

#
is_module_initialized

fn is_module_initialized(rfs : &
RepoFileSystem
, git_dir : String, subdir_path : String) -> Bool

モジュールが初期化済みかチェック

#
is_module_sparse_enabled

fn is_module_sparse_enabled(rfs : &
RepoFileSystem
, git_dir : String, subdir_path : String) -> Bool

モジュールの sparse checkout が有効かチェック

#
is_subdir_initialized

fn is_subdir_initialized(rfs : &
RepoFileSystem
, git_dir : String, subdir_path : String) -> Bool

サブディレクトリが初期化済みかチェック

#
list_modules

fn list_modules(rfs : &
RepoFileSystem
, git_dir : String) -> Array[String]

初期化済みモジュール一覧を取得

#
matches_module_sparse

fn matches_module_sparse(path : String, patterns : Array[String]) -> Bool

パスが sparse パターンにマッチするかチェック

#
read_module_sparse_patterns

fn read_module_sparse_patterns(rfs : &
RepoFileSystem
, git_dir : String, subdir_path : String) -> Array[String]

モジュールの sparse checkout パターンを読み取り

#
set_module_sparse_patterns

fn set_module_sparse_patterns(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, subdir_path : String, patterns : Array[String]) -> Unit raise SubdirError

モジュールの sparse checkout パターンを設定(既存を置換)

#
sync_module

fn sync_module(fs : &
FileSystem
, rfs : &
RepoFileSystem
, git_dir : String, subdir_path : String) -> Unit raise SubdirError

モジュールの状態を親リポジトリと同期

#
write_module_sparse_patterns

fn write_module_sparse_patterns(fs : &
FileSystem
, git_dir : String, subdir_path : String, patterns : Array[String]) -> Unit raise SubdirError

モジュールの sparse checkout パターンを書き込み