gitbolt 0.0.0.dev11__tar.gz → 0.0.0.dev13__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.dev11 → gitbolt-0.0.0.dev13}/PKG-INFO +1 -1
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/pyproject.toml +1 -1
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/__init__.py +1 -1
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/base.py +23 -7
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/base.py +82 -17
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/impl/simple.py +34 -18
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/ls_tree.py +30 -8
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt.egg-info/PKG-INFO +1 -1
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/LICENSE +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/README.md +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/setup.cfg +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/_internal_init.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/add.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/constants.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/exceptions.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/__init__.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/_internal_init.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/add.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/constants.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/exceptions.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/impl/__init__.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/runner/__init__.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/runner/base.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/runner/simple_impl.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/utils.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/ls_tree.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/models.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/py.typed +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/pytest_plugin.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/utils.py +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt.egg-info/SOURCES.txt +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt.egg-info/dependency_links.txt +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt.egg-info/entry_points.txt +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt.egg-info/requires.txt +0 -0
- {gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/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.dev13
|
|
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>
|
|
@@ -34,7 +34,7 @@ def get_git(git_root_dir: Path = Path.cwd()) -> Git:
|
|
|
34
34
|
>>> import subprocess
|
|
35
35
|
>>> import gitbolt
|
|
36
36
|
>>> git = gitbolt.get_git()
|
|
37
|
-
>>> assert git.version == subprocess.run(['git', 'version'], capture_output=True, text=True).stdout.strip()
|
|
37
|
+
>>> assert git.version().version() == subprocess.run(['git', 'version'], capture_output=True, text=True).stdout.strip()
|
|
38
38
|
|
|
39
39
|
:param git_root_dir: Path to the git repo root directory. Defaults to current working directory.
|
|
40
40
|
"""
|
|
@@ -230,8 +230,29 @@ class Version(GitSubCommand, Protocol):
|
|
|
230
230
|
Interface for ``git version`` command.
|
|
231
231
|
"""
|
|
232
232
|
|
|
233
|
+
class VersionInfo:
|
|
234
|
+
@abstractmethod
|
|
235
|
+
def version(self) -> str: ...
|
|
236
|
+
|
|
237
|
+
@abstractmethod
|
|
238
|
+
def semver(self) -> tuple: ...
|
|
239
|
+
|
|
240
|
+
class VersionWithBuildInfo(VersionInfo):
|
|
241
|
+
@abstractmethod
|
|
242
|
+
def build_options(self) -> dict[str, str]: ...
|
|
243
|
+
|
|
244
|
+
@overload
|
|
245
|
+
@abstractmethod
|
|
246
|
+
def version(self) -> VersionInfo: ...
|
|
247
|
+
|
|
248
|
+
@overload
|
|
233
249
|
@abstractmethod
|
|
234
|
-
def version(self, build_options:
|
|
250
|
+
def version(self, build_options: Literal[True]) -> VersionWithBuildInfo: ...
|
|
251
|
+
|
|
252
|
+
@abstractmethod
|
|
253
|
+
def version(
|
|
254
|
+
self, build_options: Literal[True, False] = False
|
|
255
|
+
) -> VersionInfo | VersionWithBuildInfo:
|
|
235
256
|
"""
|
|
236
257
|
All the parameters are mirrors of the parameters of ``git version`` CLI command
|
|
237
258
|
from `git version documentation <https://git-scm.com/docs/git-version>`_.
|
|
@@ -276,14 +297,12 @@ class Git(CanOverrideGitOpts, CanOverrideGitEnvs, Protocol):
|
|
|
276
297
|
Class designed analogous to documentation provided on `git documentation <https://git-scm.com/docs/git>`_.
|
|
277
298
|
"""
|
|
278
299
|
|
|
279
|
-
|
|
280
|
-
def version(self) -> str:
|
|
300
|
+
def version(self) -> Version.VersionInfo:
|
|
281
301
|
"""
|
|
282
302
|
:return: current git version.
|
|
283
303
|
"""
|
|
284
304
|
return self.version_subcmd.version()
|
|
285
305
|
|
|
286
|
-
@property
|
|
287
306
|
@abstractmethod
|
|
288
307
|
def exec_path(self) -> Path:
|
|
289
308
|
"""
|
|
@@ -291,7 +310,6 @@ class Git(CanOverrideGitOpts, CanOverrideGitEnvs, Protocol):
|
|
|
291
310
|
"""
|
|
292
311
|
...
|
|
293
312
|
|
|
294
|
-
@property
|
|
295
313
|
@abstractmethod
|
|
296
314
|
def html_path(self) -> Path:
|
|
297
315
|
"""
|
|
@@ -299,7 +317,6 @@ class Git(CanOverrideGitOpts, CanOverrideGitEnvs, Protocol):
|
|
|
299
317
|
"""
|
|
300
318
|
...
|
|
301
319
|
|
|
302
|
-
@property
|
|
303
320
|
@abstractmethod
|
|
304
321
|
def info_path(self) -> Path:
|
|
305
322
|
"""
|
|
@@ -307,7 +324,6 @@ class Git(CanOverrideGitOpts, CanOverrideGitEnvs, Protocol):
|
|
|
307
324
|
"""
|
|
308
325
|
...
|
|
309
326
|
|
|
310
|
-
@property
|
|
311
327
|
@abstractmethod
|
|
312
328
|
def man_path(self) -> Path:
|
|
313
329
|
"""
|
|
@@ -8,14 +8,17 @@ Git command interfaces with default implementation using subprocess calls.
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
10
|
from abc import abstractmethod, ABC
|
|
11
|
+
from collections.abc import Callable
|
|
11
12
|
from pathlib import Path
|
|
12
13
|
from subprocess import CompletedProcess
|
|
13
14
|
from typing import override, Protocol, Unpack, Self, overload, Literal, Any
|
|
14
15
|
|
|
15
16
|
from vt.utils.commons.commons.core_py import is_unset, not_none_not_unset
|
|
16
17
|
from vt.utils.commons.commons.op import RootDirOp
|
|
18
|
+
from vt.utils.errors.error_specs import ERR_INVALID_USAGE
|
|
17
19
|
|
|
18
20
|
from gitbolt import Git, Version, LsTree, GitSubCommand, HasGitUnderneath, Add
|
|
21
|
+
from gitbolt.exceptions import GitExitingException
|
|
19
22
|
from gitbolt.git_subprocess.add import AddCLIArgsBuilder, IndividuallyOverridableACAB
|
|
20
23
|
from gitbolt.git_subprocess.ls_tree import (
|
|
21
24
|
LsTreeCLIArgsBuilder,
|
|
@@ -37,7 +40,7 @@ class GitCommand(Git, ABC):
|
|
|
37
40
|
"""
|
|
38
41
|
self.runner: GitCommandRunner = runner
|
|
39
42
|
self._main_cmd_opts: GitOpts = {}
|
|
40
|
-
self._env_vars: GitEnvVars =
|
|
43
|
+
self._env_vars: GitEnvVars | None = None
|
|
41
44
|
|
|
42
45
|
# region build_main_cmd_args
|
|
43
46
|
def build_main_cmd_args(self) -> list[str]:
|
|
@@ -213,7 +216,7 @@ class GitCommand(Git, ABC):
|
|
|
213
216
|
# endregion
|
|
214
217
|
|
|
215
218
|
# region build_git_envs
|
|
216
|
-
def build_git_envs(self) -> dict[str, str]:
|
|
219
|
+
def build_git_envs(self) -> dict[str, str] | None:
|
|
217
220
|
"""
|
|
218
221
|
Terminal operation to build and return effective Git environment variables
|
|
219
222
|
from the merged ``GitEnvVars`` object.
|
|
@@ -223,41 +226,43 @@ class GitCommand(Git, ABC):
|
|
|
223
226
|
|
|
224
227
|
:return: A cleaned and normalized GitEnvVars dict suitable for use in subprocesses.
|
|
225
228
|
"""
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
if self._env_vars is None:
|
|
230
|
+
return None
|
|
231
|
+
else:
|
|
232
|
+
env: dict[str, str] = {}
|
|
233
|
+
for key, val in self._env_vars.items():
|
|
234
|
+
if not_none_not_unset(val):
|
|
235
|
+
env[key] = str(val)
|
|
236
|
+
return env
|
|
231
237
|
|
|
232
238
|
@override
|
|
233
239
|
def git_envs_override(self, **overrides: Unpack[GitEnvVars]) -> Self:
|
|
234
240
|
_git_cmd = self.clone()
|
|
235
|
-
|
|
241
|
+
if self._env_vars:
|
|
242
|
+
_env_vars = merge_git_envs(overrides, self._env_vars)
|
|
243
|
+
else:
|
|
244
|
+
_env_vars = overrides
|
|
236
245
|
_git_cmd._env_vars = _env_vars
|
|
237
246
|
return _git_cmd
|
|
238
247
|
|
|
239
248
|
# endregion
|
|
240
249
|
|
|
241
250
|
@override
|
|
242
|
-
@property
|
|
243
251
|
def html_path(self) -> Path:
|
|
244
252
|
html_path_str = "--html-path"
|
|
245
253
|
return self._get_path(html_path_str)
|
|
246
254
|
|
|
247
255
|
@override
|
|
248
|
-
@property
|
|
249
256
|
def info_path(self) -> Path:
|
|
250
257
|
info_path_str = "--info-path"
|
|
251
258
|
return self._get_path(info_path_str)
|
|
252
259
|
|
|
253
260
|
@override
|
|
254
|
-
@property
|
|
255
261
|
def man_path(self) -> Path:
|
|
256
262
|
man_path_str = "--man-path"
|
|
257
263
|
return self._get_path(man_path_str)
|
|
258
264
|
|
|
259
265
|
@override
|
|
260
|
-
@property
|
|
261
266
|
def exec_path(self) -> Path:
|
|
262
267
|
exec_path_str = "--exec-path"
|
|
263
268
|
return self._get_path(exec_path_str)
|
|
@@ -324,7 +329,66 @@ class GitSubcmdCommand(GitSubCommand, HasGitUnderneath["GitCommand"], Protocol):
|
|
|
324
329
|
|
|
325
330
|
|
|
326
331
|
class VersionCommand(Version, GitSubcmdCommand, Protocol):
|
|
327
|
-
|
|
332
|
+
class _Cache:
|
|
333
|
+
def __init__(self):
|
|
334
|
+
self.version = None
|
|
335
|
+
self.semver = None
|
|
336
|
+
self.build_options = None
|
|
337
|
+
|
|
338
|
+
class VersionInfoForCmd(Version.VersionInfo):
|
|
339
|
+
def __init__(self, rosetta_supplier: Callable[[], str]):
|
|
340
|
+
self.rosetta_supplier = rosetta_supplier
|
|
341
|
+
self.rosetta: str | None = None
|
|
342
|
+
self._cache = VersionCommand._Cache()
|
|
343
|
+
|
|
344
|
+
@override
|
|
345
|
+
def version(self) -> str:
|
|
346
|
+
if self.rosetta is None:
|
|
347
|
+
self.rosetta = self.rosetta_supplier()
|
|
348
|
+
if self._cache.version is not None:
|
|
349
|
+
return self._cache.version
|
|
350
|
+
v_str = self.rosetta.splitlines()[0]
|
|
351
|
+
self._cache.version = v_str
|
|
352
|
+
return v_str
|
|
353
|
+
|
|
354
|
+
@override
|
|
355
|
+
def semver(self) -> tuple:
|
|
356
|
+
if self._cache.semver is not None:
|
|
357
|
+
return self._cache.semver
|
|
358
|
+
t_ver = self.version().split()[-1].split(".")
|
|
359
|
+
return tuple(t_ver)
|
|
360
|
+
|
|
361
|
+
@override
|
|
362
|
+
def __str__(self):
|
|
363
|
+
if self.rosetta is None:
|
|
364
|
+
self.rosetta = self.rosetta_supplier()
|
|
365
|
+
return self.rosetta
|
|
366
|
+
|
|
367
|
+
class VersionWithBuildInfoForCmd(VersionInfoForCmd, Version.VersionWithBuildInfo):
|
|
368
|
+
def __init__(
|
|
369
|
+
self, rosetta_supplier: Callable[[], str], splitter_expr: str = ": "
|
|
370
|
+
):
|
|
371
|
+
super().__init__(rosetta_supplier)
|
|
372
|
+
self.splitter_expr = splitter_expr
|
|
373
|
+
|
|
374
|
+
@override
|
|
375
|
+
def build_options(self) -> dict[str, str]:
|
|
376
|
+
if self.rosetta is None:
|
|
377
|
+
self.rosetta = self.rosetta_supplier()
|
|
378
|
+
if self._cache.build_options is not None:
|
|
379
|
+
return self._cache.build_options
|
|
380
|
+
if not self.rosetta.splitlines()[1:]:
|
|
381
|
+
errmsg = "Unable to populate build_options as possibly --build-options switch wasn't used."
|
|
382
|
+
raise GitExitingException(
|
|
383
|
+
errmsg, exit_code=ERR_INVALID_USAGE
|
|
384
|
+
) from ValueError(errmsg)
|
|
385
|
+
|
|
386
|
+
self._cache.build_options = {}
|
|
387
|
+
for b_str in self.rosetta.splitlines()[1:]:
|
|
388
|
+
if self.splitter_expr in b_str:
|
|
389
|
+
b_k, b_v = b_str.split(self.splitter_expr)
|
|
390
|
+
self._cache.build_options[b_k] = b_v
|
|
391
|
+
return self._cache.build_options
|
|
328
392
|
|
|
329
393
|
|
|
330
394
|
class LsTreeCommand(LsTree, GitSubcmdCommand, Protocol):
|
|
@@ -524,10 +588,11 @@ class UncheckedSubcmd(GitSubcmdCommand, RootDirOp, Protocol):
|
|
|
524
588
|
envs_vars = self.underlying_git.build_git_envs()
|
|
525
589
|
another_supplied_env = subprocess_run_kwargs.pop("env", None)
|
|
526
590
|
if another_supplied_env:
|
|
527
|
-
envs_vars
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
591
|
+
if envs_vars is not None:
|
|
592
|
+
envs_vars.update(another_supplied_env)
|
|
593
|
+
cwd = subprocess_run_kwargs.pop("cwd", self.root_dir)
|
|
594
|
+
capture_output = subprocess_run_kwargs.pop("capture_output", True)
|
|
595
|
+
check = subprocess_run_kwargs.pop("check", True)
|
|
531
596
|
# Run the git command
|
|
532
597
|
result = self.underlying_git.runner.run_git_command(
|
|
533
598
|
main_cmd_args,
|
|
@@ -9,10 +9,11 @@ from __future__ import annotations
|
|
|
9
9
|
|
|
10
10
|
from abc import ABC
|
|
11
11
|
from pathlib import Path
|
|
12
|
-
from typing import override
|
|
12
|
+
from typing import override, Literal, overload
|
|
13
13
|
|
|
14
14
|
from vt.utils.commons.commons.op import RootDirOp
|
|
15
15
|
|
|
16
|
+
from gitbolt.base import Version
|
|
16
17
|
from gitbolt.add import AddArgsValidator
|
|
17
18
|
from gitbolt.git_subprocess import (
|
|
18
19
|
GitCommand,
|
|
@@ -43,22 +44,36 @@ class GitSubcmdCommandImpl(GitSubcmdCommand, ABC):
|
|
|
43
44
|
|
|
44
45
|
|
|
45
46
|
class VersionCommandImpl(VersionCommand, GitSubcmdCommandImpl):
|
|
47
|
+
@overload
|
|
48
|
+
def version(self) -> Version.VersionInfo: ...
|
|
49
|
+
|
|
50
|
+
@overload
|
|
51
|
+
def version(self, build_options: Literal[True]) -> Version.VersionWithBuildInfo: ...
|
|
52
|
+
|
|
46
53
|
@override
|
|
47
|
-
def version(
|
|
54
|
+
def version(
|
|
55
|
+
self, build_options: Literal[True, False] = False
|
|
56
|
+
) -> Version.VersionInfo | Version.VersionWithBuildInfo:
|
|
48
57
|
self._require_valid_args(build_options)
|
|
49
58
|
main_cmd_args = self.underlying_git.build_main_cmd_args()
|
|
50
59
|
sub_cmd_args = [VERSION_CMD]
|
|
51
60
|
env_vars = self.underlying_git.build_git_envs()
|
|
52
61
|
if build_options:
|
|
53
62
|
sub_cmd_args.append("--build-options")
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
|
|
64
|
+
def rosetta_supplier():
|
|
65
|
+
return self.underlying_git.runner.run_git_command(
|
|
66
|
+
main_cmd_args,
|
|
67
|
+
sub_cmd_args,
|
|
68
|
+
check=True,
|
|
69
|
+
text=True,
|
|
70
|
+
capture_output=True,
|
|
71
|
+
env=env_vars,
|
|
72
|
+
).stdout.strip()
|
|
73
|
+
|
|
74
|
+
if build_options:
|
|
75
|
+
return VersionCommand.VersionWithBuildInfoForCmd(rosetta_supplier)
|
|
76
|
+
return VersionCommand.VersionInfoForCmd(rosetta_supplier)
|
|
62
77
|
|
|
63
78
|
def clone(self) -> "VersionCommandImpl":
|
|
64
79
|
return VersionCommandImpl(self.underlying_git)
|
|
@@ -251,7 +266,8 @@ class CLISimpleGitCommand(SimpleGitCommand):
|
|
|
251
266
|
):
|
|
252
267
|
"""
|
|
253
268
|
:param opts: main git cli options.
|
|
254
|
-
:param envs: main git cli env vars.
|
|
269
|
+
:param envs: main git cli env vars. Not supplying any env vars (default behavior: ``None``) simply supplies all
|
|
270
|
+
the env vars to the underlying runner.
|
|
255
271
|
:param prefer_cli: cli opts and envs will be given priority over programmatically set opts and envs. Setting
|
|
256
272
|
this param to ``True`` will make cli opts and envs appear later in the opts and envs strings which will
|
|
257
273
|
make them override previously programmatically set opts and envs.
|
|
@@ -278,13 +294,13 @@ class CLISimpleGitCommand(SimpleGitCommand):
|
|
|
278
294
|
return super().build_main_cmd_args()
|
|
279
295
|
|
|
280
296
|
@override
|
|
281
|
-
def build_git_envs(self) -> dict[str, str]:
|
|
282
|
-
if self._cmd_cli_envs:
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
297
|
+
def build_git_envs(self) -> dict[str, str] | None:
|
|
298
|
+
if self._cmd_cli_envs is None:
|
|
299
|
+
return super().build_git_envs()
|
|
300
|
+
if self.prefer_cli:
|
|
301
|
+
return (super().build_git_envs() or {}) | self._cmd_cli_envs
|
|
302
|
+
else:
|
|
303
|
+
return self._cmd_cli_envs | (super().build_git_envs() or {})
|
|
288
304
|
|
|
289
305
|
@override
|
|
290
306
|
def _subclass_clone(self) -> CLISimpleGitCommand:
|
|
@@ -108,9 +108,25 @@ class IndividuallyOverridableLTCAB(LsTreeCLIArgsBuilder):
|
|
|
108
108
|
* With --format::
|
|
109
109
|
|
|
110
110
|
>>> builder.build("HEAD", format_="%(objectname)")
|
|
111
|
-
['ls-tree', '--format
|
|
111
|
+
['ls-tree', '--format', '%(objectname)', 'HEAD']
|
|
112
|
+
|
|
112
113
|
>>> builder.build("HEAD", format_="")
|
|
113
|
-
['ls-tree', '--format
|
|
114
|
+
['ls-tree', '--format', '', 'HEAD']
|
|
115
|
+
|
|
116
|
+
>>> builder.build("HEAD", format_="''")
|
|
117
|
+
['ls-tree', '--format', "''", 'HEAD']
|
|
118
|
+
|
|
119
|
+
>>> builder.build("HEAD", format_='""')
|
|
120
|
+
['ls-tree', '--format', '""', 'HEAD']
|
|
121
|
+
|
|
122
|
+
>>> builder.build("HEAD", format_="%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)")
|
|
123
|
+
['ls-tree', '--format', '%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)', 'HEAD']
|
|
124
|
+
|
|
125
|
+
>>> builder.build("HEAD", format_="'%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)'")
|
|
126
|
+
['ls-tree', '--format', "'%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)'", 'HEAD']
|
|
127
|
+
|
|
128
|
+
>>> builder.build("HEAD", format_='"%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)"')
|
|
129
|
+
['ls-tree', '--format', '"%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)"', 'HEAD']
|
|
114
130
|
|
|
115
131
|
* With paths::
|
|
116
132
|
|
|
@@ -140,7 +156,7 @@ class IndividuallyOverridableLTCAB(LsTreeCLIArgsBuilder):
|
|
|
140
156
|
... format_="%(objectname) %(path)",
|
|
141
157
|
... path=["dir1", "dir2/file.txt"]
|
|
142
158
|
... )
|
|
143
|
-
['ls-tree', '-d', '-r', '-t', '-l', '-z', '--name-only', '--object-only', '--full-name', '--full-tree', '--abbrev=10', '--format
|
|
159
|
+
['ls-tree', '-d', '-r', '-t', '-l', '-z', '--name-only', '--object-only', '--full-name', '--full-tree', '--abbrev=10', '--format', '%(objectname) %(path)', 'HEAD', 'dir1', 'dir2/file.txt']
|
|
144
160
|
|
|
145
161
|
* Empty or falsy values, mostly will fail at validation::
|
|
146
162
|
|
|
@@ -344,11 +360,17 @@ class IndividuallyOverridableLTCAB(LsTreeCLIArgsBuilder):
|
|
|
344
360
|
>>> IndividuallyOverridableLTCAB().format_arg(None)
|
|
345
361
|
[]
|
|
346
362
|
>>> IndividuallyOverridableLTCAB().format_arg('%(objectname)')
|
|
347
|
-
['--format
|
|
348
|
-
>>> IndividuallyOverridableLTCAB().format_arg('')
|
|
349
|
-
['--format
|
|
350
|
-
""
|
|
351
|
-
|
|
363
|
+
['--format', '%(objectname)']
|
|
364
|
+
>>> IndividuallyOverridableLTCAB().format_arg('""')
|
|
365
|
+
['--format', '""']
|
|
366
|
+
>>> IndividuallyOverridableLTCAB().format_arg("''")
|
|
367
|
+
['--format', "''"]
|
|
368
|
+
>>> IndividuallyOverridableLTCAB().format_arg('%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)')
|
|
369
|
+
['--format', '%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)']
|
|
370
|
+
>>> IndividuallyOverridableLTCAB().format_arg('"%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)"')
|
|
371
|
+
['--format', '"%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)"']
|
|
372
|
+
"""
|
|
373
|
+
return ["--format", _format] if _format is not None else []
|
|
352
374
|
|
|
353
375
|
def tree_ish_arg(self, tree_ish: str) -> list[str]:
|
|
354
376
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitbolt
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev13
|
|
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>
|
|
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
|
{gitbolt-0.0.0.dev11 → gitbolt-0.0.0.dev13}/src/gitbolt/git_subprocess/runner/simple_impl.py
RENAMED
|
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
|