-
Notifications
You must be signed in to change notification settings - Fork 91
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
dictdiffer: pragmatic merge #53
dictdiffer: pragmatic merge #53
Conversation
dbd7f63
to
08db2ee
Compare
1 similar comment
def get_path(patch): | ||
"""Return the path for a given dictdiffer.diff patch.""" | ||
if patch[1] != '': | ||
_str = (str, unicode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string_types
?
1231d87
to
062dfaa
Compare
@@ -38,17 +32,47 @@ def diff(first, second, node=None, ignore=None): | |||
>>> list(result) | |||
[('change', 'a', ('b', 'c'))] | |||
|
|||
PathLimit: | |||
list(diff({}, {'a': {'b': 'c'}})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you re-format the docstring?
"""
Path Limit:
>>> list(...)
[...]
""""
PS: check how does it look like if you compile them locally.
062dfaa
to
2e721f2
Compare
|
2e721f2
to
3a2affb
Compare
1 similar comment
@mvesper I've run some simple test on two random files from CDS. Data$ wget http://cds.cern.ch/record/2014647?of=recjson -O a.json
$ wget http://cds.cern.ch/record/2014586?of=recjson -O b.json Codeimport json, dictdiffer
a, b = json.loads(open('a.json').read()), json.loads(open('b.json').read())
%timeit d = list(dictdiffer.diff(a, b)) Results
|
|
* Alters the dictdiffer.diff function to allow expanding of patches (`expand` parameter) and to utilize a `path_limit` parameter, which stops the extraction process at a given point. Signed-off-by: Martin Vesper <martin.vesper@cern.ch>
* Adds the following files to handle the merging process: merge.py, conflict.py, resolve.py and unify.py. * The merge process is executed in the following steps: The differences between a latest common ancestor (lca) and two other data structures are extracted. Then the two occurring differences lists are checked for conflicts, which in turn are resolved. The patches are then unified. Signed-off-by: Martin Vesper <martin.vesper@cern.ch>
Signed-off-by: Martin Vesper <martin.vesper@cern.ch>
3a2affb
to
eb5dca0
Compare
As discussed with @jirikuncar a while ago, here the pull request of a more pragmatic dictdiffer.merge implementation.
Dictdiffer v0.5.0: merging
Which is executed in the following steps:
Signed-off-by: Martin Vesper martin.vesper@cern.ch