gitbolt 0.0.0.dev5__py3-none-any.whl → 0.0.0.dev6__py3-none-any.whl
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/__init__.py +2 -0
- gitbolt/base.py +12 -0
- gitbolt/constants.py +2 -1
- gitbolt/git_subprocess/base.py +9 -5
- gitbolt/git_subprocess/impl/simple.py +25 -14
- gitbolt/git_subprocess/runner/simple_impl.py +3 -1
- gitbolt/pytest_plugin.py +1 -0
- {gitbolt-0.0.0.dev5.dist-info → gitbolt-0.0.0.dev6.dist-info}/METADATA +1 -1
- {gitbolt-0.0.0.dev5.dist-info → gitbolt-0.0.0.dev6.dist-info}/RECORD +13 -13
- {gitbolt-0.0.0.dev5.dist-info → gitbolt-0.0.0.dev6.dist-info}/WHEEL +0 -0
- {gitbolt-0.0.0.dev5.dist-info → gitbolt-0.0.0.dev6.dist-info}/entry_points.txt +0 -0
- {gitbolt-0.0.0.dev5.dist-info → gitbolt-0.0.0.dev6.dist-info}/licenses/LICENSE +0 -0
- {gitbolt-0.0.0.dev5.dist-info → gitbolt-0.0.0.dev6.dist-info}/top_level.txt +0 -0
gitbolt/__init__.py
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"""
|
|
5
5
|
Git command interfaces with default implementation using subprocess calls.
|
|
6
6
|
"""
|
|
7
|
+
|
|
7
8
|
from pathlib import Path
|
|
8
9
|
|
|
9
10
|
# region imports
|
|
@@ -38,4 +39,5 @@ def get_git(git_root_dir: Path = Path.cwd()) -> Git:
|
|
|
38
39
|
:param git_root_dir: Path to the git repo root directory. Defaults to current working directory.
|
|
39
40
|
"""
|
|
40
41
|
from gitbolt.git_subprocess.impl.simple import SimpleGitCommand
|
|
42
|
+
|
|
41
43
|
return SimpleGitCommand(git_root_dir)
|
gitbolt/base.py
CHANGED
|
@@ -243,6 +243,18 @@ class Version(GitSubCommand, Protocol):
|
|
|
243
243
|
"""
|
|
244
244
|
Require that arguments sent to the version command is valid.
|
|
245
245
|
|
|
246
|
+
Examples:
|
|
247
|
+
|
|
248
|
+
Correct:
|
|
249
|
+
|
|
250
|
+
>>> Version._require_valid_args()
|
|
251
|
+
|
|
252
|
+
Error:
|
|
253
|
+
|
|
254
|
+
>>> Version._require_valid_args(1) # type: ignore[arg-type] # required bool, supplied int
|
|
255
|
+
Traceback (most recent call last):
|
|
256
|
+
gitbolt.exceptions.GitExitingException: TypeError: build_options should be bool.
|
|
257
|
+
|
|
246
258
|
:param build_options: argument to be validated.
|
|
247
259
|
:raise GitExitingException: if supplied ``build_options`` is invalid.
|
|
248
260
|
"""
|
gitbolt/constants.py
CHANGED
gitbolt/git_subprocess/base.py
CHANGED
|
@@ -340,6 +340,7 @@ class LsTreeCommand(LsTree, GitSubcmdCommand, Protocol):
|
|
|
340
340
|
self.args_validator.validate(tree_ish, **ls_tree_opts)
|
|
341
341
|
sub_cmd_args = self.cli_args_builder.build(tree_ish, **ls_tree_opts)
|
|
342
342
|
main_cmd_args = self.underlying_git.build_main_cmd_args()
|
|
343
|
+
env_vars = self.underlying_git.build_git_envs()
|
|
343
344
|
|
|
344
345
|
# Run the git command
|
|
345
346
|
result = self.underlying_git.runner.run_git_command(
|
|
@@ -349,6 +350,7 @@ class LsTreeCommand(LsTree, GitSubcmdCommand, Protocol):
|
|
|
349
350
|
text=True,
|
|
350
351
|
capture_output=True,
|
|
351
352
|
cwd=self.root_dir,
|
|
353
|
+
env=env_vars,
|
|
352
354
|
)
|
|
353
355
|
|
|
354
356
|
return result.stdout.strip()
|
|
@@ -420,6 +422,7 @@ class AddCommand(Add, GitSubcmdCommand, Protocol):
|
|
|
420
422
|
**add_opts,
|
|
421
423
|
)
|
|
422
424
|
main_cmd_args = self.underlying_git.build_main_cmd_args()
|
|
425
|
+
env_vars = self.underlying_git.build_git_envs()
|
|
423
426
|
|
|
424
427
|
# Run the git command
|
|
425
428
|
result = self.underlying_git.runner.run_git_command(
|
|
@@ -430,6 +433,7 @@ class AddCommand(Add, GitSubcmdCommand, Protocol):
|
|
|
430
433
|
text=True,
|
|
431
434
|
capture_output=True,
|
|
432
435
|
cwd=self.root_dir,
|
|
436
|
+
env=env_vars,
|
|
433
437
|
)
|
|
434
438
|
|
|
435
439
|
return result.stdout.strip()
|
|
@@ -514,12 +518,12 @@ class UncheckedSubcmd(GitSubcmdCommand, RootDirOp, Protocol):
|
|
|
514
518
|
"""
|
|
515
519
|
main_cmd_args = self.underlying_git.build_main_cmd_args()
|
|
516
520
|
envs_vars = self.underlying_git.build_git_envs()
|
|
517
|
-
another_supplied_env = subprocess_run_kwargs.pop(
|
|
521
|
+
another_supplied_env = subprocess_run_kwargs.pop("env", None)
|
|
518
522
|
if another_supplied_env:
|
|
519
523
|
envs_vars.update(another_supplied_env)
|
|
520
|
-
cwd = subprocess_run_kwargs.pop(
|
|
521
|
-
capture_output = subprocess_run_kwargs.pop(
|
|
522
|
-
check = subprocess_run_kwargs.pop(
|
|
524
|
+
cwd = subprocess_run_kwargs.pop("cwd", None) or self.root_dir
|
|
525
|
+
capture_output = subprocess_run_kwargs.pop("capture_output", None) or True
|
|
526
|
+
check = subprocess_run_kwargs.pop("check", None) or True
|
|
523
527
|
# Run the git command
|
|
524
528
|
result = self.underlying_git.runner.run_git_command(
|
|
525
529
|
main_cmd_args,
|
|
@@ -531,6 +535,6 @@ class UncheckedSubcmd(GitSubcmdCommand, RootDirOp, Protocol):
|
|
|
531
535
|
cwd=cwd,
|
|
532
536
|
capture_output=capture_output,
|
|
533
537
|
check=check,
|
|
534
|
-
**subprocess_run_kwargs
|
|
538
|
+
**subprocess_run_kwargs,
|
|
535
539
|
)
|
|
536
540
|
return result
|
|
@@ -20,7 +20,7 @@ from gitbolt.git_subprocess import (
|
|
|
20
20
|
LsTreeCommand,
|
|
21
21
|
GitSubcmdCommand,
|
|
22
22
|
AddCommand,
|
|
23
|
-
UncheckedSubcmd
|
|
23
|
+
UncheckedSubcmd,
|
|
24
24
|
)
|
|
25
25
|
from gitbolt.git_subprocess.add import AddCLIArgsBuilder
|
|
26
26
|
from gitbolt.git_subprocess.constants import VERSION_CMD
|
|
@@ -48,10 +48,16 @@ class VersionCommandImpl(VersionCommand, GitSubcmdCommandImpl):
|
|
|
48
48
|
self._require_valid_args(build_options)
|
|
49
49
|
main_cmd_args = self.underlying_git.build_main_cmd_args()
|
|
50
50
|
sub_cmd_args = [VERSION_CMD]
|
|
51
|
+
env_vars = self.underlying_git.build_git_envs()
|
|
51
52
|
if build_options:
|
|
52
53
|
sub_cmd_args.append("--build-options")
|
|
53
54
|
return self.underlying_git.runner.run_git_command(
|
|
54
|
-
main_cmd_args,
|
|
55
|
+
main_cmd_args,
|
|
56
|
+
sub_cmd_args,
|
|
57
|
+
check=True,
|
|
58
|
+
text=True,
|
|
59
|
+
capture_output=True,
|
|
60
|
+
env=env_vars,
|
|
55
61
|
).stdout.strip()
|
|
56
62
|
|
|
57
63
|
def clone(self) -> "VersionCommandImpl":
|
|
@@ -133,11 +139,7 @@ class AddCommandImpl(AddCommand, GitSubcmdCommandImpl):
|
|
|
133
139
|
|
|
134
140
|
|
|
135
141
|
class UncheckedSubcmdImpl(UncheckedSubcmd, GitSubcmdCommandImpl):
|
|
136
|
-
def __init__(
|
|
137
|
-
self,
|
|
138
|
-
root_dir: Path,
|
|
139
|
-
git: GitCommand
|
|
140
|
-
):
|
|
142
|
+
def __init__(self, root_dir: Path, git: GitCommand):
|
|
141
143
|
super().__init__(git)
|
|
142
144
|
self._root_dir = root_dir
|
|
143
145
|
|
|
@@ -151,7 +153,6 @@ class UncheckedSubcmdImpl(UncheckedSubcmd, GitSubcmdCommandImpl):
|
|
|
151
153
|
|
|
152
154
|
|
|
153
155
|
class SimpleGitCommand(GitCommand, RootDirOp):
|
|
154
|
-
|
|
155
156
|
def __init__(
|
|
156
157
|
self,
|
|
157
158
|
git_root_dir: Path = Path.cwd(),
|
|
@@ -160,7 +161,7 @@ class SimpleGitCommand(GitCommand, RootDirOp):
|
|
|
160
161
|
version_subcmd: VersionCommand | None = None,
|
|
161
162
|
ls_tree_subcmd: LsTreeCommand | None = None,
|
|
162
163
|
add_subcmd: AddCommand | None = None,
|
|
163
|
-
subcmd_unchecked: UncheckedSubcmd | None = None
|
|
164
|
+
subcmd_unchecked: UncheckedSubcmd | None = None,
|
|
164
165
|
):
|
|
165
166
|
super().__init__(runner)
|
|
166
167
|
self.git_root_dir = git_root_dir
|
|
@@ -172,17 +173,25 @@ class SimpleGitCommand(GitCommand, RootDirOp):
|
|
|
172
173
|
@override
|
|
173
174
|
@property
|
|
174
175
|
def version_subcmd(self) -> VersionCommand:
|
|
175
|
-
|
|
176
|
+
# TODO: in all subcommand methods, find a better way to retain envs and opts rather than cloning each time
|
|
177
|
+
# and setting the underlying git.
|
|
178
|
+
version_subcmd = self._version_subcmd.clone()
|
|
179
|
+
version_subcmd._set_underlying_git(self)
|
|
180
|
+
return version_subcmd
|
|
176
181
|
|
|
177
182
|
@override
|
|
178
183
|
@property
|
|
179
184
|
def ls_tree_subcmd(self) -> LsTreeCommand:
|
|
180
|
-
|
|
185
|
+
ls_tree_subcmd = self._ls_tree.clone()
|
|
186
|
+
ls_tree_subcmd._set_underlying_git(self)
|
|
187
|
+
return ls_tree_subcmd
|
|
181
188
|
|
|
182
189
|
@override
|
|
183
190
|
@property
|
|
184
191
|
def add_subcmd(self) -> AddCommand:
|
|
185
|
-
|
|
192
|
+
add_subcmd = self._add_subcmd.clone()
|
|
193
|
+
add_subcmd._set_underlying_git(self)
|
|
194
|
+
return add_subcmd
|
|
186
195
|
|
|
187
196
|
@override
|
|
188
197
|
def clone(self) -> "SimpleGitCommand":
|
|
@@ -193,7 +202,7 @@ class SimpleGitCommand(GitCommand, RootDirOp):
|
|
|
193
202
|
version_subcmd=self.version_subcmd,
|
|
194
203
|
ls_tree_subcmd=self.ls_tree_subcmd,
|
|
195
204
|
add_subcmd=self.add_subcmd,
|
|
196
|
-
subcmd_unchecked=self.subcmd_unchecked
|
|
205
|
+
subcmd_unchecked=self.subcmd_unchecked,
|
|
197
206
|
)
|
|
198
207
|
# endregion
|
|
199
208
|
# region clone protected members
|
|
@@ -209,4 +218,6 @@ class SimpleGitCommand(GitCommand, RootDirOp):
|
|
|
209
218
|
|
|
210
219
|
@property
|
|
211
220
|
def subcmd_unchecked(self) -> UncheckedSubcmd:
|
|
212
|
-
|
|
221
|
+
subcmd_unchecked = self._subcmd_unchecked.clone()
|
|
222
|
+
subcmd_unchecked._set_underlying_git(self)
|
|
223
|
+
return subcmd_unchecked
|
|
@@ -86,4 +86,6 @@ class SimpleGitCR(GitCommandRunner):
|
|
|
86
86
|
**subprocess_run_kwargs,
|
|
87
87
|
)
|
|
88
88
|
except subprocess.CalledProcessError as e:
|
|
89
|
-
raise GitCmdException(
|
|
89
|
+
raise GitCmdException(
|
|
90
|
+
e.stderr, called_process_error=e, exit_code=e.returncode
|
|
91
|
+
) from e
|
gitbolt/pytest_plugin.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitbolt
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev6
|
|
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>
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
gitbolt/__init__.py,sha256=
|
|
1
|
+
gitbolt/__init__.py,sha256=SyV-PMv4Ul_k8sh7Y76Y4hUku1N5s-4ViyDpVbfRDOI,1176
|
|
2
2
|
gitbolt/_internal_init.py,sha256=alSsIMgBWHmOdUo7P1ewftR12xPv8vb3ZgECuVsRMwk,485
|
|
3
3
|
gitbolt/add.py,sha256=F16d0SQfLrjbpUzJIjKFwGU4KLSjqtYLOA9oZ5gdNS0,31731
|
|
4
|
-
gitbolt/base.py,sha256=
|
|
5
|
-
gitbolt/constants.py,sha256=
|
|
4
|
+
gitbolt/base.py,sha256=Vhd4GkTu3OscngXRJVfUMxVDY5Ilu6WVZvuhNw4dgFA,9649
|
|
5
|
+
gitbolt/constants.py,sha256=PyGZ8XG-OhSM7K0iHmZrTaF0-WwU5sCe8t8p7JcPu-c,153
|
|
6
6
|
gitbolt/exceptions.py,sha256=7YvR7whZYM1hlWZk4GxHbeNgJ0KJXElg5VFA1Vi-fiA,989
|
|
7
7
|
gitbolt/ls_tree.py,sha256=PrDSoh4Pnqh6g4AfX8kwgez_zHYaH4yqknULbFbisUY,6269
|
|
8
8
|
gitbolt/models.py,sha256=iwIO-ugHYiKS57I_LPo3uDFEQlAtu2mnn5AjZHHQg04,18828
|
|
9
9
|
gitbolt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
gitbolt/pytest_plugin.py,sha256=
|
|
10
|
+
gitbolt/pytest_plugin.py,sha256=Gto30Ofmfz8kJ_AuBrEhqENmWoDlpMnsrpQWzHDmUi4,833
|
|
11
11
|
gitbolt/utils.py,sha256=XftX3LIKtfzjQaUZUF3QYaFJFM-QdFjc05ZrZSMSdeM,6315
|
|
12
12
|
gitbolt/git_subprocess/__init__.py,sha256=yEyJKH_iXFBkdgQMwE8vnHnhVTrjs2RkQUjUCF25SzU,590
|
|
13
13
|
gitbolt/git_subprocess/_internal_init.py,sha256=C6jfsbjXhIFHaDH9GE-wLPAN9WMlUU57rRLWvfpZuAs,255
|
|
14
14
|
gitbolt/git_subprocess/add.py,sha256=1PA9XonqFi2O941eBwIPMobSNgEJ0tgFYxlkVXSe1K4,17277
|
|
15
|
-
gitbolt/git_subprocess/base.py,sha256=
|
|
15
|
+
gitbolt/git_subprocess/base.py,sha256=iAL_aFiywqbZGuPHTqY03ve5O0bYkdyLzmdzc30mM4E,17756
|
|
16
16
|
gitbolt/git_subprocess/constants.py,sha256=3qHXbNjPf_DOhTPNHi3_bcvIpvtqvgFtpGoTJLYmTWk,250
|
|
17
17
|
gitbolt/git_subprocess/exceptions.py,sha256=cx4YKzxeBRSRKoF-oakZLpFUGrAHiGj1FtMIsiK5oHc,4063
|
|
18
18
|
gitbolt/git_subprocess/ls_tree.py,sha256=MmM3qh-kvkD_tGQG9yliLx-reY_5TIVEArvAXJN6rP4,13200
|
|
19
19
|
gitbolt/git_subprocess/utils.py,sha256=n9_kXPvDf0ACrzAm6SVVLBOFM1JyjHmXJl_99vBoPS8,4941
|
|
20
20
|
gitbolt/git_subprocess/impl/__init__.py,sha256=bxYluO0B3My-10H5Z0JuEGvZe_g8i71QTpt6iM0WXoU,97
|
|
21
|
-
gitbolt/git_subprocess/impl/simple.py,sha256=
|
|
21
|
+
gitbolt/git_subprocess/impl/simple.py,sha256=sjdby07SlLfdKpGlLedN9nYEAWxkGqy-rlJ1x32rbtE,7051
|
|
22
22
|
gitbolt/git_subprocess/runner/__init__.py,sha256=LPxbj3AwKLXyDxxCLwAVtl5b5SKjaNDj99lkKz6VSOU,177
|
|
23
23
|
gitbolt/git_subprocess/runner/base.py,sha256=Sof2WaNyYULiObRF7WjaGs7-yGrdyeHUXchE2tg1820,1562
|
|
24
|
-
gitbolt/git_subprocess/runner/simple_impl.py,sha256=
|
|
25
|
-
gitbolt-0.0.0.
|
|
26
|
-
gitbolt-0.0.0.
|
|
27
|
-
gitbolt-0.0.0.
|
|
28
|
-
gitbolt-0.0.0.
|
|
29
|
-
gitbolt-0.0.0.
|
|
30
|
-
gitbolt-0.0.0.
|
|
24
|
+
gitbolt/git_subprocess/runner/simple_impl.py,sha256=JvKCQ_MITguuMn3f3hVQwfAukymkIqFdli5f2fxin54,2524
|
|
25
|
+
gitbolt-0.0.0.dev6.dist-info/licenses/LICENSE,sha256=pOzr5bMWS6mHi3vro8d5vw0qW1i14rVq2XFrDuystVY,11372
|
|
26
|
+
gitbolt-0.0.0.dev6.dist-info/METADATA,sha256=xBJyJKj2N0cyqasfrejKd1JocGRs6KA4ObWdpAvBDDQ,11249
|
|
27
|
+
gitbolt-0.0.0.dev6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
28
|
+
gitbolt-0.0.0.dev6.dist-info/entry_points.txt,sha256=Q078Wjss4skreUs8hzAEJ8sUcH4Rhjc9emZ4jRXCiBM,52
|
|
29
|
+
gitbolt-0.0.0.dev6.dist-info/top_level.txt,sha256=QCXclkzSPZjgamcwB6XuKJexaJ1as_TLUUSGdIDA7VY,8
|
|
30
|
+
gitbolt-0.0.0.dev6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|