easy-worktree 0.0.4__tar.gz → 0.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {easy_worktree-0.0.4 → easy_worktree-0.0.5}/PKG-INFO +1 -1
- {easy_worktree-0.0.4 → easy_worktree-0.0.5}/easy_worktree/__init__.py +32 -10
- {easy_worktree-0.0.4 → easy_worktree-0.0.5}/pyproject.toml +1 -1
- {easy_worktree-0.0.4 → easy_worktree-0.0.5}/.gitignore +0 -0
- {easy_worktree-0.0.4 → easy_worktree-0.0.5}/.python-version +0 -0
- {easy_worktree-0.0.4 → easy_worktree-0.0.5}/DEPLOY.md +0 -0
- {easy_worktree-0.0.4 → easy_worktree-0.0.5}/LICENSE +0 -0
- {easy_worktree-0.0.4 → easy_worktree-0.0.5}/README.md +0 -0
- {easy_worktree-0.0.4 → easy_worktree-0.0.5}/README_ja.md +0 -0
|
@@ -532,16 +532,26 @@ def cmd_add(args: list[str]):
|
|
|
532
532
|
# エイリアスを作成
|
|
533
533
|
if alias_name:
|
|
534
534
|
alias_path = base_dir.parent / alias_name
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
535
|
+
|
|
536
|
+
# 既存かどうかをチェック
|
|
537
|
+
is_updating = alias_path.is_symlink()
|
|
538
|
+
|
|
539
|
+
# 既存のシンボリックリンクを削除
|
|
540
|
+
if alias_path.is_symlink():
|
|
541
|
+
alias_path.unlink()
|
|
542
|
+
elif alias_path.exists():
|
|
543
|
+
# シンボリックリンクではないファイル/ディレクトリが存在
|
|
544
|
+
print(msg('error', f'{alias_name} exists but is not a symlink'), file=sys.stderr)
|
|
545
|
+
# post-add hook を実行
|
|
546
|
+
run_post_add_hook(worktree_path, work_name, base_dir, branch_name)
|
|
547
|
+
sys.exit(0) # worktree は作成できたので正常終了
|
|
548
|
+
|
|
549
|
+
# シンボリックリンクを作成
|
|
550
|
+
alias_path.symlink_to(worktree_path, target_is_directory=True)
|
|
551
|
+
|
|
552
|
+
if is_updating:
|
|
553
|
+
print(msg('alias_updated', alias_name, work_name))
|
|
543
554
|
else:
|
|
544
|
-
alias_path.symlink_to(worktree_path, target_is_directory=True)
|
|
545
555
|
print(msg('alias_created', alias_name, work_name))
|
|
546
556
|
|
|
547
557
|
# post-add hook を実行
|
|
@@ -714,6 +724,14 @@ def cmd_clean(args: list[str]):
|
|
|
714
724
|
# worktree 情報を取得
|
|
715
725
|
worktrees = get_worktree_info(base_dir)
|
|
716
726
|
|
|
727
|
+
# エイリアスで使われている worktree を取得
|
|
728
|
+
parent_dir = base_dir.parent
|
|
729
|
+
aliased_worktrees = set()
|
|
730
|
+
for item in parent_dir.iterdir():
|
|
731
|
+
if item.is_symlink() and item.name != '_base':
|
|
732
|
+
target = item.resolve()
|
|
733
|
+
aliased_worktrees.add(target)
|
|
734
|
+
|
|
717
735
|
# 削除対象を抽出(_baseは除外)
|
|
718
736
|
targets = []
|
|
719
737
|
now = datetime.now()
|
|
@@ -725,6 +743,10 @@ def cmd_clean(args: list[str]):
|
|
|
725
743
|
if path.name == '_base':
|
|
726
744
|
continue
|
|
727
745
|
|
|
746
|
+
# エイリアスで使われている worktree は除外
|
|
747
|
+
if path in aliased_worktrees:
|
|
748
|
+
continue
|
|
749
|
+
|
|
728
750
|
# clean状態のものだけが対象
|
|
729
751
|
if not wt.get('is_clean'):
|
|
730
752
|
continue
|
|
@@ -966,7 +988,7 @@ def show_help():
|
|
|
966
988
|
|
|
967
989
|
def show_version():
|
|
968
990
|
"""Show version information"""
|
|
969
|
-
print("easy-worktree version 0.0.
|
|
991
|
+
print("easy-worktree version 0.0.5")
|
|
970
992
|
|
|
971
993
|
|
|
972
994
|
def main():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|