Skip to content

Commit 768b373

Browse files
authored
[hp-diff-files] Implement hands-on T4L3/hp-diff-files (#198)
# Exercise Review ## Exercise Discussion Fixes #197 ## 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 df4d90a commit 768b373

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

hands_on/diff_files.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import os
2+
3+
from exercise_utils.file import create_or_update_file, append_to_file
4+
from exercise_utils.git import add, init, commit
5+
6+
__requires_git__ = True
7+
__requires_github__ = False
8+
9+
10+
def download(verbose: bool):
11+
os.makedirs("employees")
12+
os.chdir("employees")
13+
init(verbose)
14+
15+
create_or_update_file(
16+
"list.txt",
17+
"""
18+
Andy Bernard
19+
""",
20+
)
21+
os.makedirs("andy")
22+
create_or_update_file(
23+
"andy/history.txt",
24+
"""
25+
Previously in Stamford branch
26+
""",
27+
)
28+
add(["."], verbose)
29+
commit("Add Andy", verbose)
30+
31+
append_to_file(
32+
"list.txt",
33+
"""
34+
Pam Beesly
35+
""",
36+
)
37+
add(["."], verbose)
38+
commit("Add Pam", verbose)
39+
40+
append_to_file(
41+
"list.txt",
42+
"""
43+
Kelly Kapoor
44+
""",
45+
)
46+
add(["."], verbose)
47+
commit("Add Kelly", verbose)
48+
49+
append_to_file(
50+
"list.txt",
51+
"""
52+
Kevin Malone
53+
""",
54+
)
55+
add(["."], verbose)
56+
57+
append_to_file(
58+
"list.txt",
59+
"""
60+
Jim Halpert
61+
""",
62+
)
63+
append_to_file(
64+
"andy/history.txt",
65+
"""
66+
Education: Cornell
67+
""",
68+
)

0 commit comments

Comments
 (0)