From d03b6065c911e17e70abf916ca975f5548dedcc6 Mon Sep 17 00:00:00 2001 From: David Rafferty <drafferty@hs.uni-hamburg.de> Date: Thu, 16 Apr 2020 16:01:41 +0200 Subject: [PATCH] Remove uneeded copy --- lsmtool/operations/merge.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lsmtool/operations/merge.py b/lsmtool/operations/merge.py index ab33ee0..923085b 100644 --- a/lsmtool/operations/merge.py +++ b/lsmtool/operations/merge.py @@ -74,15 +74,14 @@ def merge(LSM, patches, name=None): if name is None: name = patches[0] - table = LSM.table.copy() + indices = [] for patchName in patches: - indices = LSM.getRowIndex(patchName) - if indices is None: + indices.append(LSM.getRowIndex(patchName)) + for patchName, ind in zip(patches, indices): + if ind is None: raise ValueError("Could not find patch '{0}'.".format(patchName)) else: - table['Patch'][indices] = name - - LSM.table = table + LSM.table['Patch'][ind] = name LSM._updateGroups() LSM._addHistory("MERGE ('{0}' into '{1}')".format(patches, name)) LSM._info() -- GitLab