Skip to content

Commit a82ff7d

Browse files
authored
refactor!: states -> projects, *Repo -> *Project (#327)
* refactor!: Rename states -> projects * refactor!: {VCS}Repo -> {VCS}Project * docs(CHANGES): Note Repo -> Project name change * refactor!: More Repo -> Project name changes
2 parents 308b469 + 3b3a5de commit a82ff7d

25 files changed

+224
-209
lines changed

CHANGES

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,21 @@ $ pip install --user --upgrade --pre libvcs
1515

1616
### Breaking
1717

18-
- `GitRepo`, `SVNRepo`, `MercurialRepo`, `BaseRepo` have been moved to
19-
`libvcs.states.{module}.{Module}Repo`
18+
- `GitRepo`, `SVNRepo`, `MercurialRepo`, `BaseRepo` have been renamed to
19+
`GitProject`, `SVNProject`, `MercurialProject`, `BaseProject` ({issue}`#327`)
20+
- `GitProject`, `SVNProject`, `MercurialProject`, `BaseProject` have been moved to
21+
`libvcs.projects.{module}.{Module}Project`
2022
- `repo_dir` param is renamed to `dir`:
2123

22-
Before: `GitRepo(url='...', repo_dir='...')`
24+
Before: `GitProject(url='...', repo_dir='...')`
2325

24-
After: `GitRepo(url='...', dir='...')`
26+
After: `GitProject(url='...', dir='...')`
2527

2628
{issue}`#324`
2729

28-
- `dir` to `pathlib`, `BaseRepo.path` -> `BaseRepo.dir`
29-
- Logging functions moved to {attr}`libvcs.states.base.BaseRepo.log` ({issue}`#322`)
30-
- Rename `RepoLoggingAdapter` to `CmdLoggingAdapter`
30+
- `dir` to `pathlib`, `BaseProject.path` -> `BaseProject.dir`
31+
- Logging functions moved to {attr}`libvcs.projects.base.BaseProject.log` ({issue}`#322`)
32+
- Rename `ProjectLoggingAdapter` to `CmdLoggingAdapter`
3133
- `CmdLoggingAdapter`: Rename `repo_name` param to `keyword`
3234

3335
### What's new
@@ -51,10 +53,10 @@ $ pip install --user --upgrade --pre libvcs
5153
- {meth}`libvcs.cmd.hg.Hg.run`
5254
- {meth}`libvcs.cmd.hg.Hg.clone`
5355

54-
- {class}`libvcs.states.git.GitRepo` now accepts remotes in `__init__`
56+
- {class}`libvcs.projects.git.GitProject` now accepts remotes in `__init__`
5557

5658
```python
57-
repo = GitRepo(
59+
repo = GitProject(
5860
url="https://github.com/vcs-python/libvcs",
5961
repo_dir=checkout,
6062
remotes={
@@ -64,7 +66,7 @@ $ pip install --user --upgrade --pre libvcs
6466
```
6567

6668
```python
67-
repo = GitRepo(
69+
repo = GitProject(
6870
url="https://github.com/vcs-python/libvcs",
6971
repo_dir=checkout,
7072
remotes={
@@ -76,7 +78,7 @@ $ pip install --user --upgrade --pre libvcs
7678
)
7779
```
7880

79-
- {meth}`libvcs.states.git.GitRepo.update_repo` now accepts `set_remotes=True`
81+
- {meth}`libvcs.projects.git.GitProject.update_repo` now accepts `set_remotes=True`
8082

8183
### Compatibility
8284

@@ -94,9 +96,9 @@ $ pip install --user --upgrade --pre libvcs
9496
({issue}`#316`)
9597
- New constants for `str` -> class mappings
9698

97-
- {data}`libvcs.states.constants.DEFAULT_VCS_CLASS_MAP`
98-
- {data}`libvcs.states.constants.DEFAULT_VCS_CLASS_UNION`
99-
- {data}`libvcs.states.constants.DEFAULT_VCS_LITERAL`
99+
- {data}`libvcs.projects.constants.DEFAULT_VCS_CLASS_MAP`
100+
- {data}`libvcs.projects.constants.DEFAULT_VCS_CLASS_UNION`
101+
- {data}`libvcs.projects.constants.DEFAULT_VCS_LITERAL`
100102

101103
- Remove tox and tox-poetry-installer. It turns out installing poetry inside a poetry project
102104
doesn't work well. (`poetry update`, `poetry publish`, etc. commands would fail)

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,17 @@ git = Git(dir=pathlib.Path.cwd() / 'my_git_repo')
3939
git.clone(url='https://github.com/vcs-python/libvcs.git')
4040
```
4141

42-
## States
42+
## Projects
4343

44-
Create a [`GitRepo`](https://libvcs.git-pull.com/states/git.html#libvcs.states.git.GitRepo) object
44+
Create a
45+
[`GitProject`](https://libvcs.git-pull.com/projects/git.html#libvcs.projects.git.GitProject) object
4546
of the project to inspect / checkout / update:
4647

4748
```python
4849
import pathlib
49-
from libvcs.states.git import GitRepo
50+
from libvcs.projects.git import GitProject
5051

51-
repo = GitRepo(
52+
repo = GitProject(
5253
url="https://github.com/vcs-python/libvcs",
5354
dir=pathlib.Path().cwd() / "my_repo",
5455
remotes={

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
quickstart
1212
cmd/index
13-
states/index
13+
projects/index
1414
```
1515

1616
```{toctree}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# `libvcs.states.base`
1+
# `libvcs.projects.base`
22

3-
Base objects / classes for states.
3+
Base objects / classes for projects.
44

5-
Adding your own VCS / Extending libvcs can be done through subclassing `BaseRepo`.
5+
Adding your own VCS / Extending libvcs can be done through subclassing `BaseProject`.
66

77
```{eval-rst}
88
.. autosummary::
99
:recursive:
1010
11-
libvcs.states.base.BaseRepo
11+
libvcs.projects.base.BaseProject
1212
```
1313

1414
```{eval-rst}
15-
.. automodule:: libvcs.states.base
15+
.. automodule:: libvcs.projects.base
1616
:members:
1717
:show-inheritance:
1818
```

docs/states/git.md renamed to docs/projects/git.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
# `libvcs.states.git`
1+
# `libvcs.projects.git`
22

33
For `git(1)`.
44

55
Compare to:
66
[`fabtools.require.git`](https://fabtools.readthedocs.io/en/0.19.0/api/require/git.html),
7-
[`salt.states.git`](https://docs.saltproject.io/en/latest/ref/states/all/salt.states.git.html),
7+
[`salt.projects.git`](https://docs.saltproject.io/en/latest/ref/projects/all/salt.projects.git.html),
88
[`ansible.builtin.git`](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html)
99

1010
```{eval-rst}
1111
.. autosummary::
1212
:recursive:
1313
14-
libvcs.states.git.GitRemote
15-
libvcs.states.git.GitRepo
14+
libvcs.projects.git.GitRemote
15+
libvcs.projects.git.GitProject
1616
```
1717

1818
```{eval-rst}
19-
.. automodule:: libvcs.states.git
19+
.. automodule:: libvcs.projects.git
2020
:members:
2121
:show-inheritance:
2222
:undoc-members:

docs/states/hg.md renamed to docs/projects/hg.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# `libvcs.states.hg`
1+
# `libvcs.projects.hg`
22

33
For mercurial, aka `hg(1)`.
44

55
```{eval-rst}
66
.. autosummary::
77
:recursive:
88
9-
libvcs.states.hg.MercurialRepo
9+
libvcs.projects.hg.MercurialProject
1010
```
1111

1212
```{eval-rst}
13-
.. automodule:: libvcs.states.hg
13+
.. automodule:: libvcs.projects.hg
1414
:members:
1515
:show-inheritance:
1616
:undoc-members:

docs/states/index.md renamed to docs/projects/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
(states)=
1+
(projects)=
22

3-
# `libvcs.states`
3+
# `libvcs.projects`
44

55
Compare to:
66
[`fabtools.require.git`](https://fabtools.readthedocs.io/en/0.19.0/api/require/git.html),
7-
[`salt.states.git`](https://docs.saltproject.io/en/latest/ref/states/all/salt.states.git.html),
7+
[`salt.projects.git`](https://docs.saltproject.io/en/latest/ref/projects/all/salt.projects.git.html),
88
[`ansible.builtin.git`](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html)
99

1010
:::{warning}
@@ -38,7 +38,7 @@ See examples below of git, mercurial, and subversion.
3838
## Constants
3939

4040
```{eval-rst}
41-
.. automodule:: libvcs.states.constants
41+
.. automodule:: libvcs.projects.constants
4242
:members:
4343
```
4444

docs/states/svn.md renamed to docs/projects/svn.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# `libvcs.states.svn`
1+
# `libvcs.projects.svn`
22

33
For subversion, aka `svn(1)`
44

55
```{eval-rst}
66
.. autosummary::
77
:recursive:
88
9-
libvcs.states.svn.SubversionRepo
9+
libvcs.projects.svn.SubversionProject
1010
```
1111

1212
```{eval-rst}
13-
.. automodule:: libvcs.states.svn
13+
.. automodule:: libvcs.projects.svn
1414
:members:
1515
:show-inheritance:
1616
:undoc-members:

docs/redirects.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"api.md" "states/index.md"
2-
"api/base.md" "states/base.md"
3-
"api/git.md" "states/git.md"
4-
"api/hg.md" "states/hg.md"
5-
"api/svn.md" "states/svn.md"
1+
"api.md" "projects/index.md"
2+
"api/base.md" "projects/base.md"
3+
"api/git.md" "projects/git.md"
4+
"api/hg.md" "projects/hg.md"
5+
"api/svn.md" "projects/svn.md"

libvcs/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
"""Repo package for libvcs."""
1+
"""Project package for libvcs."""
22
import logging
33

44
from .cmd.core import CmdLoggingAdapter
5-
from .states.base import BaseRepo
6-
from .states.git import GitRepo
7-
from .states.hg import MercurialRepo
8-
from .states.svn import SubversionRepo
5+
from .projects.base import BaseProject
6+
from .projects.git import GitProject
7+
from .projects.hg import MercurialProject
8+
from .projects.svn import SubversionProject
99

1010
__all__ = [
11-
"GitRepo",
12-
"MercurialRepo",
13-
"SubversionRepo",
14-
"BaseRepo",
11+
"GitProject",
12+
"MercurialProject",
13+
"SubversionProject",
14+
"BaseProject",
1515
"CmdLoggingAdapter",
1616
]
1717

0 commit comments

Comments
 (0)