mirror of
https://github.com/Dev-Wiki/git-repo.git
synced 2025-09-26 10:02:46 +08:00
tweak raise/dict syntax for Python 3 compat
Use the `raise` statement directly. Switch to using .items() instead of .iteritems(). Python 3 doesn't have .iteritems() as .items() is a generator, and these are small enough that the Python 2 overhead should be negligible. We have to run .keys() through list() in a few places as Python 3 uses a generator and we sometimes want to iterate more than once. That's why we don't change all .keys() or .items() calls -- most are in places where generators are fine. Bug: https://crbug.com/gerrit/10418 Change-Id: I469899d9b77ffd77ccabb831bc4b217407fefe6f
This commit is contained in:
@@ -58,7 +58,7 @@ It is equivalent to "git branch -D <branchname>".
|
||||
pm.update()
|
||||
|
||||
if opt.all:
|
||||
branches = project.GetBranches().keys()
|
||||
branches = list(project.GetBranches().keys())
|
||||
else:
|
||||
branches = [nb]
|
||||
|
||||
|
@@ -99,7 +99,7 @@ class Info(PagedCommand):
|
||||
self.headtext(p.revisionExpr)
|
||||
self.out.nl()
|
||||
|
||||
localBranches = p.GetBranches().keys()
|
||||
localBranches = list(p.GetBranches().keys())
|
||||
self.heading("Local Branches: ")
|
||||
self.redtext(str(len(localBranches)))
|
||||
if len(localBranches) > 0:
|
||||
|
Reference in New Issue
Block a user