git-hunk 0.4.1__tar.gz → 0.4.2__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.
- {git_hunk-0.4.1 → git_hunk-0.4.2}/PKG-INFO +1 -1
- {git_hunk-0.4.1 → git_hunk-0.4.2}/git_hunk/_cli.py +29 -17
- {git_hunk-0.4.1 → git_hunk-0.4.2}/git_hunk/_git.py +4 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/.gitignore +0 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/LICENSE +0 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/README.md +0 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/git_hunk/__init__.py +0 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/git_hunk/__main__.py +0 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/git_hunk/_hunk.py +0 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/git_hunk/_lines.py +0 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/git_hunk/_patch.py +0 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/git_hunk/_skills.py +0 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/git_hunk/_ui.py +0 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/git_hunk/skills/core/SKILL.md +0 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/git_hunk/skills/logical-commits/SKILL.md +0 -0
- {git_hunk-0.4.1 → git_hunk-0.4.2}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: git-hunk
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Non-interactive, programmatic git hunk staging with durable Hunk IDs.
|
|
5
5
|
Project-URL: Homepage, https://github.com/wkentaro/git-hunk
|
|
6
6
|
Project-URL: Issues, https://github.com/wkentaro/git-hunk/issues
|
|
@@ -428,6 +428,7 @@ def _apply_selection(
|
|
|
428
428
|
hunk for hunk in selected if hunk.binary or hunk.change_kind == "T"
|
|
429
429
|
]
|
|
430
430
|
|
|
431
|
+
changes_applied = False
|
|
431
432
|
try:
|
|
432
433
|
patch = (
|
|
433
434
|
build_patch(patch_hunks, diff_output, reverse=reverse)
|
|
@@ -472,6 +473,7 @@ def _apply_selection(
|
|
|
472
473
|
reverse=reverse,
|
|
473
474
|
dry_run=False,
|
|
474
475
|
)
|
|
476
|
+
changes_applied = True
|
|
475
477
|
if file_command_files:
|
|
476
478
|
if reverse and not cached:
|
|
477
479
|
discard_files(file_command_files, worktree_root=worktree_root)
|
|
@@ -482,6 +484,7 @@ def _apply_selection(
|
|
|
482
484
|
worktree_root=worktree_root,
|
|
483
485
|
dry_run=False,
|
|
484
486
|
)
|
|
487
|
+
changes_applied = True
|
|
485
488
|
if tracked_file_command_files:
|
|
486
489
|
unstage_files(
|
|
487
490
|
tracked_file_command_files,
|
|
@@ -494,7 +497,13 @@ def _apply_selection(
|
|
|
494
497
|
dry_run=False,
|
|
495
498
|
)
|
|
496
499
|
except RuntimeError as exc:
|
|
497
|
-
|
|
500
|
+
message = str(exc)
|
|
501
|
+
if changes_applied:
|
|
502
|
+
message = (
|
|
503
|
+
f"{message}; earlier changes were applied, so the repository may be "
|
|
504
|
+
"partially changed; inspect its state before retrying"
|
|
505
|
+
)
|
|
506
|
+
raise CliError(message) from exc
|
|
498
507
|
|
|
499
508
|
return selected
|
|
500
509
|
|
|
@@ -553,22 +562,25 @@ def _working_tree_mode(*, path: str) -> str:
|
|
|
553
562
|
|
|
554
563
|
|
|
555
564
|
def _get_untracked_entries(*, worktree_root: str) -> list[Hunk]:
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
565
|
+
try:
|
|
566
|
+
paths = get_untracked_files(worktree_root=worktree_root)
|
|
567
|
+
if not paths:
|
|
568
|
+
return []
|
|
569
|
+
return [
|
|
570
|
+
whole_file_hunk(
|
|
571
|
+
p,
|
|
572
|
+
change_kind="A",
|
|
573
|
+
a_mode=None,
|
|
574
|
+
b_mode=_working_tree_mode(path=posixpath.join(worktree_root, p)),
|
|
575
|
+
binary=False,
|
|
576
|
+
a_object_id=None,
|
|
577
|
+
b_object_id=None,
|
|
578
|
+
status="untracked",
|
|
579
|
+
)
|
|
580
|
+
for p in paths
|
|
581
|
+
]
|
|
582
|
+
except (OSError, RuntimeError) as exc:
|
|
583
|
+
raise CliError(str(exc)) from exc
|
|
572
584
|
|
|
573
585
|
|
|
574
586
|
def _filter_inventory_hunks(
|
|
@@ -48,9 +48,13 @@ def get_diff(*, worktree_root: str, staged: bool) -> str:
|
|
|
48
48
|
# floor stays at --no-relative's 2.28 instead of --default-prefix's 2.41.
|
|
49
49
|
# --no-color: a color.diff or color.ui set to always emits ANSI escapes
|
|
50
50
|
# even into a pipe, and the parse would find nothing.
|
|
51
|
+
# Display drivers can replace source patches with transformed or empty
|
|
52
|
+
# output, while inventory and mutation need the canonical source bytes.
|
|
51
53
|
args = [
|
|
52
54
|
"diff",
|
|
53
55
|
"--no-color",
|
|
56
|
+
"--no-ext-diff",
|
|
57
|
+
"--no-textconv",
|
|
54
58
|
"--no-relative",
|
|
55
59
|
"--src-prefix=a/",
|
|
56
60
|
"--dst-prefix=b/",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|