Skip to content

Commit

Permalink
Merge branch 'emilk:master' into patch7
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Dec 12, 2024
2 parents 9de500d + 99c1034 commit 78d6bfa
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
1 change: 1 addition & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ I usually do this all on the `master` branch, but doing it in a release branch i
(cd crates/egui_demo_lib && cargo publish --quiet) && echo "✅ egui_demo_lib"
(cd crates/egui_glow && cargo publish --quiet) && echo "✅ egui_glow"
(cd crates/eframe && cargo publish --quiet) && echo "✅ eframe"
(cd crates/egui_kittest && cargo publish --quiet) && echo "✅ egui_kittest"
```

## Announcements
Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/containers/area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ impl Area {
id: interact_id,
layer_id,
rect: state.rect(),
interact_rect: state.rect(),
interact_rect: state.rect().intersect(constrain_rect),
sense,
enabled,
},
Expand Down
40 changes: 32 additions & 8 deletions scripts/generate_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,42 @@ def add_to_changelog_file(crate: str, content: str, version: str) -> None:
file.write(content)


def calc_commit_range(new_version: str) -> str:
parts = new_version.split(".")
assert len(parts) == 3, "Expected version to be on the format X.Y.Z"
major = int(parts[0])
minor = int(parts[1])
patch = int(parts[2])

if 0 < patch:
# A patch release.
# Include changes since last patch release.
# This assumes we've cherry-picked stuff for this release.
diff_since_version = f"0.{minor}.{patch - 1}"
elif 0 < minor:
# A minor release
# The diff should span everything since the last minor release.
# The script later excludes duplicated automatically, so we don't include stuff that
# was part of intervening patch releases.
diff_since_version = f"{major}.{minor - 1}.0"
else:
# A major release
# The diff should span everything since the last major release.
# The script later excludes duplicated automatically, so we don't include stuff that
# was part of intervening minor/patch releases.
diff_since_version = f"{major - 1}.{minor}.0"

return f"{diff_since_version}..HEAD"


def main() -> None:
parser = argparse.ArgumentParser(description="Generate a changelog.")
parser.add_argument("--commit-range", help="e.g. 0.24.0..HEAD", required=True)
parser.add_argument("--version", help="What release is this?", required=True)
parser.add_argument(
"--write", help="Write into the different changelogs?", action="store_true"
)
parser.add_argument("--version", help="What release is this?")
args = parser.parse_args()

if args.write and not args.version:
print("ERROR: --version is required when --write is used")
sys.exit(1)
commit_range = calc_commit_range(args.version)

crate_names = [
"ecolor",
Expand All @@ -251,7 +275,7 @@ def main() -> None:
all_changelogs += file.read()

repo = Repo(".")
commits = list(repo.iter_commits(args.commit_range))
commits = list(repo.iter_commits(commit_range))
commits.reverse() # Most recent last
commit_infos = list(map(get_commit_info, commits))

Expand Down Expand Up @@ -307,7 +331,7 @@ def main() -> None:
unsorted_prs.append(pr_summary(pr_info))

print()
print(f"Full diff at https://github.com/emilk/egui/compare/{args.commit_range}")
print(f"Full diff at https://github.com/emilk/egui/compare/{commit_range}")
print()
for crate in crate_names:
if crate in crate_sections:
Expand Down

0 comments on commit 78d6bfa

Please sign in to comment.