Mercurial > hg
comparison mercurial/exchange.py @ 43106:d783f945a701
py3: finish porting iteritems() to pycompat and remove source transformer
This commit finishes porting .iteritems() to pycompat.iteritems()
for the mercurial package.
The translation of .iteritems() to .items() was the last conversion
performed by the source transformer. With the porting to pycompat
complete, we no longer have a need for the source transformer. So
the source transformer has been removed. Good riddance! The code
base is now compatible with Python 2 and Python 3.
For the record, as the person who introduced the source transformer,
it brings me joy to delete it. It accomplished its goal to facilitate
a port to Python 3 without overly burdening people on some painful
low-level differences between Python 2 and 3. It is unfortunate we
still have to wallpaper over many differences with the pycompat
shim. But it is what it is.
Differential Revision: https://phab.mercurial-scm.org/D7015
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 07 Oct 2019 00:04:04 -0400 |
parents | 687b865b95ad |
children | 8ff1ecfadcd1 |
comparison
equal
deleted
inserted
replaced
43105:649d3ac37a12 | 43106:d783f945a701 |
---|---|
955 emptyremote = pushop.pushbranchmap is None | 955 emptyremote = pushop.pushbranchmap is None |
956 if not allowunrelated or emptyremote: | 956 if not allowunrelated or emptyremote: |
957 bundler.newpart(b'check:heads', data=iter(pushop.remoteheads)) | 957 bundler.newpart(b'check:heads', data=iter(pushop.remoteheads)) |
958 else: | 958 else: |
959 affected = set() | 959 affected = set() |
960 for branch, heads in pushop.pushbranchmap.iteritems(): | 960 for branch, heads in pycompat.iteritems(pushop.pushbranchmap): |
961 remoteheads, newheads, unsyncedheads, discardedheads = heads | 961 remoteheads, newheads, unsyncedheads, discardedheads = heads |
962 if remoteheads is not None: | 962 if remoteheads is not None: |
963 remote = set(remoteheads) | 963 remote = set(remoteheads) |
964 affected |= set(discardedheads) & remote | 964 affected |= set(discardedheads) & remote |
965 affected |= remote - set(newheads) | 965 affected |= remote - set(newheads) |
1258 k, v = raw.split(b'=', 1) | 1258 k, v = raw.split(b'=', 1) |
1259 shellvars[k] = v | 1259 shellvars[k] = v |
1260 | 1260 |
1261 part = bundler.newpart(b'pushvars') | 1261 part = bundler.newpart(b'pushvars') |
1262 | 1262 |
1263 for key, value in shellvars.iteritems(): | 1263 for key, value in pycompat.iteritems(shellvars): |
1264 part.addparam(key, value, mandatory=False) | 1264 part.addparam(key, value, mandatory=False) |
1265 | 1265 |
1266 | 1266 |
1267 def _pushbundle2(pushop): | 1267 def _pushbundle2(pushop): |
1268 """push data to the remote using bundle2 | 1268 """push data to the remote using bundle2 |