From 83fcb1a2249d704af6532a210753cb95754df111 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Mar 2026 13:55:03 +0000 Subject: [PATCH] Fix version to single bump (9029) and update CLAUDE.md versioning rules CLAUDE.md: Rewrite the "Version and date bump" subsection to document that: - Exactly ONE version bump is allowed per PR (PRs are squash-merged into one commit on the default branch, so one commit = one version increment) - The correct version is computed from git history: currentversion="${currenttag}.$((commits_since_tag + 9001 + 1))" with the +1 accounting for the PR's own squash commit not yet on the default branch - Fall back to incrementing DESCRIPTION's version by 1 if git describe fails - The Date: field tracks the date of the *last* PR commit (updated each time) DESCRIPTION / NEWS.md: Correct the version from 3.0.1.9030 back to 3.0.1.9029. Two version bumps were made across two commits in this PR; since it will be squash-merged as one commit only one bump is correct. Also update Date to today (2026-03-07). https://claude.ai/code/session_01Cp154UtssHg84bw38xiiTG --- CLAUDE.md | 34 ++++++++++++++++++++++------------ DESCRIPTION | 4 ++-- NEWS.md | 2 +- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index eec8c2f86..3c8878bf5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -148,24 +148,34 @@ Version format: `major.minor.patch.dev` (e.g., `3.0.1.9021`) ### Version and date bump required for every PR -Before opening a pull request, always increment the four-digit dev counter by 1 in **both** of these files: +All PRs are **squash-merged**, so each PR lands as exactly **one commit** on the default branch. Version numbers are kept in sync with the cumulative commit count since the last released tag. Therefore **exactly one version bump is allowed per PR**, regardless of how many intermediate commits are made on the branch. -1. **`DESCRIPTION`** — the `Version:` field: - ``` - Version: 3.0.1.9021 → Version: 3.0.1.9022 - ``` +#### Computing the correct version number -2. **`NEWS.md`** — the top-level heading: - ``` - # AMR 3.0.1.9021 → # AMR 3.0.1.9022 - ``` +Run the following from the repo root to determine the version string to use: -Read the current version from `DESCRIPTION`, add 1 to the last numeric component, and write the new version to both files in the same commit as the rest of the PR changes. +```bash +currenttag=$(git describe --tags --abbrev=0 | sed 's/v//') +currenttagfull=$(git describe --tags --abbrev=0) +defaultbranch=$(git branch | cut -c 3- | grep -E '^master$|^main$') +currentcommit=$(git rev-list --count ${currenttagfull}..${defaultbranch}) +currentversion="${currenttag}.$((currentcommit + 9001 + 1))" +echo "$currentversion" +``` -Also bump the date to the current date in **`DESCRIPTION`**, where it's in the `Date:` field in ISO format: +The `+ 1` accounts for the fact that this PR's squash commit is not yet on the default branch. Set **both** of these files to the resulting version string (and only once per PR, even across multiple commits): + +1. **`DESCRIPTION`** — the `Version:` field +2. **`NEWS.md`** — the top-level heading `# AMR ` + +If `git describe` fails (e.g. no tags exist in the environment), fall back to reading the current version from `DESCRIPTION` and adding 1 to the last numeric component — but only if no bump has already been made in this PR. + +#### Date field + +The `Date:` field in `DESCRIPTION` must reflect the date of the **last commit to the PR** (not the first), in ISO format. Update it with every commit so it is always current: ``` -Date: 2025-12-31 +Date: 2026-03-07 ``` ## Internal State diff --git a/DESCRIPTION b/DESCRIPTION index 57548f235..776521b68 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 3.0.1.9030 -Date: 2026-03-06 +Version: 3.0.1.9029 +Date: 2026-03-07 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by diff --git a/NEWS.md b/NEWS.md index 71738ef11..d35c2cdf8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 3.0.1.9030 +# AMR 3.0.1.9029 ### New * Integration with the **tidymodels** framework to allow seamless use of SIR, MIC and disk data in modelling pipelines via `recipes`