project.py: fix performance issue with --reference when the mirrored repository has many refs

Change-Id: Id0183903597f872eee80ca32a8050125b187a3d4
This commit is contained in:
heping 2017-04-12 19:51:47 +08:00
parent ffb4b89099
commit 3d7bbc9edf

View File

@ -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