gitbolt 0.0.0.dev22__tar.gz → 0.0.0.dev23__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.
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/PKG-INFO +1 -1
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/pyproject.toml +1 -1
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/base.py +29 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/impl/simple.py +9 -4
- gitbolt-0.0.0.dev22/src/gitbolt/subprocess/utils/cmd.py → gitbolt-0.0.0.dev23/src/gitbolt/subprocess/utils/main_cmd.py +37 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt.egg-info/PKG-INFO +1 -1
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt.egg-info/SOURCES.txt +1 -1
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/LICENSE +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/README.md +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/setup.cfg +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/__init__.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/_internal_init.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/add.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/base.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/constants.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/exceptions.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/ls_tree.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/models.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/py.typed +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/pytest_plugin.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/__init__.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/_internal_init.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/add.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/constants.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/exceptions.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/impl/__init__.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/ls_tree.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/runner/__init__.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/runner/base.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/runner/simple.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/utils/__init__.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/utils/models.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/utils/session.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/subprocess/worktree.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt/utils.py +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt.egg-info/dependency_links.txt +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt.egg-info/entry_points.txt +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt.egg-info/requires.txt +0 -0
- {gitbolt-0.0.0.dev22 → gitbolt-0.0.0.dev23}/src/gitbolt.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitbolt
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev23
|
|
4
4
|
Summary: Fast, flexible and type-safe Git commands in Python.
|
|
5
5
|
Author-email: Suhas Krishna Srivastava <suhas.srivastava@vaastav.tech>
|
|
6
6
|
Maintainer-email: Suhas Krishna Srivastava <suhas.srivastava@vaastav.tech>
|
|
@@ -56,6 +56,35 @@ class GitCommand(Git, ABC):
|
|
|
56
56
|
|
|
57
57
|
For example, ``--no-pager --no-advice`` is the git main command in ``git --no-pager --no-advice log master -1``.
|
|
58
58
|
|
|
59
|
+
Examples:
|
|
60
|
+
|
|
61
|
+
- No CLI args to build
|
|
62
|
+
|
|
63
|
+
>>> import gitbolt
|
|
64
|
+
>>> _git = gitbolt.get_git_command()
|
|
65
|
+
>>> assert _git.build_main_cmd_args() == []
|
|
66
|
+
|
|
67
|
+
- One CLI arg to override
|
|
68
|
+
|
|
69
|
+
>>> _git = gitbolt.get_git_command()
|
|
70
|
+
>>> _m_git = _git.git_opts_override(C=[Path("dir/my/dir")])
|
|
71
|
+
>>> _o_git = _m_git.git_opts_override(C=[Path("other/dir")])
|
|
72
|
+
>>> assert _o_git.build_main_cmd_args() == ["-C", str(Path("other/dir"))]
|
|
73
|
+
|
|
74
|
+
- Multiple CLI args to override
|
|
75
|
+
|
|
76
|
+
>>> _git = gitbolt.get_git_command()
|
|
77
|
+
>>> _m_git = _git.git_opts_override(C=[Path("dir/my/dir")], config_env=dict(u1="user1", u2="user2"))
|
|
78
|
+
>>> _o_git = _m_git.git_opts_override(C=[Path("other/dir")])
|
|
79
|
+
>>> assert _o_git.build_main_cmd_args() == ["-C", str(Path("other/dir")), "--config-env", "u1=user1", "--config-env", "u2=user2"]
|
|
80
|
+
|
|
81
|
+
- Multiple CLI args to override when CLI is preferred
|
|
82
|
+
|
|
83
|
+
>>> _git = gitbolt.get_git_command(prefer_cli=True)
|
|
84
|
+
>>> _m_git = _git.git_opts_override(C=[Path("dir/my/dir")], config_env=dict(u1="user1", u2="user2"))
|
|
85
|
+
>>> _o_git = _m_git.git_opts_override(C=[Path("other/dir")])
|
|
86
|
+
>>> assert _o_git.build_main_cmd_args() == ["-C", str(Path("other/dir")), "--config-env", "u1=user1", "--config-env", "u2=user2"]
|
|
87
|
+
|
|
59
88
|
:return: CLI args for git main cli command.
|
|
60
89
|
"""
|
|
61
90
|
return (
|
|
@@ -14,7 +14,7 @@ from typing import override, Literal, overload, Callable
|
|
|
14
14
|
|
|
15
15
|
from vt.utils.commons.commons.op import RootDirOp
|
|
16
16
|
|
|
17
|
-
from gitbolt.base import Version
|
|
17
|
+
from gitbolt.base import Version
|
|
18
18
|
from gitbolt.add import AddArgsValidator
|
|
19
19
|
from gitbolt.subprocess import (
|
|
20
20
|
GitCommand,
|
|
@@ -31,6 +31,7 @@ from gitbolt.subprocess.ls_tree import LsTreeCLIArgsBuilder
|
|
|
31
31
|
from gitbolt.subprocess.runner import GitCommandRunner
|
|
32
32
|
from gitbolt.subprocess.runner.simple import SimpleGitCR
|
|
33
33
|
from gitbolt.ls_tree import LsTreeArgsValidator
|
|
34
|
+
from gitbolt.subprocess.utils.main_cmd import git_main_opts_clean_cap_c
|
|
34
35
|
from gitbolt.subprocess.worktree import WorktreeCLIArgsBuilder
|
|
35
36
|
|
|
36
37
|
|
|
@@ -452,12 +453,16 @@ class CLISimpleGitCommand(SimpleGitCommand):
|
|
|
452
453
|
|
|
453
454
|
@override
|
|
454
455
|
def build_main_cmd_args(self) -> list[str]:
|
|
456
|
+
super_cli_cmd_opts = super().build_main_cmd_args()
|
|
455
457
|
if self._main_cmd_cli_opts:
|
|
458
|
+
if "-C" in self._main_cmd_cli_opts:
|
|
459
|
+
# only need to clean -C from the original CLI opts if the main CLI opts have them.
|
|
460
|
+
super_cli_cmd_opts = git_main_opts_clean_cap_c(super_cli_cmd_opts)
|
|
456
461
|
if self.prefer_cli:
|
|
457
|
-
return
|
|
462
|
+
return super_cli_cmd_opts + self._main_cmd_cli_opts
|
|
458
463
|
else:
|
|
459
|
-
return self._main_cmd_cli_opts +
|
|
460
|
-
return
|
|
464
|
+
return self._main_cmd_cli_opts + super_cli_cmd_opts
|
|
465
|
+
return super_cli_cmd_opts
|
|
461
466
|
|
|
462
467
|
@override
|
|
463
468
|
def build_git_envs(self) -> dict[str, str] | None:
|
|
@@ -177,3 +177,40 @@ def git_main_cmd_pair_flag_args(val: Any, cmd_flag: str) -> list[str]:
|
|
|
177
177
|
[]
|
|
178
178
|
"""
|
|
179
179
|
return [cmd_flag, str(val)] if not_none_not_unset(val) else []
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def git_main_opts_clean_cap_c(main_opts: list[str]) -> list[str]:
|
|
183
|
+
"""
|
|
184
|
+
Clean the cap C of -C CLI options from the CLI command list. This function removes the ``-C`` CLI option and its
|
|
185
|
+
values from the supplied param list.
|
|
186
|
+
|
|
187
|
+
>>> assert git_main_opts_clean_cap_c([]) == []
|
|
188
|
+
|
|
189
|
+
>>> assert git_main_opts_clean_cap_c(["--no-pager"]) == ["--no-pager"]
|
|
190
|
+
|
|
191
|
+
>>> assert git_main_opts_clean_cap_c(["--no-pager", "-C", "/root", "-C", "dir", "-C", "file"]) == ["--no-pager"]
|
|
192
|
+
|
|
193
|
+
>>> assert git_main_opts_clean_cap_c(["-C", "/root", "-C", "dir", "-C", "file", "--no-pager"]) == ["--no-pager"]
|
|
194
|
+
|
|
195
|
+
>>> assert git_main_opts_clean_cap_c(["-C", "/root", "-C", "dir", "--no-pager", "-C", "file"]) == ["--no-pager"]
|
|
196
|
+
|
|
197
|
+
>>> assert git_main_opts_clean_cap_c(["-C", "/root", "-C", "dir", "-C", "file"]) == []
|
|
198
|
+
|
|
199
|
+
:param main_opts: git CLI command options.
|
|
200
|
+
:returns: command line options after removing -C options and its values.
|
|
201
|
+
"""
|
|
202
|
+
cap_c_indices: list[int] = []
|
|
203
|
+
main_opts_copy = main_opts.copy()
|
|
204
|
+
try:
|
|
205
|
+
i=0
|
|
206
|
+
while i<len(main_opts):
|
|
207
|
+
found_index = main_opts_copy.index("-C", i)
|
|
208
|
+
cap_c_indices.append(found_index)
|
|
209
|
+
i=found_index+1
|
|
210
|
+
except ValueError:
|
|
211
|
+
# didn't find -C or done finding -C
|
|
212
|
+
pass
|
|
213
|
+
for cap_c_index in reversed(cap_c_indices):
|
|
214
|
+
del main_opts_copy[cap_c_index+1]
|
|
215
|
+
del main_opts_copy[cap_c_index]
|
|
216
|
+
return main_opts_copy
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitbolt
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev23
|
|
4
4
|
Summary: Fast, flexible and type-safe Git commands in Python.
|
|
5
5
|
Author-email: Suhas Krishna Srivastava <suhas.srivastava@vaastav.tech>
|
|
6
6
|
Maintainer-email: Suhas Krishna Srivastava <suhas.srivastava@vaastav.tech>
|
|
@@ -32,6 +32,6 @@ src/gitbolt/subprocess/runner/__init__.py
|
|
|
32
32
|
src/gitbolt/subprocess/runner/base.py
|
|
33
33
|
src/gitbolt/subprocess/runner/simple.py
|
|
34
34
|
src/gitbolt/subprocess/utils/__init__.py
|
|
35
|
-
src/gitbolt/subprocess/utils/
|
|
35
|
+
src/gitbolt/subprocess/utils/main_cmd.py
|
|
36
36
|
src/gitbolt/subprocess/utils/models.py
|
|
37
37
|
src/gitbolt/subprocess/utils/session.py
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|