gitnextver 1.0.1__tar.gz → 1.0.4__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.
- gitnextver-1.0.4/CHANGELOG.md +69 -0
- gitnextver-1.0.4/PKG-INFO +144 -0
- gitnextver-1.0.4/README.md +115 -0
- {gitnextver-1.0.1 → gitnextver-1.0.4}/pyproject.toml +9 -0
- {gitnextver-1.0.1 → gitnextver-1.0.4}/src/gitnextver/__init__.py +1 -1
- {gitnextver-1.0.1 → gitnextver-1.0.4}/src/gitnextver/__version__.py +2 -2
- gitnextver-1.0.4/src/gitnextver/cli.py +570 -0
- gitnextver-1.0.4/src/gitnextver/versioning.py +38 -0
- gitnextver-1.0.4/tests/__init__.py +1 -0
- gitnextver-1.0.4/tests/test_controls.py +112 -0
- gitnextver-1.0.4/tests/test_gitnextver.py +171 -0
- gitnextver-1.0.4/uv.lock +306 -0
- gitnextver-1.0.1/.omc/project-memory.json +0 -37
- gitnextver-1.0.1/.omc/sessions/511be226-6daa-430e-81f0-71e8ec698ab1.json +0 -8
- gitnextver-1.0.1/CLAUDE.md +0 -70
- gitnextver-1.0.1/PKG-INFO +0 -72
- gitnextver-1.0.1/README.md +0 -43
- gitnextver-1.0.1/src/gitnextver/cli.py +0 -453
- {gitnextver-1.0.1 → gitnextver-1.0.4}/.gitignore +0 -0
- {gitnextver-1.0.1 → gitnextver-1.0.4}/LICENSE +0 -0
- {gitnextver-1.0.1 → gitnextver-1.0.4}/src/gitnextver/__main__.py +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `gitnextver` are documented here.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [1.0.4] — 2026-10-19
|
|
8
|
+
|
|
9
|
+
### Controlled release operations
|
|
10
|
+
- Add the pure `gitnextver.versioning.next_version` API, configurable initial
|
|
11
|
+
tag, and patch/minor/major increments with strict stable-tag selection.
|
|
12
|
+
- Add `--dry-run`, `--pull=False`, `--commit=False` and `--push=False` while
|
|
13
|
+
preserving the original default workflow. Dry runs perform no Git mutations
|
|
14
|
+
or network calls; tag-only mode requires a clean checkout.
|
|
15
|
+
- Push only the selected tag and current branch, atomically, and report push
|
|
16
|
+
rejection as failure instead of silently accepting GitPython PushInfo errors.
|
|
17
|
+
- Exercise controls with real isolated Git repositories and bare remotes;
|
|
18
|
+
add Windows to the existing CI matrix and the missing Ruff dev dependency.
|
|
19
|
+
- Limit source distributions to package sources, tests and package metadata,
|
|
20
|
+
excluding local agent state and private work logs.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- `tests/test_gitnextver.py` — 17 pytest tests covering version calculation,
|
|
24
|
+
tag lookup, index-version reading, and end-to-end `main()` integration tests
|
|
25
|
+
using throwaway git repositories in `tmp_path`.
|
|
26
|
+
- `pytest` added as a dev dependency (`[dependency-groups] dev`).
|
|
27
|
+
- `.github/workflows/ci.yml` — matrix CI (Python 3.10/3.12/3.13, Linux and
|
|
28
|
+
macOS) running lint, format check, and the full test suite on every push and
|
|
29
|
+
pull request against `main`.
|
|
30
|
+
- `.github/workflows/publish.yml` — publishes to PyPI via OIDC trusted
|
|
31
|
+
publishing whenever a `vX.Y.Z` tag is pushed (no API token required).
|
|
32
|
+
- `docs/` — Jekyll site with the JustTheDocs remote theme, containing a home
|
|
33
|
+
page (`index.md`) with usage, "What it does NOT do", and troubleshooting
|
|
34
|
+
sections, plus a contributor style guide (`style-guide.md`).
|
|
35
|
+
- `_read_index_version(git_dir)` helper in `cli.py` reads the raw binary
|
|
36
|
+
index header to determine the format version before GitPython touches it.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
- `ensure_gitpython_compatibility()` now gates the index downgrade on the
|
|
40
|
+
actual index format version read from the binary header rather than
|
|
41
|
+
attempting to access `repo.index.entries` and catching an `AssertionError`.
|
|
42
|
+
The downgrade (`git update-index --index-version 2`) is performed only when
|
|
43
|
+
the on-disk version is > 2; the fast path (version ≤ 2) returns immediately
|
|
44
|
+
with no side effects.
|
|
45
|
+
- `main()` docstring expanded to document parameters, return behaviour, and
|
|
46
|
+
the full workflow.
|
|
47
|
+
- Inline comments in `ensure_gitpython_compatibility()` explain why the hack
|
|
48
|
+
exists, which git versions trigger it, and why reading the header first is
|
|
49
|
+
better than catching a post-facto `AssertionError`.
|
|
50
|
+
- `README.md` restructured: added "What it does NOT do" section and a
|
|
51
|
+
Troubleshooting section covering index-lock and index-version issues.
|
|
52
|
+
|
|
53
|
+
## [1.0.1] — 2026-04-08
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
- Stash/restore logic wraps pull to prevent losing local work on conflict.
|
|
57
|
+
- Index-lock cleanup in `stash_uncommitted_changes` when git index is corrupt.
|
|
58
|
+
|
|
59
|
+
## [1.0.0] — 2025-xx-xx
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
- Initial release: patch-only version bumping with stash/pull/push workflow.
|
|
63
|
+
- GitPython index version compatibility handling.
|
|
64
|
+
- Rich-formatted console output and loguru-based logging.
|
|
65
|
+
|
|
66
|
+
[Unreleased]: https://github.com/twardoch/gitnextver/compare/v1.0.4...HEAD
|
|
67
|
+
[1.0.4]: https://github.com/twardoch/gitnextver/releases/tag/v1.0.4
|
|
68
|
+
[1.0.1]: https://github.com/twardoch/gitnextver/compare/v1.0.0...v1.0.1
|
|
69
|
+
[1.0.0]: https://github.com/twardoch/gitnextver/releases/tag/v1.0.0
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: gitnextver
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: Automatically bump semantic version tags in Git repositories
|
|
5
|
+
Project-URL: Homepage, https://github.com/twardoch/gitnextver
|
|
6
|
+
Project-URL: Repository, https://github.com/twardoch/gitnextver
|
|
7
|
+
Project-URL: Issues, https://github.com/twardoch/gitnextver/issues
|
|
8
|
+
Author-email: Adam Twardoch <adam+github@twardoch.com>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: bump,git,semver,tag,version
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: fire
|
|
25
|
+
Requires-Dist: gitpython
|
|
26
|
+
Requires-Dist: loguru
|
|
27
|
+
Requires-Dist: rich
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# gitnextver
|
|
31
|
+
|
|
32
|
+
Automatically bump the patch component of a `vX.Y.Z` git tag, commit all
|
|
33
|
+
staged changes, and push — one command to cut a release.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install gitnextver
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or run without installing:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
uvx gitnextver
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Bump patch version in the current directory
|
|
51
|
+
gitnextver
|
|
52
|
+
|
|
53
|
+
# Specify a repository path
|
|
54
|
+
gitnextver --directory /path/to/repo
|
|
55
|
+
|
|
56
|
+
# Verbose output
|
|
57
|
+
gitnextver --verbose
|
|
58
|
+
|
|
59
|
+
# Capture the new version in a script
|
|
60
|
+
NEW_VER=$(gitnextver)
|
|
61
|
+
echo "Released $NEW_VER"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## What it does
|
|
65
|
+
|
|
66
|
+
### Controlled workflows
|
|
67
|
+
|
|
68
|
+
The original defaults are preserved. Each step can also be controlled:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
# Read-only: no fetch/pull, stash, index rewrite, commit, tag or push
|
|
72
|
+
gitnextver --dry-run --initial=v2.1.0
|
|
73
|
+
|
|
74
|
+
# Tag the existing clean HEAD locally, without pulling or committing
|
|
75
|
+
gitnextver --commit=False --pull=False --push=False --initial=v2.1.0
|
|
76
|
+
|
|
77
|
+
# Choose which component to increment
|
|
78
|
+
gitnextver --bump=minor
|
|
79
|
+
gitnextver --bump=major
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`--initial` applies only when there are no canonical `vX.Y.Z` tags. Minor and
|
|
83
|
+
major bumps reset smaller components to zero. Host suffixes, prereleases and
|
|
84
|
+
leading-zero tags are ignored. Options are validated before any mutations.
|
|
85
|
+
Pushes send only the current branch and selected tag, atomically; a rejected
|
|
86
|
+
push exits nonzero and retains the local commit/tag for manual recovery.
|
|
87
|
+
An atomic push requires a server that supports it. Existing tags are never moved.
|
|
88
|
+
|
|
89
|
+
For automation that owns Git itself, use the pure API (no Git/network calls):
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from gitnextver.versioning import next_version
|
|
93
|
+
|
|
94
|
+
assert next_version([], initial="v2.1.0") == "v2.1.0"
|
|
95
|
+
assert next_version(["v2.1.9"], bump="minor") == "v2.2.0"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Default workflow
|
|
99
|
+
|
|
100
|
+
1. Validates that the working directory is a git repository.
|
|
101
|
+
2. Checks the git index format and rewrites to version 2 if GitPython requires
|
|
102
|
+
it (see [Troubleshooting](#troubleshooting)).
|
|
103
|
+
3. Stashes uncommitted/untracked changes so the pull step can proceed.
|
|
104
|
+
4. Pulls from the configured remote (skipped when no remote exists).
|
|
105
|
+
5. Re-applies the stash.
|
|
106
|
+
6. Finds the highest `vMAJOR.MINOR.PATCH` tag, increments `PATCH` by one.
|
|
107
|
+
Defaults to `v1.0.0` when no version tags exist.
|
|
108
|
+
7. Stages all changes, commits with the version string as the commit message,
|
|
109
|
+
creates the tag, and pushes.
|
|
110
|
+
|
|
111
|
+
## What it does NOT do
|
|
112
|
+
|
|
113
|
+
- Generate a changelog or release notes.
|
|
114
|
+
- Write a version number into source files.
|
|
115
|
+
- Create GitHub/GitLab releases.
|
|
116
|
+
- Honour conventional commits or commit linting.
|
|
117
|
+
|
|
118
|
+
Use `--bump=minor` or `--bump=major` for larger version changes.
|
|
119
|
+
|
|
120
|
+
## Troubleshooting
|
|
121
|
+
|
|
122
|
+
### Git index lock (`could not write index`)
|
|
123
|
+
|
|
124
|
+
A stale `.git/index.lock` file from a previous interrupted git operation can
|
|
125
|
+
block stashing or committing. Fix:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
rm -f .git/index.lock
|
|
129
|
+
git reset --mixed
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### GitPython index version error
|
|
133
|
+
|
|
134
|
+
Git 2.20+ and the Xcode CLI tools on macOS can write index format version 3
|
|
135
|
+
or 4, which GitPython does not support. `gitnextver` detects and rewrites the
|
|
136
|
+
index automatically. If the automatic rewrite fails, run:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
git update-index --index-version=2
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
Apache-2.0
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# gitnextver
|
|
2
|
+
|
|
3
|
+
Automatically bump the patch component of a `vX.Y.Z` git tag, commit all
|
|
4
|
+
staged changes, and push — one command to cut a release.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install gitnextver
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Or run without installing:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
uvx gitnextver
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Bump patch version in the current directory
|
|
22
|
+
gitnextver
|
|
23
|
+
|
|
24
|
+
# Specify a repository path
|
|
25
|
+
gitnextver --directory /path/to/repo
|
|
26
|
+
|
|
27
|
+
# Verbose output
|
|
28
|
+
gitnextver --verbose
|
|
29
|
+
|
|
30
|
+
# Capture the new version in a script
|
|
31
|
+
NEW_VER=$(gitnextver)
|
|
32
|
+
echo "Released $NEW_VER"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## What it does
|
|
36
|
+
|
|
37
|
+
### Controlled workflows
|
|
38
|
+
|
|
39
|
+
The original defaults are preserved. Each step can also be controlled:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
# Read-only: no fetch/pull, stash, index rewrite, commit, tag or push
|
|
43
|
+
gitnextver --dry-run --initial=v2.1.0
|
|
44
|
+
|
|
45
|
+
# Tag the existing clean HEAD locally, without pulling or committing
|
|
46
|
+
gitnextver --commit=False --pull=False --push=False --initial=v2.1.0
|
|
47
|
+
|
|
48
|
+
# Choose which component to increment
|
|
49
|
+
gitnextver --bump=minor
|
|
50
|
+
gitnextver --bump=major
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`--initial` applies only when there are no canonical `vX.Y.Z` tags. Minor and
|
|
54
|
+
major bumps reset smaller components to zero. Host suffixes, prereleases and
|
|
55
|
+
leading-zero tags are ignored. Options are validated before any mutations.
|
|
56
|
+
Pushes send only the current branch and selected tag, atomically; a rejected
|
|
57
|
+
push exits nonzero and retains the local commit/tag for manual recovery.
|
|
58
|
+
An atomic push requires a server that supports it. Existing tags are never moved.
|
|
59
|
+
|
|
60
|
+
For automation that owns Git itself, use the pure API (no Git/network calls):
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from gitnextver.versioning import next_version
|
|
64
|
+
|
|
65
|
+
assert next_version([], initial="v2.1.0") == "v2.1.0"
|
|
66
|
+
assert next_version(["v2.1.9"], bump="minor") == "v2.2.0"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Default workflow
|
|
70
|
+
|
|
71
|
+
1. Validates that the working directory is a git repository.
|
|
72
|
+
2. Checks the git index format and rewrites to version 2 if GitPython requires
|
|
73
|
+
it (see [Troubleshooting](#troubleshooting)).
|
|
74
|
+
3. Stashes uncommitted/untracked changes so the pull step can proceed.
|
|
75
|
+
4. Pulls from the configured remote (skipped when no remote exists).
|
|
76
|
+
5. Re-applies the stash.
|
|
77
|
+
6. Finds the highest `vMAJOR.MINOR.PATCH` tag, increments `PATCH` by one.
|
|
78
|
+
Defaults to `v1.0.0` when no version tags exist.
|
|
79
|
+
7. Stages all changes, commits with the version string as the commit message,
|
|
80
|
+
creates the tag, and pushes.
|
|
81
|
+
|
|
82
|
+
## What it does NOT do
|
|
83
|
+
|
|
84
|
+
- Generate a changelog or release notes.
|
|
85
|
+
- Write a version number into source files.
|
|
86
|
+
- Create GitHub/GitLab releases.
|
|
87
|
+
- Honour conventional commits or commit linting.
|
|
88
|
+
|
|
89
|
+
Use `--bump=minor` or `--bump=major` for larger version changes.
|
|
90
|
+
|
|
91
|
+
## Troubleshooting
|
|
92
|
+
|
|
93
|
+
### Git index lock (`could not write index`)
|
|
94
|
+
|
|
95
|
+
A stale `.git/index.lock` file from a previous interrupted git operation can
|
|
96
|
+
block stashing or committing. Fix:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
rm -f .git/index.lock
|
|
100
|
+
git reset --mixed
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### GitPython index version error
|
|
104
|
+
|
|
105
|
+
Git 2.20+ and the Xcode CLI tools on macOS can write index format version 3
|
|
106
|
+
or 4, which GitPython does not support. `gitnextver` detects and rewrites the
|
|
107
|
+
index automatically. If the automatic rewrite fails, run:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
git update-index --index-version=2
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
Apache-2.0
|
|
@@ -50,6 +50,9 @@ version-file = "src/gitnextver/__version__.py"
|
|
|
50
50
|
[tool.hatch.build.targets.wheel]
|
|
51
51
|
packages = ["src/gitnextver"]
|
|
52
52
|
|
|
53
|
+
[tool.hatch.build.targets.sdist]
|
|
54
|
+
only-include = ["src/gitnextver", "tests", "pyproject.toml", "uv.lock", "README.md", "LICENSE", "CHANGELOG.md"]
|
|
55
|
+
|
|
53
56
|
[tool.pytest.ini_options]
|
|
54
57
|
testpaths = ["tests"]
|
|
55
58
|
|
|
@@ -64,3 +67,9 @@ select = ["E", "F", "W", "I"]
|
|
|
64
67
|
python_version = "3.10"
|
|
65
68
|
warn_return_any = true
|
|
66
69
|
warn_unused_configs = true
|
|
70
|
+
|
|
71
|
+
[dependency-groups]
|
|
72
|
+
dev = [
|
|
73
|
+
"pytest>=9.1.1",
|
|
74
|
+
"ruff>=0.17.1",
|
|
75
|
+
]
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '1.0.
|
|
22
|
-
__version_tuple__ = version_tuple = (1, 0,
|
|
21
|
+
__version__ = version = '1.0.4'
|
|
22
|
+
__version_tuple__ = version_tuple = (1, 0, 4)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|