Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit52862a6

Browse files
committed
Restore order of operators before executing the git command only for < py3.6
Since Python 3.6 kwargs order will be preserved and thus provide a stableorder, therefore we can make89ade7bconditional based on the Python. Thus make it able to pass ordered optionsto Git commands.See:https://www.python.org/dev/peps/pep-0468/
1 parent20f4a9d commit52862a6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎git/cmd.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,8 +902,12 @@ def transform_kwarg(self, name, value, split_single_char_options):
902902

903903
deftransform_kwargs(self,split_single_char_options=True,**kwargs):
904904
"""Transforms Python style kwargs into git command line options."""
905+
# only since 3.6 Python preserves the order of kwargs and thus has a stable
906+
# order. For older versions sort the kwargs by the key to get a stable
907+
# order.
908+
ifsys.version_info[:2]< (3,6):
909+
kwargs=OrderedDict(sorted(kwargs.items(),key=lambdax:x[0]))
905910
args= []
906-
kwargs=OrderedDict(sorted(kwargs.items(),key=lambdax:x[0]))
907911
fork,vinkwargs.items():
908912
ifisinstance(v, (list,tuple)):
909913
forvalueinv:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp