wip: feat: workspace tmux remove
This commit is contained in:
parent
0bdfb253ef
commit
7b1a33414a
2 changed files with 3 additions and 5 deletions
|
|
@ -79,7 +79,7 @@ select = [
|
||||||
"TID", # flake8-tidy-imports
|
"TID", # flake8-tidy-imports
|
||||||
"TCH", # flake8-type-checking
|
"TCH", # flake8-type-checking
|
||||||
# "INT", # flake8-gettext
|
# "INT", # flake8-gettext
|
||||||
# "ARG", # flake8-unused-arguments
|
"ARG", # flake8-unused-arguments
|
||||||
"PTH", # flake8-use-pathlib
|
"PTH", # flake8-use-pathlib
|
||||||
"ERA", # eradicate
|
"ERA", # eradicate
|
||||||
"PD", # pandas-vet
|
"PD", # pandas-vet
|
||||||
|
|
|
||||||
|
|
@ -676,7 +676,7 @@ def find_repo_for_worktree(worktree_path: Path, repos_dir: Path) -> Optional[Pat
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def has_unpushed_commits(repo_path: Path, branch: str) -> bool:
|
def has_unpushed_commits(repo_path: Path) -> bool:
|
||||||
"""
|
"""
|
||||||
Detect if branch has commits not on its upstream.
|
Detect if branch has commits not on its upstream.
|
||||||
Uses 'git rev-list @{u}..HEAD'; if non-empty, there are unpushed commits.
|
Uses 'git rev-list @{u}..HEAD'; if non-empty, there are unpushed commits.
|
||||||
|
|
@ -839,7 +839,7 @@ def remove_workspace(
|
||||||
|
|
||||||
# Only care about "unpushed commits" if the branch is NOT integrated into main.
|
# Only care about "unpushed commits" if the branch is NOT integrated into main.
|
||||||
if repo is not None and branch != "?" and not integrated:
|
if repo is not None and branch != "?" and not integrated:
|
||||||
if has_unpushed_commits(wt, branch):
|
if has_unpushed_commits(wt):
|
||||||
problems.append(f"{wt.name}: unpushed commits on '{branch}'")
|
problems.append(f"{wt.name}: unpushed commits on '{branch}'")
|
||||||
if problems and not force:
|
if problems and not force:
|
||||||
console.print(
|
console.print(
|
||||||
|
|
@ -1563,7 +1563,6 @@ def tmux_cli_attach(
|
||||||
|
|
||||||
@tmux_app.command("list-sessions")
|
@tmux_app.command("list-sessions")
|
||||||
def tmux_cli_list_sessions(
|
def tmux_cli_list_sessions(
|
||||||
ctx: typer.Context,
|
|
||||||
workspace: Optional[str] = typer.Option(
|
workspace: Optional[str] = typer.Option(
|
||||||
None,
|
None,
|
||||||
"--workspace",
|
"--workspace",
|
||||||
|
|
@ -1591,7 +1590,6 @@ def tmux_cli_list_sessions(
|
||||||
|
|
||||||
@tmux_app.command("remove")
|
@tmux_app.command("remove")
|
||||||
def tmux_cli_remove(
|
def tmux_cli_remove(
|
||||||
ctx: typer.Context,
|
|
||||||
workspace: Optional[str] = typer.Option(
|
workspace: Optional[str] = typer.Option(
|
||||||
None,
|
None,
|
||||||
"--workspace",
|
"--workspace",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue