Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automerge fails for two divergent notebook with the same base #64

Closed
eco32i opened this issue Jul 16, 2016 · 5 comments
Closed

Automerge fails for two divergent notebook with the same base #64

eco32i opened this issue Jul 16, 2016 · 5 comments

Comments

@eco32i
Copy link

eco32i commented Jul 16, 2016

The (minmal) test case:

https://gist.github.com/eco32i/2f9877b8044c28ef8a5ca525342ec73e

With these three notebooks executing the merge command fails:

$ nbmerge test.ipynb test_A.ipynb test_B.ipynb -o test_merged
Traceback (most recent call last):
  File "/home/ilya/.venv/pydata3/bin/nbmerge", line 9, in <module>
    load_entry_point('nbdime', 'console_scripts', 'nbmerge')()
  File "/mnt/data/scipy2016/nbdime/nbdime/nbmergeapp.py", line 109, in main
    r = main_merge(args)
  File "/mnt/data/scipy2016/nbdime/nbdime/nbmergeapp.py", line 43, in main_merge
    m, lc, rc = merge_notebooks(b, l, r, args)
  File "/mnt/data/scipy2016/nbdime/nbdime/merging/notebooks.py", line 54, in merge_notebooks
    autoresolve_notebook_conflicts(merged, local_diffs, remote_diffs, args)
  File "/mnt/data/scipy2016/nbdime/nbdime/merging/notebooks.py", line 36, in autoresolve_notebook_conflicts
    autoresolve(merged, local_diffs, remote_diffs, strategies, "")
  File "/mnt/data/scipy2016/nbdime/nbdime/merging/autoresolve.py", line 346, in autoresolve
    return autoresolve_dicts(merged, local_diff, remote_diff, strategies, path)
  File "/mnt/data/scipy2016/nbdime/nbdime/merging/autoresolve.py", line 317, in autoresolve_dicts
    newvalue, ldi, rdi = autoresolve(value, le.diff, re.diff, strategies, subpath)
  File "/mnt/data/scipy2016/nbdime/nbdime/merging/autoresolve.py", line 348, in autoresolve
    return autoresolve_lists(merged, local_diff, remote_diff, strategies, path)
  File "/mnt/data/scipy2016/nbdime/nbdime/merging/autoresolve.py", line 234, in autoresolve_lists
    newvalue, ldi, rdi = autoresolve(merged[j], le.diff, re.diff, strategies, subpath)
  File "/mnt/data/scipy2016/nbdime/nbdime/merging/autoresolve.py", line 346, in autoresolve
    return autoresolve_dicts(merged, local_diff, remote_diff, strategies, path)
  File "/mnt/data/scipy2016/nbdime/nbdime/merging/autoresolve.py", line 281, in autoresolve_dicts
    assert set(lcd) == set(rcd)
AssertionError
@martinal
Copy link
Collaborator

Thanks a lot for a very useful small test case. I've fixed a couple of issues with the autoresolution based on this. A question for you: what would your expectation be for the merge result of the first cell here? The source code (print(1+3)) is unchanged in A but the transients (execution count and output) change, while the cell is deleted in B. If transients are ignored, a natural result is to delete the cell. If the transients are considered as important data, it must be presented to the user for resolution. We might need options to configure the importance of output changes.

@martinal
Copy link
Collaborator

Note that if you run nbmerge now, the output is a valid notebook with the unresolved conflicts stored in the metadata. This is a temporary stage, the mergetool for conflict resolution is work in progress.

@eco32i
Copy link
Author

eco32i commented Jul 29, 2016

I stumbled upon this while trying to merge two notebooks with real life analyses and then reduced it to what I thought was a minimal test case. From the original notebooks I'd say I want to keep both but this may not be the desired course of action in all cases. May be leaving it up to user to handle is not a bad idea.

@martinal
Copy link
Collaborator

This use case currently fails on missing handling of execution count conflict in the mergetool.

@martinal
Copy link
Collaborator

Deleting all output here and trying merge results in first cell not checked for deletion in merge gui.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants