D3123: py3: use list comprehension instead of map()
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Thu Apr 5 12:30:49 UTC 2018
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
map() on Python 3 returns a map object not a list, so let's use list
comprehension where we require list.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3123
AFFECTED FILES
hgext/journal.py
CHANGE DETAILS
diff --git a/hgext/journal.py b/hgext/journal.py
--- a/hgext/journal.py
+++ b/hgext/journal.py
@@ -226,7 +226,7 @@
def __bytes__(self):
"""bytes representation for storage"""
- time = ' '.join(map(pycompat.bytestr, self.timestamp))
+ time = ' '.join([pycompat.bytestr(a) for a in self.timestamp])
oldhashes = ','.join([node.hex(hash) for hash in self.oldhashes])
newhashes = ','.join([node.hex(hash) for hash in self.newhashes])
return '\n'.join((
@@ -273,7 +273,7 @@
@property
def command(self):
commandstr = ' '.join(
- map(procutil.shellquote, journalstorage._currentcommand))
+ [procutil.shellquote(a) for a in journalstorage._currentcommand])
if '\n' in commandstr:
# truncate multi-line commands
commandstr = commandstr.partition('\n')[0] + ' ...'
To: pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list