Skip to content

Test updates (remotes, remove older style code) #432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docs/cmd/git.md → docs/cmd/git/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@

For `git(1)`.

Compare to: [`fabtools.git`](https://fabtools.readthedocs.io/en/0.19.0/api/git.html#git-module),
_Compare to: [`fabtools.git`](https://fabtools.readthedocs.io/en/0.19.0/api/git.html#git-module),
[`salt.modules.git`](https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.git.html),
[`ansible.builtin.git`](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html)
[`ansible.builtin.git`](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html)_

```{toctree}
:caption: Subcommands
:maxdepth: 1

submodule
remote
stash
```

```{eval-rst}
.. automodule:: libvcs.cmd.git
:members:
:show-inheritance:
:undoc-members:
:exclude-members: GitSubmoduleCmd,
GitRemoteCmd,
GitStashCmd
```
10 changes: 10 additions & 0 deletions docs/cmd/git/remote.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# `remote`

For `git-remote(1)`.

```{eval-rst}
.. autoclass:: libvcs.cmd.git.GitRemoteCmd
:members:
:show-inheritance:
:undoc-members:
```
10 changes: 10 additions & 0 deletions docs/cmd/git/stash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# `stash`

For `git-stash(1)`.

```{eval-rst}
.. autoclass:: libvcs.cmd.git.GitStashCmd
:members:
:show-inheritance:
:undoc-members:
```
10 changes: 10 additions & 0 deletions docs/cmd/git/submodule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# `submodule`

For `git-submodule(1)`.

```{eval-rst}
.. autoclass:: libvcs.cmd.git.GitSubmoduleCmd
:members:
:show-inheritance:
:undoc-members:
```
2 changes: 1 addition & 1 deletion docs/cmd/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ versions.
```{toctree}
:caption: API

git
git/index
hg
svn
```
1 change: 1 addition & 0 deletions docs/redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
"projects/git.md" "sync/git.md"
"projects/hg.md" "sync/hg.md"
"projects/svn.md" "sync/svn.md"
"cmd/git.md" "cmd/git/index.md"
40 changes: 30 additions & 10 deletions src/libvcs/cmd/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(
dir: StrPath,
progress_callback: Optional[ProgressCallbackProtocol] = None,
) -> None:
"""Lite, typed, pythonic wrapper for git(1).
r"""Lite, typed, pythonic wrapper for git(1).

Parameters
----------
Expand All @@ -33,8 +33,28 @@ def __init__(

Examples
--------
>>> Git(dir=tmp_path)
>>> git = Git(dir=git_local_clone.dir)
>>> git
<Git dir=...>

Subcommands:

>>> git.remote.show()
'origin'

>>> git.remote.add(
... name='my_remote', url=f'file:///dev/null'
... )
''

>>> git.remote.show()
'my_remote\norigin'

>>> git.stash.save(message="Message")
'No local changes to save'

>>> git.submodule.init()
''
"""
#: Directory to check out
self.dir: pathlib.Path
Expand Down Expand Up @@ -2370,7 +2390,7 @@ def run(
check_returncode: Optional[bool] = None,
**kwargs: Any,
) -> str:
r"""Wraps `git submodule <https://git-scm.com/docs/git-remote>`_.
r"""Wraps `git remote <https://git-scm.com/docs/git-remote>`_.

Examples
--------
Expand Down Expand Up @@ -2405,7 +2425,7 @@ def add(
log_in_real_time: bool = False,
check_returncode: Optional[bool] = None,
) -> str:
"""git submodule add
"""git remote add

Examples
--------
Expand Down Expand Up @@ -2441,7 +2461,7 @@ def rename(
log_in_real_time: bool = False,
check_returncode: Optional[bool] = None,
) -> str:
"""git submodule rename
"""git remote rename

Examples
--------
Expand Down Expand Up @@ -2474,7 +2494,7 @@ def remove(
log_in_real_time: bool = False,
check_returncode: Optional[bool] = None,
) -> str:
"""git submodule remove
"""git remote remove

Examples
--------
Expand Down Expand Up @@ -2503,7 +2523,7 @@ def show(
log_in_real_time: bool = False,
check_returncode: Optional[bool] = None,
) -> str:
"""git submodule show
"""git remote show

Examples
--------
Expand Down Expand Up @@ -2538,7 +2558,7 @@ def prune(
log_in_real_time: bool = False,
check_returncode: Optional[bool] = None,
) -> str:
"""git submodule prune
"""git remote prune

Examples
--------
Expand Down Expand Up @@ -2572,7 +2592,7 @@ def get_url(
log_in_real_time: bool = False,
check_returncode: Optional[bool] = None,
) -> str:
"""git submodule get-url
"""git remote get-url

Examples
--------
Expand Down Expand Up @@ -2614,7 +2634,7 @@ def set_url(
log_in_real_time: bool = False,
check_returncode: Optional[bool] = None,
) -> str:
"""git submodule set-url
"""git remote set-url

Examples
--------
Expand Down
Loading