Fixed: remove OrderedDict for compability reasons (python2.6)
This commit is contained in:
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
# Import from the Standard Library
|
# Import from the Standard Library
|
||||||
from string import hexdigits
|
from string import hexdigits
|
||||||
from collections import OrderedDict
|
|
||||||
|
|
||||||
# Import from pygit2
|
# Import from pygit2
|
||||||
from _pygit2 import Repository as _Repository
|
from _pygit2 import Repository as _Repository
|
||||||
@@ -193,26 +192,23 @@ class Repository(_Repository):
|
|||||||
a = treeish_to_tree(a) or a
|
a = treeish_to_tree(a) or a
|
||||||
b = treeish_to_tree(b) or b
|
b = treeish_to_tree(b) or b
|
||||||
|
|
||||||
opts = OrderedDict([
|
opt_keys = ['flags', 'context_lines', 'interhunk_lines']
|
||||||
('flags', flags),
|
opt_values = [flags, context_lines, interhunk_lines]
|
||||||
('context_lines', context_lines),
|
|
||||||
('interhunk_lines', interhunk_lines)
|
|
||||||
])
|
|
||||||
|
|
||||||
# Case 1: Diff tree to tree
|
# Case 1: Diff tree to tree
|
||||||
if isinstance(a, Tree) and isinstance(b, Tree):
|
if isinstance(a, Tree) and isinstance(b, Tree):
|
||||||
return a.diff_to_tree(b, **opts)
|
return a.diff_to_tree(b, **dict(zip(opt_keys, opt_values)))
|
||||||
|
|
||||||
# Case 2: Index to workdir
|
# Case 2: Index to workdir
|
||||||
elif a is None and b is None:
|
elif a is None and b is None:
|
||||||
return self.index.diff_to_workdir(*opts.values())
|
return self.index.diff_to_workdir(*opt_values)
|
||||||
|
|
||||||
# Case 3: Diff tree to index or workdir
|
# Case 3: Diff tree to index or workdir
|
||||||
elif isinstance(a, Tree) and b is None:
|
elif isinstance(a, Tree) and b is None:
|
||||||
if cached:
|
if cached:
|
||||||
return a.diff_to_index(self.index, **opts)
|
return a.diff_to_index(self.index, *opt_values)
|
||||||
else:
|
else:
|
||||||
return a.diff_to_workdir(*opts.values())
|
return a.diff_to_workdir(*opt_values)
|
||||||
|
|
||||||
# Case 4: Diff blob to blob
|
# Case 4: Diff blob to blob
|
||||||
if isinstance(a, Blob) and isinstance(b, Blob):
|
if isinstance(a, Blob) and isinstance(b, Blob):
|
||||||
|
Reference in New Issue
Block a user