janhoy commented on PR #4413:
URL: https://github.com/apache/solr/pull/4413#issuecomment-4425968583
I asked claude to perform a full simulation in a fresh git repo. It
constructed a git repo with three branches and various changelog files on the
branches, and ran the commands. Results:
## Test scenarios for `logchange.py`
Tested against a real git repo at https://github.com/janhoy/changelogtest
### Branch setup
| Branch | Contents in `changelog/unreleased/` |
|---|---|
| `main` | feature-a, feature-b, feature-c |
| `branch_10x` (stable) | feature-a, feature-b (feature-c not backported) |
| `branch_10_1` (release) | feature-a, feature-b, fix-d (release-only, not
on stable or main) |
### RC1: `prepare`
```sh
python3 dev-tools/scripts/logchange.py prepare \
--version 10.1.0 --release-branch branch_10_1
```
**Expected:** runs `gradlew logchangeRelease`, moves all unreleased entries
(A, B, D) to `changelog/v10.1.0/`, regenerates `CHANGELOG.md`, leaves
uncommitted for review.
**Result:** ✅ All three files moved correctly. `[unreleased]` block stripped
from `CHANGELOG.md`.
### RC2: `prepare` after a new fix added
A new fix (fix-e) was committed to `changelog/unreleased/` on `branch_10_1`
after RC1.
```sh
python3 dev-tools/scripts/logchange.py prepare \
--version 10.1.0 --release-branch branch_10_1 --commit
```
**Expected:** detects `v10.1.0/` already exists (RC2+ path), moves only
fix-e, leaves A/B/D untouched.
**Result:** ✅ Only fix-e moved. Existing entries not duplicated. Committed
automatically.
### `prepare` idempotency: no new unreleased files
```sh
python3 dev-tools/scripts/logchange.py prepare \
--version 10.1.0 --release-branch branch_10_1 --commit
```
**Expected:** nothing to move, `logchangeGenerate` produces no diff, nothing
staged → no commit created.
**Result:** ✅ Clean NOP. Output: _"Nothing staged — changelog is already up
to date."_
### `forward-port` review run (no push)
```sh
python3 dev-tools/scripts/logchange.py forward-port \
--version 10.1.0 --release-branch branch_10_1 \
--stable-branch branch_10x --release-date 2026-05-12
```
**Expected:**
- Writes `release-date.txt`, regenerates `CHANGELOG.md` with date, commits
to `branch_10_1`
- Cherry-picks 5 changelog commits to `branch_10x` and `main`
- On `branch_10x`: A and B deleted from unreleased, D and E land in
`v10.1.0/`
- On `main`: feature-c remains untouched in unreleased; A, B, D, E appear in
`v10.1.0/`
- Release-only fix D causes no conflicts on either branch
- Nothing pushed
**Result:** ✅ All cherry-picks applied cleanly. `main` unreleased correctly
retains only feature-c.
### `forward-port` re-run with `--push` (idempotency + push test)
```sh
python3 dev-tools/scripts/logchange.py forward-port \
--version 10.1.0 --release-branch branch_10_1 \
--stable-branch branch_10x --release-date 2026-05-12 --push
```
**Expected:** detects all patches already applied, skips cherry-pick step,
pushes all three branches.
**Result:** ✅ Output: _"No changelog commits to forward-port — branch_10x is
already up to date."_ All three branches pushed to GitHub.
> **Bug found and fixed during testing:** the original commit detection used
`git log A..B` (SHA-based), which caused already-applied cherry-picks to be
re-applied on a second run. Fixed by switching to `git log --cherry-pick
--right-only
A...B` (patch-id-based), making the command fully idempotent.
### `forward-port` idempotency: everything already done
```sh
python3 dev-tools/scripts/logchange.py forward-port \
--version 10.1.0 --release-branch branch_10_1 \
--stable-branch branch_10x --release-date 2026-05-12
```
**Expected:** release-date.txt already correct, no staged changes, no new
commits to cherry-pick → complete NOP.
**Result:** ✅ _"Nothing staged — release-date.txt and CHANGELOG.md were
already up to date."_ and _"No changelog commits to forward-port — branch_10x
is already up to date."_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]