[PATCH 1 of 4 py3] maplist: replace instances of map() with pycompat.maplist() [1 of 4]

Pulkit Goyal 7895pulkit at gmail.com
Fri Mar 24 15:18:01 UTC 2017


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1490367921 -19800
#      Fri Mar 24 20:35:21 2017 +0530
# Node ID 35e6f3d8dbb1242c6cac1c64fd799db543e30444
# Parent  e8bd005c0af791a87903de339482692db1137ff0
maplist: replace instances of map() with pycompat.maplist() [1 of 4]

This series replaces the instances of the inbuilt map() function with
pycompat.maplist() as map() returns a map object instead of list on Python 3.

diff -r e8bd005c0af7 -r 35e6f3d8dbb1 mercurial/byterange.py
--- a/mercurial/byterange.py	Thu Mar 23 12:03:19 2017 -0700
+++ b/mercurial/byterange.py	Fri Mar 24 20:35:21 2017 +0530
@@ -28,6 +28,7 @@
 import stat
 
 from . import (
+    pycompat,
     util,
 )
 
@@ -278,7 +279,7 @@
             raise urlerr.urlerror(msg)
         path, attrs = splitattr(req.get_selector())
         dirs = path.split('/')
-        dirs = map(unquote, dirs)
+        dirs = pycompat.maplist(unquote, dirs)
         dirs, file = dirs[:-1], dirs[-1]
         if dirs and not dirs[0]:
             dirs = dirs[1:]
diff -r e8bd005c0af7 -r 35e6f3d8dbb1 mercurial/chgserver.py
--- a/mercurial/chgserver.py	Thu Mar 23 12:03:19 2017 -0700
+++ b/mercurial/chgserver.py	Fri Mar 24 20:35:21 2017 +0530
@@ -151,7 +151,7 @@
         except OSError:
             # could be ENOENT, EPERM etc. not fatal in any case
             pass
-    return _hashlist(map(trystat, paths))[:12]
+    return _hashlist(pycompat.maplist(trystat, paths))[:12]
 
 class hashstate(object):
     """a structure storing confighash, mtimehash, paths used for mtimehash"""
diff -r e8bd005c0af7 -r 35e6f3d8dbb1 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Thu Mar 23 12:03:19 2017 -0700
+++ b/mercurial/cmdutil.py	Fri Mar 24 20:35:21 2017 +0530
@@ -1573,12 +1573,13 @@
     fm.write('precnode', '%s ', hex(marker.precnode()))
     succs = marker.succnodes()
     fm.condwrite(succs, 'succnodes', '%s ',
-                 fm.formatlist(map(hex, succs), name='node'))
+                 fm.formatlist(pycompat.maplist(hex, succs), name='node'))
     fm.write('flag', '%X ', marker.flags())
     parents = marker.parentnodes()
     if parents is not None:
         fm.write('parentnodes', '{%s} ',
-                 fm.formatlist(map(hex, parents), name='node', sep=', '))
+                 fm.formatlist(pycompat.maplist(hex, parents),
+                 name='node', sep=', '))
     fm.write('date', '(%s) ', fm.formatdate(marker.date()))
     meta = marker.metadata().copy()
     meta.pop('date', None)
diff -r e8bd005c0af7 -r 35e6f3d8dbb1 mercurial/commands.py
--- a/mercurial/commands.py	Thu Mar 23 12:03:19 2017 -0700
+++ b/mercurial/commands.py	Fri Mar 24 20:35:21 2017 +0530
@@ -1349,7 +1349,7 @@
             raise error.Abort(_("--base is incompatible with specifying "
                                "a destination"))
         common = [repo.lookup(rev) for rev in base]
-        heads = revs and map(repo.lookup, revs) or None
+        heads = revs and pycompat.maplist(repo.lookup, revs) or None
         outgoing = discovery.outgoing(repo, common, heads)
         cg = changegroup.getchangegroup(repo, 'bundle', outgoing,
                                         bundlecaps=bundlecaps,
@@ -1360,7 +1360,7 @@
         dest, branches = hg.parseurl(dest, opts.get('branch'))
         other = hg.peer(repo, opts, dest)
         revs, checkout = hg.addbranchrevs(repo, repo, branches, revs)
-        heads = revs and map(repo.lookup, revs) or revs
+        heads = revs and pycompat.maplist(repo.lookup, revs) or revs
         outgoing = discovery.findcommonoutgoing(repo, other,
                                                 onlyheads=heads,
                                                 force=opts.get('force'),


More information about the Mercurial-devel mailing list