Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

thgmq: reduce get_pos_by_patchname() calling as far as possible

get_pos_by_patchname() function is slightly high cost.

Changeset ace9332015e4

Parent 2a862ea40066

by Yuki KODAMA

Changes to one file · Browse files at ace9332015e4 Showing diff from parent 2a862ea40066 Diff from another changeset...

 
469
470
471
472
473
474
475
476
477
 
 
 
 
 
 
478
479
480
 
469
470
471
 
 
 
 
 
 
472
473
474
475
476
477
478
479
480
@@ -469,12 +469,12 @@
  model = self.model   lastidx = len(model) - 1   minidx, maxidx = lastidx, 0 - for name in patch: - pos = self.get_pos_by_patchname(name) - if pos < minidx: - minidx = pos - if maxidx < pos: - maxidx = pos + for idx, row in enumerate(model): + if row[MQ_NAME] in patch: + if idx < minidx: + minidx = idx + if maxidx < idx: + maxidx = idx     # find index of first unapplied patch in TreeView   for i, row in enumerate(model):