diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-10-19 19:33:38 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-10-19 19:33:38 +0000 |
commit | 7f3db57c5feb631f6ff45b40ec45f1721e144a1c (patch) | |
tree | ac77541846eae503740e0ce93de5b970563975a9 | |
parent | 9f5d814ee08c29735c6df002d11bc32f2feca53f (diff) | |
download | portage-7f3db57c5feb631f6ff45b40ec45f1721e144a1c.tar.gz portage-7f3db57c5feb631f6ff45b40ec45f1721e144a1c.tar.bz2 portage-7f3db57c5feb631f6ff45b40ec45f1721e144a1c.zip |
Refactor _merge_logentries() to make it a little more efficient.
svn path=/main/trunk/; revision=8184
-rw-r--r-- | pym/portage/elog/__init__.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py index b9cc3f659..e1df6d9bd 100644 --- a/pym/portage/elog/__init__.py +++ b/pym/portage/elog/__init__.py @@ -18,13 +18,12 @@ def _merge_logentries(a, b): phases = set(a) phases.update(b) for p in phases: - rValue[p] = [] - if a.has_key(p): - for x in a[p]: - rValue[p].append(x) - if b.has_key(p): - for x in b[p]: - rValue[p].append(x) + merged_msgs = [] + rValue[p] = merged_msgs + for d in a, b: + msgs = d.get(p) + if msgs: + merged_msgs.extend(msgs) return rValue def _combine_logentries(logentries): |