From 3d7bbc9edf2e6714c58f72a053b182d3c7a160bf Mon Sep 17 00:00:00 2001 From: heping Date: Wed, 12 Apr 2017 19:51:47 +0800 Subject: [PATCH] project.py: fix performance issue with --reference when the mirrored repository has many refs Change-Id: Id0183903597f872eee80ca32a8050125b187a3d4 --- project.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/project.py b/project.py index 0d60fc6e..ae771c42 100644 --- a/project.py +++ b/project.py @@ -1963,15 +1963,17 @@ class Project(object): ids.add(ref_id) tmp.add(r) - tmp_packed = '' - old_packed = '' + tmp_packed_lines = [] + old_packed_lines = [] for r in sorted(all_refs): line = '%s %s\n' % (all_refs[r], r) - tmp_packed += line + tmp_packed_lines.append(line) if r not in tmp: - old_packed += line + old_packed_lines.append(line) + tmp_packed = ''.join(tmp_packed_lines) + old_packed = ''.join(old_packed_lines) _lwrite(packed_refs, tmp_packed) else: alt_dir = None