From 152df5317010c5076051ee5a49b7fad4054bebb2 Mon Sep 17 00:00:00 2001 From: LeeZeHao Date: Wed, 29 Oct 2025 17:32:11 +0800 Subject: [PATCH 1/6] Add hp-fetch-merge Hands-On --- hands_on/fetch_merge.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 hands_on/fetch_merge.py diff --git a/hands_on/fetch_merge.py b/hands_on/fetch_merge.py new file mode 100644 index 0000000..1b8d211 --- /dev/null +++ b/hands_on/fetch_merge.py @@ -0,0 +1,18 @@ +import os + +from exercise_utils.cli import run_command +from exercise_utils.gitmastery import create_start_tag + +__requires_git__ = True +__requires_github__ = True + + +def download(verbose: bool): + os.makedirs("samplerepo-finances") + # Clone the samplerepo-finances repo + run_command(["git", "clone", "https://github.com/git-mastery/samplerepo-finances.git"], verbose) + os.chdir("samplerepo-finances") + # Change the remote origin to point to samplerepo-finances-2 + run_command(["git", "remote", "set-url", "origin", "https://github.com/git-mastery/samplerepo-finances-2.git"], verbose) + + pass From 9d5ae6402016eed853bad5837af03785f0ee8021 Mon Sep 17 00:00:00 2001 From: LeeZeHao Date: Wed, 29 Oct 2025 17:56:41 +0800 Subject: [PATCH 2/6] Delete fetch_merge.py --- hands_on/fetch_merge.py | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 hands_on/fetch_merge.py diff --git a/hands_on/fetch_merge.py b/hands_on/fetch_merge.py deleted file mode 100644 index 1b8d211..0000000 --- a/hands_on/fetch_merge.py +++ /dev/null @@ -1,18 +0,0 @@ -import os - -from exercise_utils.cli import run_command -from exercise_utils.gitmastery import create_start_tag - -__requires_git__ = True -__requires_github__ = True - - -def download(verbose: bool): - os.makedirs("samplerepo-finances") - # Clone the samplerepo-finances repo - run_command(["git", "clone", "https://github.com/git-mastery/samplerepo-finances.git"], verbose) - os.chdir("samplerepo-finances") - # Change the remote origin to point to samplerepo-finances-2 - run_command(["git", "remote", "set-url", "origin", "https://github.com/git-mastery/samplerepo-finances-2.git"], verbose) - - pass From 0ac2386449a4a2f3bfa42bbd2ec34b8f2a47f0d3 Mon Sep 17 00:00:00 2001 From: LeeZeHao Date: Wed, 29 Oct 2025 18:02:24 +0800 Subject: [PATCH 3/6] Add fetch_merge.py skeleton --- hands_on/fetch_merge.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hands_on/fetch_merge.py diff --git a/hands_on/fetch_merge.py b/hands_on/fetch_merge.py new file mode 100644 index 0000000..04f6d0b --- /dev/null +++ b/hands_on/fetch_merge.py @@ -0,0 +1,9 @@ +from exercise_utils.cli import run_command +from exercise_utils.gitmastery import create_start_tag + +__requires_git__ = True +__requires_github__ = True + + +def download(verbose: bool): + pass From 0e351d2f63ac6e1e084a41bf286937096132b6f0 Mon Sep 17 00:00:00 2001 From: LeeZeHao Date: Wed, 29 Oct 2025 18:08:53 +0800 Subject: [PATCH 4/6] Add download for hp-fetch-merge --- hands_on/fetch_merge.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hands_on/fetch_merge.py b/hands_on/fetch_merge.py index 04f6d0b..1b8d211 100644 --- a/hands_on/fetch_merge.py +++ b/hands_on/fetch_merge.py @@ -1,3 +1,5 @@ +import os + from exercise_utils.cli import run_command from exercise_utils.gitmastery import create_start_tag @@ -6,4 +8,11 @@ def download(verbose: bool): + os.makedirs("samplerepo-finances") + # Clone the samplerepo-finances repo + run_command(["git", "clone", "https://github.com/git-mastery/samplerepo-finances.git"], verbose) + os.chdir("samplerepo-finances") + # Change the remote origin to point to samplerepo-finances-2 + run_command(["git", "remote", "set-url", "origin", "https://github.com/git-mastery/samplerepo-finances-2.git"], verbose) + pass From 8518cc5376dc1334156918e853edac584d720cc8 Mon Sep 17 00:00:00 2001 From: LeeZeHao Date: Mon, 10 Nov 2025 22:12:49 +0800 Subject: [PATCH 5/6] Implement suggested coding convention changes --- hands_on/fetch_merge.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/hands_on/fetch_merge.py b/hands_on/fetch_merge.py index 1b8d211..18999dc 100644 --- a/hands_on/fetch_merge.py +++ b/hands_on/fetch_merge.py @@ -4,15 +4,11 @@ from exercise_utils.gitmastery import create_start_tag __requires_git__ = True -__requires_github__ = True +__requires_github__ = False def download(verbose: bool): os.makedirs("samplerepo-finances") - # Clone the samplerepo-finances repo - run_command(["git", "clone", "https://github.com/git-mastery/samplerepo-finances.git"], verbose) + run_command(["git", "clone", "https://github.com/git-mastery/samplerepo-finances.git"], verbose) os.chdir("samplerepo-finances") - # Change the remote origin to point to samplerepo-finances-2 - run_command(["git", "remote", "set-url", "origin", "https://github.com/git-mastery/samplerepo-finances-2.git"], verbose) - - pass + run_command(["git", "remote", "set-url", "origin", "https://github.com/git-mastery/samplerepo-finances-2.git"], verbose) From e064be9c3eaaae04062b7ac2a2f21b65173a4ec1 Mon Sep 17 00:00:00 2001 From: LeeZeHao Date: Sat, 6 Dec 2025 23:34:16 +0800 Subject: [PATCH 6/6] Change command call to new clone_repo_with_git util function --- hands_on/fetch_merge.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hands_on/fetch_merge.py b/hands_on/fetch_merge.py index 18999dc..8424cbf 100644 --- a/hands_on/fetch_merge.py +++ b/hands_on/fetch_merge.py @@ -1,14 +1,17 @@ import os from exercise_utils.cli import run_command -from exercise_utils.gitmastery import create_start_tag +from exercise_utils.git import clone_repo_with_git __requires_git__ = True __requires_github__ = False def download(verbose: bool): - os.makedirs("samplerepo-finances") - run_command(["git", "clone", "https://github.com/git-mastery/samplerepo-finances.git"], verbose) + clone_repo_with_git( + "https://github.com/git-mastery/samplerepo-finances.git", verbose + ) os.chdir("samplerepo-finances") - run_command(["git", "remote", "set-url", "origin", "https://github.com/git-mastery/samplerepo-finances-2.git"], verbose) + run_command( + ["git", "remote", "set-url", "origin", "https://github.com/se-edu/samplerepo-finances-2.git"], verbose + ) \ No newline at end of file