-
-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimistic conflicts resolution mecanism
Basically: - when there is a conflict (i.e. someone try to save with an old ETag) - we compare new version with its reference version and with the latest known - if we see only simple case (features added both side, removal on one side…), then we merge
- Loading branch information
1 parent
70c7445
commit a82da0c
Showing
5 changed files
with
213 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,61 @@ | ||
from umap.utils import merge_conflicts | ||
|
||
|
||
def test_adding_one_element(): | ||
assert merge_conflicts(["A", "B"], ["A", "B", "C"], ["A", "B", "D"]) == [ | ||
"A", | ||
"B", | ||
"C", | ||
"D", | ||
] | ||
|
||
|
||
def test_adding_elements(): | ||
assert merge_conflicts(["A", "B"], ["A", "B", "C", "D"], ["A", "B", "E", "F"]) == [ | ||
"A", | ||
"B", | ||
"C", | ||
"D", | ||
"E", | ||
"F", | ||
] | ||
# Order does not count | ||
assert merge_conflicts(["A", "B"], ["B", "C", "D", "A"], ["A", "B", "E", "F"]) == [ | ||
"B", | ||
"C", | ||
"D", | ||
"A", | ||
"E", | ||
"F", | ||
] | ||
|
||
|
||
def test_adding_one_removing_one(): | ||
assert merge_conflicts(["A", "B"], ["A", "C"], ["A", "B", "D"]) == [ | ||
"A", | ||
"C", | ||
"D", | ||
] | ||
|
||
|
||
def test_removing_same_element(): | ||
# No added element (otherwise we cannot know if "new" elements are old modified | ||
# or old removed and new added). | ||
assert merge_conflicts(["A", "B", "C"], ["A", "B"], ["A", "B"]) == [ | ||
"A", | ||
"B", | ||
] | ||
|
||
|
||
def test_removing_changed_element(): | ||
assert merge_conflicts(["A", "B"], ["A", "C"], ["A"]) is False | ||
|
||
|
||
def test_changing_removed_element(): | ||
assert merge_conflicts(["A", "B"], ["A"], ["A", "C"]) is False | ||
|
||
|
||
def test_changing_same_element(): | ||
assert merge_conflicts(["A", "B"], ["A", "D"], ["A", "C"]) is False | ||
# Order does not count | ||
assert merge_conflicts(["A", "B", "C"], ["B", "D", "A"], ["A", "E", "B"]) is False |
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