Mercurial > public > mercurial-scm > hg-stable
diff hgext/largefiles/lfcommands.py @ 35357:576ba8194fa8
py3: handle keyword arguments correctly in hgext/largefiles/
Keys of keyword arguments must be str(unicode) on Python 3. The transformer
which we use on Python 3, appends b'' in front of each string literal, so this
may lead in KeyError or None return even when the key is present by we are using
bytes value and it's stored in unicodes. This patch and all the similar patches
handle this by either converting the keys of kwargs to bytes using
'pycompat.byteskwargs()' or adding r'' so that the transformer won't append
b''.
This next 23 patches follows the above mentioned way to handle keyword
arguments.
Differential Revision: https://phab.mercurial-scm.org/D1624
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 10 Dec 2017 02:52:48 +0530 |
parents | aef2b98d9352 |
children | 8a0cac20a1ad |
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py Thu Dec 07 00:26:45 2017 +0530 +++ b/hgext/largefiles/lfcommands.py Sun Dec 10 02:52:48 2017 +0530 @@ -24,6 +24,7 @@ lock, match as matchmod, node, + pycompat, registrar, scmutil, util, @@ -74,6 +75,7 @@ Use --to-normal to convert largefiles back to normal files; after this, the DEST repository can be used without largefiles at all.''' + opts = pycompat.byteskwargs(opts) if opts['to_normal']: tolfile = False else: @@ -579,7 +581,7 @@ """ repo.lfpullsource = source - revs = opts.get('rev', []) + revs = opts.get(r'rev', []) if not revs: raise error.Abort(_('no revisions specified')) revs = scmutil.revrange(repo, revs)