Skip to content

Commit 343aa31

Browse files
Christophe NanteuilchristopheNan
authored andcommitted
allow to specify any commit to merge.py (#33)
For debugging purpose. Co-authored-by: Christophe Nanteuil <christophe.nanteuil@gmail.com> Reviewed-on: https://git.afpy.org/AFPy/python-docs-fr/pulls/33 Reviewed-by: Julien Palard <julien@palard.fr> Co-authored-by: Christophe Nanteuil <christophenan@noreply.localhost> Co-committed-by: Christophe Nanteuil <christophenan@noreply.localhost>
1 parent 9e57ea0 commit 343aa31

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

merge.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,20 @@ def parse_args():
2929
type=Path,
3030
help="Use this given cpython clone.",
3131
)
32-
parser.add_argument("branch", help="Merge from this branch")
32+
parser.add_argument(
33+
"branch",
34+
help="Merge from this branch or from this commit",
35+
)
3336
return parser.parse_args()
3437

3538

3639
def setup_repo(repo_path: Path, branch: str):
3740
"""Ensure we're up-to-date."""
38-
run("git", "-C", repo_path, "checkout", branch)
39-
run("git", "-C", repo_path, "pull", "--ff-only")
41+
if branch.find('.') == 2:
42+
run("git", "-C", repo_path, "checkout", branch)
43+
run("git", "-C", repo_path, "pull", "--ff-only")
44+
else: # it's a commit
45+
run("git", "-C", repo_path, "checkout", branch)
4046

4147

4248
def copy_new_files(new_files: set[Path], pot_path: Path) -> None:

0 commit comments

Comments
 (0)