Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions view_commits/.gitmastery-exercise.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"exercise_name": "view-commits",
"tags": [
"git-diff",
"git-show"
],
"requires_git": true,
"requires_github": true,
"base_files": {
"answers.txt": "answers.txt"
},
"exercise_repo": {
"repo_type": "remote",
"repo_name": "duty-roster",
"repo_title": "gm-duty-roster",
"create_fork": false,
"init": true
}
}
7 changes: 7 additions & 0 deletions view_commits/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# view-commits

The duty-roster repo contains five files, each one containing names of people assigned to a duty roster for a specific day of the week. For example, Monday.txt contains names of people assigned to duties on Mondays. These files are updated monthly, to record any changes to duty assignments.

## Task

Answer the questions in the answers.txt, by examining the relevant commits in the duty-roster repo.
Empty file added view_commits/__init__.py
Empty file.
8 changes: 8 additions & 0 deletions view_commits/download.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from exercise_utils.cli import run_command
from exercise_utils.file import append_to_file, create_or_update_file
from exercise_utils.gitmastery import create_start_tag

def setup(verbose: bool = False):
create_start_tag(verbose)


16 changes: 16 additions & 0 deletions view_commits/res/answers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Q: In February, who was replaced in the Wednesday duty roster?
A:

Q: In February, who joined the Tuesday duty roster?
A:

Q: In April, what were the new names added to the duty rosters? Remove/add extra rows where appropriate.
A:
- name1
- name2

Q: In January, who were in the Tuesday duty roster? Remove/add extra rows where appropriate.
A:
- name1
- name2

Empty file added view_commits/tests/__init__.py
Empty file.
6 changes: 6 additions & 0 deletions view_commits/tests/specs/base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initialization:
steps:
- type: commit
empty: true
message: Empty commit
id: start
27 changes: 27 additions & 0 deletions view_commits/tests/specs/extra_question_three.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
initialization:
steps:
- type: new-file
filename: answers.txt
contents: |
Q: In February, who was replaced in the Wednesday duty roster?
A: Eric

Q: In February, who joined the Tuesday duty roster?
A: Bruce

Q: In April, what were the new names added to the duty rosters? Give the list of names as one line, separated by spaces.
A:
- Betsy
- Beth
- Daisy
- Eric

Q: In January, who were in the Tuesday duty roster? Give the list of names as one line, separated by spaces.
A:
- Charlie
- type: add
files:
- answers.txt
- type: commit
message: Initial commit
id: start
22 changes: 22 additions & 0 deletions view_commits/tests/specs/incomplete_answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
initialization:
steps:
- type: new-file
filename: answers.txt
contents: |
Q: In February, who was replaced in the Wednesday duty roster?
A: Eric

Q: In February, who joined the Tuesday duty roster?
A: Bruce

Q: In April, what were the new names added to the duty rosters? Give the list of names as one line, separated by spaces.
A:

Q: In January, who were in the Tuesday duty roster? Give the list of names as one line, separated by spaces.
A:
- type: add
files:
- answers.txt
- type: commit
message: Initial commit
id: start
22 changes: 22 additions & 0 deletions view_commits/tests/specs/incomplete_question_three.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
initialization:
steps:
- type: new-file
filename: answers.txt
contents: |
Q: In February, who was replaced in the Wednesday duty roster?
A: Eric

Q: In February, who joined the Tuesday duty roster?
A: Bruce

Q: In April, what were the new names added to the duty rosters? Give the list of names as one line, separated by spaces.
A: Betsy Daisy

Q: In January, who were in the Tuesday duty roster? Give the list of names as one line, separated by spaces.
A: Charlie
- type: add
files:
- answers.txt
- type: commit
message: Initial commit
id: start
22 changes: 22 additions & 0 deletions view_commits/tests/specs/no_answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
initialization:
steps:
- type: new-file
filename: answers.txt
contents: |
Q: In February, who was replaced in the Wednesday duty roster?
A:

Q: In February, who joined the Tuesday duty roster?
A:

Q: In April, what were the new names added to the duty rosters? Give the list of names as one line, separated by spaces.
A:

Q: In January, who were in the Tuesday duty roster? Give the list of names as one line, separated by spaces.
A:
- type: add
files:
- answers.txt
- type: commit
message: Initial commit
id: start
26 changes: 26 additions & 0 deletions view_commits/tests/specs/valid_answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
initialization:
steps:
- type: new-file
filename: answers.txt
contents: |
Q: In February, who was replaced in the Wednesday duty roster?
A: Eric

Q: In February, who joined the Tuesday duty roster?
A: Bruce

Q: In April, what were the new names added to the duty rosters? Give the list of names as one line, separated by spaces.
A:
- Betsy
- Beth
- Daisy

Q: In January, who were in the Tuesday duty roster? Give the list of names as one line, separated by spaces.
A:
- Charlie
- type: add
files:
- answers.txt
- type: commit
message: Initial commit
id: start
25 changes: 25 additions & 0 deletions view_commits/tests/specs/wrong_question_one.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
initialization:
steps:
- type: new-file
filename: answers.txt
contents: |
Q: In February, who was replaced in the Wednesday duty roster?
A: Ergodic

Q: In February, who joined the Tuesday duty roster?
A: Bruce

Q: In April, what were the new names added to the duty rosters? Give the list of names as one line, separated by spaces.
A:
- Betsy
- Daisy
- Beth

Q: In January, who were in the Tuesday duty roster? Give the list of names as one line, separated by spaces.
A: Charlie
- type: add
files:
- answers.txt
- type: commit
message: Initial commit
id: start
26 changes: 26 additions & 0 deletions view_commits/tests/specs/wrong_question_three.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
initialization:
steps:
- type: new-file
filename: answers.txt
contents: |
Q: In February, who was replaced in the Wednesday duty roster?
A: Eric

Q: In February, who joined the Tuesday duty roster?
A: Bruce

Q: In April, what were the new names added to the duty rosters? Give the list of names as one line, separated by spaces.
A:
- Betsy
- Bruce
- Daisy

Q: In January, who were in the Tuesday duty roster? Give the list of names as one line, separated by spaces.
A:
- Charlie
- type: add
files:
- answers.txt
- type: commit
message: Initial commit
id: start
26 changes: 26 additions & 0 deletions view_commits/tests/specs/wrong_question_two.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
initialization:
steps:
- type: new-file
filename: answers.txt
contents: |
Q: In February, who was replaced in the Wednesday duty roster?
A: Eric

Q: In February, who joined the Tuesday duty roster?
A: Bru

Q: In April, what were the new names added to the duty rosters? Give the list of names as one line, separated by spaces.
A:
- Betsy
- Beth
- Daisy

Q: In January, who were in the Tuesday duty roster? Give the list of names as one line, separated by spaces.
A:
- Charlie
- type: add
files:
- answers.txt
- type: commit
message: Initial commit
id: start
Loading