Mercurial > hg
comparison hgext/rebase.py @ 43104:74802979dd9d
py3: define and use pycompat.itervalues()
.itervalues() only exists on Python 2. Python 3's equivalent is
.values(). But we don't want to blindly use .values() everywhere
because on Python 2, it will create a list, which will have performance
implications.
This commit introduces pycompat.itervalues() which will call the appropriate
method on the passed object. We update all callers of obj.itervalues()
to pycompat.itervalues(obj) instead.
With this commit, the only source tranforming remaining is for
iteritems(). Victory is near...
Differential Revision: https://phab.mercurial-scm.org/D7013
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 06 Oct 2019 17:59:15 -0400 |
parents | eef9a2d67051 |
children | 649d3ac37a12 |
comparison
equal
deleted
inserted
replaced
43103:c95b2f40db7c | 43104:74802979dd9d |
---|---|
2286 except error.RepoLookupError: | 2286 except error.RepoLookupError: |
2287 # i18n: column positioning for "hg summary" | 2287 # i18n: column positioning for "hg summary" |
2288 msg = _(b'rebase: (use "hg rebase --abort" to clear broken state)\n') | 2288 msg = _(b'rebase: (use "hg rebase --abort" to clear broken state)\n') |
2289 ui.write(msg) | 2289 ui.write(msg) |
2290 return | 2290 return |
2291 numrebased = len([i for i in state.itervalues() if i >= 0]) | 2291 numrebased = len([i for i in pycompat.itervalues(state) if i >= 0]) |
2292 # i18n: column positioning for "hg summary" | 2292 # i18n: column positioning for "hg summary" |
2293 ui.write( | 2293 ui.write( |
2294 _(b'rebase: %s, %s (rebase --continue)\n') | 2294 _(b'rebase: %s, %s (rebase --continue)\n') |
2295 % ( | 2295 % ( |
2296 ui.label(_(b'%d rebased'), b'rebase.rebased') % numrebased, | 2296 ui.label(_(b'%d rebased'), b'rebase.rebased') % numrebased, |