|
19 | 19 | import threading
|
20 | 20 | from collections import OrderedDict
|
21 | 21 | from textwrap import dedent
|
| 22 | +import warnings |
22 | 23 |
|
23 | 24 | from git.compat import (
|
24 | 25 | defenc,
|
@@ -902,8 +903,14 @@ def transform_kwarg(self, name, value, split_single_char_options):
|
902 | 903 |
|
903 | 904 | def transform_kwargs(self, split_single_char_options=True, **kwargs):
|
904 | 905 | """Transforms Python style kwargs into git command line options."""
|
| 906 | + # Python 3.6 preserves the order of kwargs and thus has a stable |
| 907 | + # order. For older versions sort the kwargs by the key to get a stable |
| 908 | + # order. |
| 909 | + if sys.version_info[:2] < (3, 6): |
| 910 | + kwargs = OrderedDict(sorted(kwargs.items(), key=lambda x: x[0])) |
| 911 | + warnings.warn("Python 3.5 support is deprecated. It does not preserve the order\n" + |
| 912 | + "for key-word arguments. Thus they will be sorted!!") |
905 | 913 | args = []
|
906 | | - kwargs = OrderedDict(sorted(kwargs.items(), key=lambda x: x[0])) |
907 | 914 | for k, v in kwargs.items():
|
908 | 915 | if isinstance(v, (list, tuple)):
|
909 | 916 | for value in v:
|
|
0 commit comments