Skip to content

Commit

Permalink
Import fix, minor edits, add example files that cause merge conflict
Browse files Browse the repository at this point in the history
but should be automatically resolvable.
  • Loading branch information
Martin Sandve Alnæs committed Mar 15, 2016
1 parent 6cd8523 commit 715eb15
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 21 deletions.
21 changes: 0 additions & 21 deletions nbdime/merging/autoresolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,6 @@
from ..patching import patch


def __find_strategy(path, strategies):
# Use closest parent strategy if specific entry is missing
strategy = strategies.get(path)
ppath = path
while strategy is None and ppath:
i = ppath.rfind("/")
if i >= 0:
ppath = ppath[:i]
strategy = strategies.get(path)
else:
break
return strategy


# Strategies for handling conflicts TODO: Implement these and refine further!
#generic_conflict_strategies = ("mergetool", "use-base", "use-local", "use-remote", "fail")
#source_conflict_strategies = generic_conflict_strategies + ("inline",)
#transient_conflict_strategies = generic_conflict_strategies + ("clear",)
#output_conflict_strategies = transient_conflict_strategies + ("use-all",)


# Sentinel object
Deleted = object()

Expand Down
1 change: 1 addition & 0 deletions nbdime/merging/notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def autoresolve_notebook_conflicts(merged, local_diffs, remote_diffs, args):
"/cells/*/metadata": "use-base",
#"/cells/*/source": "inline",
#"/cells/*/outputs": "join",
"/cells/*/outputs": "clear",
}
resolutions, local_diffs, remote_diffs = \
autoresolve(merged, local_diffs, remote_diffs, strategies, "")
Expand Down
1 change: 1 addition & 0 deletions nbdime/nbmergeapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from __future__ import unicode_literals
from __future__ import print_function

import json
import os
import sys
import argparse
Expand Down
86 changes: 86 additions & 0 deletions scratch/mergetesting/v1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hello\n"
]
}
],
"source": [
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"print(\"world\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"x = \"Hello\""
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"x = \"hello\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3+"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
83 changes: 83 additions & 0 deletions scratch/mergetesting/v2.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello\n"
]
}
],
"source": [
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"world\n"
]
}
],
"source": [
"print(\"world\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"x = \"Hello\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3+"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
75 changes: 75 additions & 0 deletions scratch/mergetesting/v3.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"world\n"
]
}
],
"source": [
"print(\"world\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"x = \"hello\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3+"
}
},
"nbformat": 4,
"nbformat_minor": 0
}

0 comments on commit 715eb15

Please sign in to comment.