From d5dd271b71c2fbd193e563aa3cbfd259c02da4e7 Mon Sep 17 00:00:00 2001 From: Phanuphat Srisukhawasu Date: Wed, 12 Nov 2025 10:57:57 +0800 Subject: [PATCH 1/4] feat(merge-step): Add extra option for merge squash --- src/repo_smith/steps/merge_step.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/repo_smith/steps/merge_step.py b/src/repo_smith/steps/merge_step.py index 6686d4f..96d3806 100644 --- a/src/repo_smith/steps/merge_step.py +++ b/src/repo_smith/steps/merge_step.py @@ -8,10 +8,18 @@ @dataclass class MergeStep(Step): branch_name: str - no_fast_forward: bool + no_fast_forward: bool = False + squash: bool = False def execute(self, repo: Repo) -> None: - if self.no_fast_forward: - repo.git.merge(self.branch_name, "--no-edit", "--no-ff") - else: - repo.git.merge(self.branch_name, "--no-edit") + merge_args = [self.branch_name, "--no-edit"] + + if self.squash: + merge_args.append("--squash") + elif self.no_fast_forward: + merge_args.append("--no-ff") + + repo.git.merge(*merge_args) + + if self.squash: + repo.git.commit("-m", f"Squash merge branch '{self.branch_name}'") From 25af54ad8728747737b4c144c0e49770b74d5a8a Mon Sep 17 00:00:00 2001 From: Phanuphat Srisukhawasu Date: Wed, 12 Nov 2025 11:05:30 +0800 Subject: [PATCH 2/4] feat(merge-step): Add squash option in repo initializer --- src/repo_smith/initialize_repo.py | 1 + src/repo_smith/steps/merge_step.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/repo_smith/initialize_repo.py b/src/repo_smith/initialize_repo.py index 1e08e12..03220ba 100644 --- a/src/repo_smith/initialize_repo.py +++ b/src/repo_smith/initialize_repo.py @@ -278,6 +278,7 @@ def __parse_step(self, step: Any) -> Step: id=id, branch_name=step.get("branch-name"), no_fast_forward=step.get("no-ff", False), + squash=step.get("squash", False), ) elif step_type == StepType.REMOTE: if "remote-url" not in step: diff --git a/src/repo_smith/steps/merge_step.py b/src/repo_smith/steps/merge_step.py index 96d3806..d3f8efe 100644 --- a/src/repo_smith/steps/merge_step.py +++ b/src/repo_smith/steps/merge_step.py @@ -8,8 +8,8 @@ @dataclass class MergeStep(Step): branch_name: str - no_fast_forward: bool = False - squash: bool = False + no_fast_forward: bool + squash: bool def execute(self, repo: Repo) -> None: merge_args = [self.branch_name, "--no-edit"] From d5ac405d271d340edd69834f1478a99135ee1409 Mon Sep 17 00:00:00 2001 From: Phanuphat Srisukhawasu Date: Wed, 12 Nov 2025 11:26:42 +0800 Subject: [PATCH 3/4] chore: Bump version to 0.11.0 --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ae34246..cf51345 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,16 +4,16 @@ build-backend = "hatchling.build" [project] name = "repo-smith" -version = "0.10.1" +version = "0.11.0" authors = [{ name = "Jiahao, Woo", email = "woojiahao1234@gmail.com" }] description = "YAML-based configuration for initializing Git repositories for unit testing" readme = "README.md" requires-python = ">=3.13" classifiers = [ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Topic :: Software Development", - "Programming Language :: Python :: 3.13", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Topic :: Software Development", + "Programming Language :: Python :: 3.13", ] license.file = "LICENSE" dependencies = ["GitPython", "PyYAML", "types-PyYAML"] From c633f561d5a99a476e075cf4bbbd716736dac5df Mon Sep 17 00:00:00 2001 From: Phanuphat Srisukhawasu Date: Wed, 12 Nov 2025 11:28:41 +0800 Subject: [PATCH 4/4] chore: Revert formatter --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cf51345..69d6898 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,10 +10,10 @@ description = "YAML-based configuration for initializing Git repositories for un readme = "README.md" requires-python = ">=3.13" classifiers = [ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Topic :: Software Development", - "Programming Language :: Python :: 3.13", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Topic :: Software Development", + "Programming Language :: Python :: 3.13", ] license.file = "LICENSE" dependencies = ["GitPython", "PyYAML", "types-PyYAML"]