Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.7, 0.7.1, and 0.7.2

status: remove DM_NOT_REJECTED diff model value

Changeset 3dcd0d1e9500

Parent a4fee40664a8

by Steve Borho

Changes to one file · Browse files at 3dcd0d1e9500 Showing diff from parent a4fee40664a8 Diff from another changeset...

Change 1 of 7 Show Entire File hggtk/​status.py Stacked
 
33
34
35
36
37
38
39
 
 
 
40
41
42
 
328
329
330
331
 
332
333
334
 
352
353
354
355
356
357
358
359
360
 
361
362
363
 
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
 
623
624
625
626
627
628
629
 
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
847
848
849
850
851
852
853
854
855
856
857
 
 
 
 
 
 
 
858
859
860
 
913
914
915
916
 
917
918
919
920
 
 
 
921
922
923
 
33
34
35
 
 
 
 
36
37
38
39
40
41
 
327
328
329
 
330
331
332
333
 
351
352
353
 
 
 
 
354
 
355
356
357
358
 
414
415
416
 
 
 
 
 
 
 
 
 
417
418
419
 
609
610
611
 
612
613
614
 
808
809
810
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
 
 
 
 
 
 
 
 
 
 
832
833
834
835
836
837
838
839
840
841
 
894
895
896
 
897
898
899
 
 
900
901
902
903
904
905
@@ -33,10 +33,9 @@
   # diff_model row enumerations  DM_REJECTED = 0 -DM_NOT_REJECTED = 1 -DM_CHUNK_TEXT = 2 -DM_HEADER_CHUNK = 3 -DM_CHUNK_ID = 4 +DM_CHUNK_TEXT = 1 +DM_HEADER_CHUNK = 2 +DM_CHUNK_ID = 3    class GStatus(GDialog):   """GTK+ based dialog for displaying repository status @@ -328,7 +327,7 @@
  sel = (os.name == 'nt') and 'CLIPBOARD' or 'PRIMARY'   self.clipboard = gtk.Clipboard(selection=sel)   - self.diff_model = gtk.ListStore(bool, bool, str, bool, int) + self.diff_model = gtk.ListStore(bool, str, bool, int)   self.diff_tree = gtk.TreeView(self.diff_model)   self.diff_tree.get_selection().set_mode(gtk.SELECTION_MULTIPLE)   self.diff_tree.modify_font(pango.FontDescription(self.fontlist)) @@ -352,12 +351,8 @@
  scroller.add(self.diff_tree)     vbox = gtk.VBox() - visiblerejects = gtk.CheckButton("Hide Rejected Chunks") - #visiblerejects.connect('toggled', self._toggle_rejects, diffcol, - # diff_hunk_cell) - #vbox.pack_start(visiblerejects, False, False, 2)   vbox.pack_start(scroller, True, True, 2) - self._toggle_rejects(visiblerejects, diffcol, diff_hunk_cell) +   diff_frame.add(vbox)   else:   # display merge diffs in simple text view @@ -419,15 +414,6 @@
  fp.seek(0)   self.clipboard.set_text(fp.read())   - def _toggle_rejects(self, widget, diffcol, cell): - diffcol.clear_attributes(cell) - diffcol.add_attribute(cell, 'markup', DM_CHUNK_TEXT) - diffcol.add_attribute(cell, 'cell_background_set', DM_HEADER_CHUNK) - if widget.get_active(): - diffcol.add_attribute(cell, 'visible', DM_NOT_REJECTED) - else: - diffcol.add_attribute(cell, 'strikethrough', DM_REJECTED) -   def get_extras(self):   table = gtk.Table(rows=2, columns=3)   table.set_col_spacings(8) @@ -623,7 +609,6 @@
  entry[FM_PARTIAL_SELECTED] = False   self._update_partial(self.diff_model, file, False)   for n in self._filechunks[file][1:]: - self.diff_model[n][DM_NOT_REJECTED] = entry[FM_CHECKED]   self.diff_model[n][DM_REJECTED] = not entry[FM_CHECKED]     def _show_toggle(self, check, type): @@ -823,38 +808,34 @@
    def _diff_tree_row_act(self, dtree, path, column):   dmodel = dtree.get_model() - try: - row = dmodel[path] - chunk = self._shelve_chunks[row[DM_CHUNK_ID]] - file = chunk.filename() - if file not in self._filechunks: - return - for fr in self.filemodel: - if fr[FM_PATH] == file: - break - fchunks = self._filechunks[file][1:] - if row[DM_HEADER_CHUNK]: - for n in fchunks: - dmodel[n][DM_REJECTED] = fr[FM_CHECKED] - newvalue = not fr[FM_CHECKED] - partial = False - else: - row[DM_REJECTED] = not row[DM_REJECTED] - rej = [ n for n in fchunks if dmodel[n][DM_REJECTED] ] - nonrej = [ n for n in fchunks if not dmodel[n][DM_REJECTED] ] - newvalue = nonrej and True or False - partial = rej and nonrej and True or False + row = dmodel[path] + chunk = self._shelve_chunks[row[DM_CHUNK_ID]] + file = chunk.filename() + if file not in self._filechunks: + return + for fr in self.filemodel: + if fr[FM_PATH] == file: + break + fchunks = self._filechunks[file][1:] + if row[DM_HEADER_CHUNK]: + for n in fchunks: + dmodel[n][DM_REJECTED] = fr[FM_CHECKED] + newvalue = not fr[FM_CHECKED] + partial = False + else: + row[DM_REJECTED] = not row[DM_REJECTED] + rej = [ n for n in fchunks if dmodel[n][DM_REJECTED] ] + nonrej = [ n for n in fchunks if not dmodel[n][DM_REJECTED] ] + newvalue = nonrej and True or False + partial = rej and nonrej and True or False   - # Update file's check status - if fr[FM_PARTIAL_SELECTED] != partial: - fr[FM_PARTIAL_SELECTED] = partial - self._update_partial(dmodel, file, partial) - if fr[FM_CHECKED] != newvalue: - fr[FM_CHECKED] = newvalue - self._update_check_count() - finally: - for row in dmodel: - row[DM_NOT_REJECTED] = not row[DM_REJECTED] + # Update file's check status + if fr[FM_PARTIAL_SELECTED] != partial: + fr[FM_PARTIAL_SELECTED] = partial + self._update_partial(dmodel, file, partial) + if fr[FM_CHECKED] != newvalue: + fr[FM_CHECKED] = newvalue + self._update_check_count()     def _update_partial(self, dmodel, file, partial):   hc = self._filechunks[file][0] @@ -913,11 +894,12 @@
  if isheader:   for f in chunk.files():   self._filechunks[f] = [len(self.diff_model)] - self.diff_model.append([False, True, markedup, True, n]) + self.diff_model.append([False, markedup, True, n])   skip = chunk.special()   elif skip != True: - self._filechunks[chunk.filename()].append(len(self.diff_model)) - self.diff_model.append([False, True, markedup, False, n]) + f = chunk.filename() + self._filechunks[f].append(len(self.diff_model)) + self.diff_model.append([False, markedup, False, n])   finally:   difftext.close()