-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
108 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from gitgud import operations | ||
from gitgud.skills.level_builder import BasicLevel | ||
from gitgud.skills.util import Skill | ||
|
||
|
||
class MergeConflicts(BasicLevel): | ||
def _test(self): | ||
if not super()._test(): | ||
return False | ||
|
||
op = operations.get_operator() | ||
tree = op.repo.head.commit.tree | ||
merge_details = self.details()['M1']['files'] | ||
|
||
for blob in tree.blobs: | ||
path = blob.path | ||
content = merge_details[path][0] | ||
blob_content = blob.data_stream.read().decode('ascii') | ||
|
||
if content.strip() != blob_content.strip(): | ||
return False | ||
|
||
return True | ||
|
||
|
||
skill = Skill( | ||
'Placeholder', | ||
'newbasics', | ||
[ | ||
MergeConflicts('Merge Conflicts', 'conflicts', __name__) | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'1': | ||
message: "Added intro" | ||
files: | ||
intro.txt: | ||
- Once upon a time, there was a princess | ||
'3': | ||
message: "Added middle" | ||
add-files: | ||
middle.txt: | ||
- She lived a fulfilling life | ||
'2': | ||
message: "Added ending" | ||
add-files: | ||
middle.txt: | ||
- She lived | ||
ending.txt: | ||
- And then she died | ||
'M1': | ||
message: "Merge branch 'ending' into master" | ||
files: | ||
intro.txt: | ||
- Once upon a time, there was a princess | ||
middle.txt: | ||
- She lived a fulfilling life | ||
ending.txt: | ||
- And then she died |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Use this file to explain to the users how to use the git feature that this level focuses on. | ||
>>> | ||
Separate blocks using ">>>", and be sure to include tips and examples as explanation aids. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Hey, this file is getting added by details.yaml to commit 4! | ||
|
||
All this content will be copied exactly as it appears here, even with extra blank lines at the end of the file! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
In this file, write a short explanation of the level's goal (e.g. "Merge commits 1 and 2"). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
1 | ||
2 (master) | ||
3 : 1 (other) | ||
master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
git merge other | ||
echo "She lived a fulfilling life" > middle.txt | ||
git add middle.txt | ||
git commit --no-edit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
1 | ||
2 | ||
3 : 1 (other) | ||
M1 : 2 3 (master) | ||
master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import pytest | ||
|
||
from gitgud.skills.testing import simulate | ||
|
||
from . import skill | ||
|
||
|
||
level_tests = [ | ||
(level, level.solution_list()) for level in skill | ||
] | ||
|
||
|
||
@pytest.mark.parametrize('level,commands', level_tests) | ||
def test_level(gg, level, commands): | ||
simulate(gg, level, commands) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters