Skip to content

Commit bd570ee

Browse files
[merge-squash] Implement exercise T6L2/merge-squash (#148)
# Exercise Review ## Exercise Discussion #68 ## 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? - [x] 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 34386b3 commit bd570ee

File tree

12 files changed

+492
-0
lines changed

12 files changed

+492
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"exercise_name": "merge-squash",
3+
"tags": [
4+
"git-branch",
5+
"git-merge",
6+
"git-reset"
7+
],
8+
"requires_git": true,
9+
"requires_github": false,
10+
"base_files": {},
11+
"exercise_repo": {
12+
"repo_type": "local",
13+
"repo_name": "friends-cast",
14+
"repo_title": null,
15+
"create_fork": null,
16+
"init": true
17+
}
18+
}

merge_squash/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
See https://git-mastery.github.io/lessons/merge/exercise-merge-squash.html

merge_squash/__init__.py

Whitespace-only changes.

merge_squash/download.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
from exercise_utils.file import create_or_update_file
2+
from exercise_utils.git import add, commit, checkout
3+
4+
5+
def setup(verbose: bool = False):
6+
create_or_update_file(
7+
"joey.txt",
8+
"""
9+
Matt LeBlanc
10+
""",
11+
)
12+
add(["."], verbose)
13+
commit("Add Joey", verbose)
14+
15+
create_or_update_file(
16+
"phoebe.txt",
17+
"""
18+
Lisa Kudrow
19+
""",
20+
)
21+
add(["."], verbose)
22+
commit("Add Phoebe", verbose)
23+
24+
checkout("supporting", True, verbose)
25+
create_or_update_file(
26+
"mike.txt",
27+
"""
28+
Paul Rudd
29+
""",
30+
)
31+
add(["."], verbose)
32+
commit("Add Mike", verbose)
33+
34+
create_or_update_file(
35+
"janice.txt",
36+
"""
37+
Maggie Wheeler
38+
""",
39+
)
40+
add(["."], verbose)
41+
commit("Add Janice", verbose)
42+
43+
checkout("main", False, verbose)
44+
create_or_update_file(
45+
"ross.txt",
46+
"""
47+
David Schwimmer
48+
""",
49+
)
50+
add(["."], verbose)
51+
commit("Add Ross", verbose)

merge_squash/tests/__init__.py

Whitespace-only changes.

merge_squash/tests/specs/base.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
initialization:
2+
steps:
3+
- type: commit
4+
empty: true
5+
message: Set initial state
6+
id: start
7+
- type: new-file
8+
filename: joey.txt
9+
contents: |
10+
Matt LeBlanc
11+
- type: add
12+
files:
13+
- joey.txt
14+
- type: commit
15+
message: Add Joey
16+
17+
- type: new-file
18+
filename: phoebe.txt
19+
contents: |
20+
Lisa Kudrow
21+
- type: add
22+
files:
23+
- phoebe.txt
24+
- type: commit
25+
message: Add Phoebe
26+
27+
- type: branch
28+
branch-name: supporting
29+
- type: checkout
30+
branch-name: supporting
31+
32+
- type: new-file
33+
filename: mike.txt
34+
contents: |
35+
Paul Rudd
36+
- type: add
37+
files:
38+
- mike.txt
39+
- type: commit
40+
message: Add Mike
41+
42+
- type: new-file
43+
filename: janice.txt
44+
contents: |
45+
Maggie Wheeler
46+
- type: add
47+
files:
48+
- janice.txt
49+
- type: commit
50+
message: Add Janice
51+
52+
- type: checkout
53+
branch-name: main
54+
55+
- type: new-file
56+
filename: ross.txt
57+
contents: |
58+
David Schwimmer
59+
- type: add
60+
files:
61+
- ross.txt
62+
- type: commit
63+
message: Add Ross
64+
65+
- type: merge
66+
squash: true
67+
branch-name: supporting
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
initialization:
2+
steps:
3+
- type: commit
4+
empty: true
5+
message: Set initial state
6+
id: start
7+
- type: new-file
8+
filename: joey.txt
9+
contents: |
10+
Matt LeBlanc
11+
- type: add
12+
files:
13+
- joey.txt
14+
- type: commit
15+
message: Add Joey
16+
17+
- type: branch
18+
branch-name: supporting
19+
- type: checkout
20+
branch-name: supporting
21+
22+
- type: new-file
23+
filename: mike.txt
24+
contents: |
25+
Paul Rudd
26+
- type: add
27+
files:
28+
- mike.txt
29+
- type: commit
30+
message: Add Mike
31+
32+
- type: new-file
33+
filename: janice.txt
34+
contents: |
35+
Maggie Wheeler
36+
- type: add
37+
files:
38+
- janice.txt
39+
- type: commit
40+
message: Add Janice
41+
42+
- type: checkout
43+
branch-name: main
44+
45+
- type: new-file
46+
filename: ross.txt
47+
contents: |
48+
David Schwimmer
49+
- type: add
50+
files:
51+
- ross.txt
52+
- type: commit
53+
message: Add Ross
54+
55+
- type: merge
56+
branch-name: supporting
57+
squash: true
58+
59+
- type: commit
60+
message: Squash commit
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
initialization:
2+
steps:
3+
- type: commit
4+
empty: true
5+
message: Set initial state
6+
id: start
7+
- type: new-file
8+
filename: joey.txt
9+
contents: |
10+
Matt LeBlanc
11+
- type: add
12+
files:
13+
- joey.txt
14+
- type: commit
15+
message: Add Joey
16+
17+
- type: new-file
18+
filename: phoebe.txt
19+
contents: |
20+
Lisa Kudrow
21+
- type: add
22+
files:
23+
- phoebe.txt
24+
- type: commit
25+
message: Add Phoebe
26+
27+
- type: branch
28+
branch-name: supporting
29+
- type: checkout
30+
branch-name: supporting
31+
32+
- type: new-file
33+
filename: mike.txt
34+
contents: |
35+
Paul Rudd
36+
- type: add
37+
files:
38+
- mike.txt
39+
- type: commit
40+
message: Add Mike
41+
42+
- type: new-file
43+
filename: janice.txt
44+
contents: |
45+
Maggie Wheeler
46+
- type: add
47+
files:
48+
- janice.txt
49+
- type: commit
50+
message: Add Janice
51+
52+
- type: checkout
53+
branch-name: main
54+
55+
- type: new-file
56+
filename: ross.txt
57+
contents: |
58+
David Schwimmer
59+
- type: add
60+
files:
61+
- ross.txt
62+
- type: commit
63+
message: Add Ross
64+
65+
- type: merge
66+
branch-name: supporting
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
initialization:
2+
steps:
3+
- type: commit
4+
empty: true
5+
message: Set initial state
6+
id: start
7+
- type: new-file
8+
filename: joey.txt
9+
contents: |
10+
Matt LeBlanc
11+
- type: add
12+
files:
13+
- joey.txt
14+
- type: commit
15+
message: Add Joey
16+
17+
- type: new-file
18+
filename: phoebe.txt
19+
contents: |
20+
Lisa Kudrow
21+
- type: add
22+
files:
23+
- phoebe.txt
24+
- type: commit
25+
message: Add Phoebe
26+
27+
- type: branch
28+
branch-name: supporting
29+
- type: checkout
30+
branch-name: supporting
31+
32+
- type: new-file
33+
filename: mike.txt
34+
contents: |
35+
Paul Rudd
36+
- type: add
37+
files:
38+
- mike.txt
39+
- type: commit
40+
message: Add Mike
41+
42+
- type: new-file
43+
filename: janice.txt
44+
contents: |
45+
Maggie Wheeler
46+
- type: add
47+
files:
48+
- janice.txt
49+
- type: commit
50+
message: Add Janice
51+
52+
- type: checkout
53+
branch-name: main
54+
55+
- type: new-file
56+
filename: ross.txt
57+
contents: |
58+
David Schwimmer
59+
- type: add
60+
files:
61+
- ross.txt
62+
- type: commit
63+
message: Add Ross

0 commit comments

Comments
 (0)