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

status: Enumerate diff model rows

Changeset f0338eba5158

Parent c102ef37af06

by Steve Borho

Changes to 2 files · Browse files at f0338eba5158 Showing diff from parent c102ef37af06 Diff from another changeset...

Change 1 of 2 Show Entire File hggtk/​commit.py Stacked
 
18
19
20
21
 
22
23
24
 
250
251
252
253
 
254
255
 
256
257
258
 
18
19
20
 
21
22
23
24
 
250
251
252
 
253
254
 
255
256
257
258
@@ -18,7 +18,7 @@
 from mercurial import ui, hg  from shlib import shell_notify  from gdialog import * -from status import GStatus +from status import GStatus, DM_REJECTED, DM_HEADER_CHUNK, DM_CHUNK_ID  from hgcmd import CmdDialog  from hglib import fromutf   @@ -250,9 +250,9 @@
  def _commit_selected(self, files):   import hgshelve   # 1a. get list of chunks not rejected - hlist = [x[4] for x in self.diff_model if not x[0]] + hlist = [x[DM_CHUNK_ID] for x in self.diff_model if not x[DM_REJECTED]]   # 1b. ignore header chunks - nlist = [n for n in hlist if not self.diff_model[n][3]] + nlist = [n for n in hlist if not self.diff_model[n][DM_HEADER_CHUNK]]   if not nlist:   Prompt('Commit', 'Please select diff chunks to commit',   self).run()
Change 1 of 5 Show Entire File hggtk/​status.py Stacked
 
24
25
26
 
 
 
 
 
 
 
27
28
29
 
299
300
301
302
303
304
305
 
313
314
315
316
317
 
 
 
 
 
318
319
320
 
652
653
654
655
656
 
 
657
658
659
 
869
870
871
872
 
873
874
875
 
24
25
26
27
28
29
30
31
32
33
34
35
36
 
306
307
308
 
309
310
311
 
319
320
321
 
 
322
323
324
325
326
327
328
329
 
661
662
663
 
 
664
665
666
667
668
 
878
879
880
 
881
882
883
884
@@ -24,6 +24,13 @@
 from dialog import entry_dialog  import hgshelve   +# diff_model row enumerations +DM_REJECTED = 0 +DM_CHUNK_TEXT = 1 +DM_NOT_HEADER_CHUNK = 2 +DM_HEADER_CHUNK = 3 +DM_CHUNK_ID = 4 +  class GStatus(GDialog):   """GTK+ based dialog for displaying repository status   @@ -299,7 +306,6 @@
  diff_frame.add(scroller)     # use treeview to diff hunks - # rejected, difftext, !isheader, isheader, chunkid   self.diff_model = gtk.ListStore(bool, str, bool, bool, int)   self.diff_tree = gtk.TreeView(self.diff_model)   self.diff_tree.get_selection().set_mode(gtk.SELECTION_MULTIPLE) @@ -313,8 +319,11 @@
    diff_hunk_cell = gtk.CellRendererText()   diff_hunk_cell.set_property('cell-background', '#EEEEEE') - diffcol = gtk.TreeViewColumn('diff', diff_hunk_cell, strikethrough=0, - markup=1, strikethrough_set=2, cell_background_set=3) + diffcol = gtk.TreeViewColumn('diff', diff_hunk_cell, + strikethrough=DM_REJECTED, + markup=DM_CHUNK_TEXT, + strikethrough_set=DM_NOT_HEADER_CHUNK, + cell_background_set=DM_HEADER_CHUNK)   diffcol.set_resizable(True)   self.diff_tree.append_column(diffcol)   @@ -652,8 +661,8 @@
  def _diff_tree_row_act(self, tree, path, column):   # strikethrough-set property seems to be broken, so manually   # filter header chunks here using !isheader property of diffmodel. - if self.diff_model[path][2]: - self.diff_model[path][0] = not self.diff_model[path][0] + if self.diff_model[path][DM_NOT_HEADER_CHUNK]: + self.diff_model[path][DM_REJECTED] = not self.diff_model[path][DM_REJECTED]     def _diff_tree_button_press(self, widget, event):   # Used to select all of file patch, will be no longer necessary @@ -869,7 +878,7 @@
    def _shelve_selected(self):   # get list of hunks that have not been rejected - hlist = [x[4] for x in self.diff_model if not x[0]] + hlist = [x[DM_CHUNK_ID] for x in self.diff_model if not x[DM_REJECTED]]   if not hlist:   Prompt('Shelve', 'Please select diff chunks to shelve',   self).run()