From 343aa3118d1d6aa3c8e6a310377b7e2b7a7499c5 Mon Sep 17 00:00:00 2001 From: Christophe Nanteuil Date: Sun, 12 Feb 2023 10:36:18 +0000 Subject: [PATCH] allow to specify any commit to merge.py (#33) For debugging purpose. Co-authored-by: Christophe Nanteuil Reviewed-on: https://git.afpy.org/AFPy/python-docs-fr/pulls/33 Reviewed-by: Julien Palard Co-authored-by: Christophe Nanteuil Co-committed-by: Christophe Nanteuil --- merge.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/merge.py b/merge.py index 24de6db1..acea8914 100644 --- a/merge.py +++ b/merge.py @@ -29,14 +29,20 @@ def parse_args(): type=Path, help="Use this given cpython clone.", ) - parser.add_argument("branch", help="Merge from this branch") + parser.add_argument( + "branch", + help="Merge from this branch or from this commit", + ) return parser.parse_args() def setup_repo(repo_path: Path, branch: str): """Ensure we're up-to-date.""" - run("git", "-C", repo_path, "checkout", branch) - run("git", "-C", repo_path, "pull", "--ff-only") + if branch.find('.') == 2: + run("git", "-C", repo_path, "checkout", branch) + run("git", "-C", repo_path, "pull", "--ff-only") + else: # it's a commit + run("git", "-C", repo_path, "checkout", branch) def copy_new_files(new_files: set[Path], pot_path: Path) -> None: