Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

status: simplify file model rebuild

Changeset e4f175bc8bf0

Parent a86ac401a2b0

by Steve Borho

Changes to one file · Browse files at e4f175bc8bf0 Showing diff from parent a86ac401a2b0 Diff from another changeset...

Change 1 of 2 Show Entire File hggtk/​status.py Stacked
 
576
577
578
579
580
581
582
583
584
585
586
 
 
 
 
 
 
 
587
588
589
590
591
592
593
 
 
 
594
595
596
 
600
601
602
603
604
605
 
 
 
606
607
608
609
 
 
610
611
612
 
576
577
578
 
 
 
 
 
 
 
 
579
580
581
582
583
584
585
586
587
588
589
590
 
 
591
592
593
594
595
596
 
600
601
602
 
 
 
603
604
605
606
607
 
 
608
609
610
611
612
@@ -576,21 +576,21 @@
  (modified, added, removed, deleted, unknown, ignored, clean) = status   self._node1, self._node2, self.modified = n1, n2, modified   - changetypes = (('modified', 'M', modified), - ('added', 'A', added), - ('removed', 'R', removed), - ('deleted', '!', deleted), - ('unknown', '?', unknown), - ('ignored', 'I', ignored)) - - explicit_changetypes = changetypes + (('clean', 'C', clean),) + changetypes = (('M', 'modified', modified), + ('A', 'added', added), + ('R', 'removed', removed), + ('!', 'deleted', deleted), + ('?', 'unknown', unknown), + ('I', 'ignored', ignored), + ('C', 'clean', clean))     # List of the currently checked and selected files to pass on to   # the new data   model, tpaths = selection.get_selected_rows()   reselect = [model[path][FM_PATH] for path in tpaths] - recheck = [entry[FM_PATH] for entry in model if entry[FM_CHECKED]] - old = [entry[FM_PATH] for entry in model] + waschecked = {} + for entry in model: + waschecked[entry[FM_PATH]] = entry[FM_CHECKED]     # merge-state of files   ms = merge_.mergestate(repo) @@ -600,13 +600,13 @@
  selection.handler_block(self.treeselid)   self.filemodel.clear()   - for opt, char, changes in ([ct for ct in explicit_changetypes - if self.test_opt(ct[0])] or changetypes): - for wfile in changes: + types = [ct for ct in changetypes if self.opts.get(ct[1])] + for stat, _, wfiles in types: + for wfile in wfiles:   mst = wfile in ms and ms[wfile].upper() or ""   wfile = util.localpath(wfile) - ck = wfile in recheck or (wfile not in old and char in 'MAR') - model.append([ck, char, hglib.toutf(wfile), wfile, mst, False]) + ck = waschecked.get(wfile, stat in 'MAR') + model.append([ck, stat, hglib.toutf(wfile), wfile, mst, False])     self.auto_check() # may check more files