Skip to content

Commit fc8bee1

Browse files
authored
[hp-branch-rename] Implement hands-on T6L4/hp-branch-rename (#199)
# Exercise Review ## Exercise Discussion Fixes #141 ## Checklist - [ ] If you require a new remote repository on the `Git-Mastery` organization, have you [created a request](https://github.com/git-mastery/exercises/issues/new?template=request_exercise_repository.md) for it? - [ ] Have you written unit tests using [`repo-smith`](https://github.com/git-mastery/repo-smith) to validate the exercise grading scheme? - [X] Have you tested the download script using `test-download.sh`? - [X] Have you verified that this exercise does not already exist or is not currently in review? - [ ] Did you introduce a new grading mechanism that should belong to [`git-autograder`](https://github.com/git-mastery/git-autograder)? - [ ] Did you introduce a new dependency that should belong to [`app`](https://github.com/git-mastery/app)?
1 parent 768b373 commit fc8bee1

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

hands_on/branch_rename.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import os
2+
3+
from exercise_utils.file import create_or_update_file
4+
from exercise_utils.git import add, checkout, commit, init, merge_with_message
5+
6+
__requires_git__ = True
7+
__requires_github__ = False
8+
9+
10+
def download(verbose: bool):
11+
os.makedirs("samplerepo-books")
12+
os.chdir("samplerepo-books")
13+
init(verbose)
14+
15+
create_or_update_file(
16+
"horror.txt",
17+
"""
18+
Horror Stories
19+
"""
20+
)
21+
add(["."], verbose)
22+
commit("Add horror.txt", verbose)
23+
24+
checkout("textbooks", True, verbose)
25+
create_or_update_file(
26+
"textbooks.txt",
27+
"""
28+
Textbooks
29+
"""
30+
)
31+
add(["."], verbose)
32+
commit("Add textbooks.txt", verbose)
33+
34+
checkout("main", False, verbose)
35+
checkout("fantasy", True, verbose)
36+
create_or_update_file(
37+
"fantasy.txt",
38+
"""
39+
Fantasy Books
40+
"""
41+
)
42+
add(["."], verbose)
43+
commit("Add fantasy.txt", verbose)
44+
45+
checkout("main", False, verbose)
46+
merge_with_message("textbooks", False, "Merge branch textbooks", verbose)

0 commit comments

Comments
 (0)