Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

status: add a mechanism for toggling file status types

Could perhaps be done better. This was the least intrusive way I could
think of adding it. Toggling on 'C' is really slow. Need to understand
why.

Changeset 95c96ea9f71b

Parent ac922ec71fe2

by Steve Borho

Changes to one file · Browse files at 95c96ea9f71b Showing diff from parent ac922ec71fe2 Diff from another changeset...

 
16
17
18
19
 
20
21
22
 
26
27
28
29
 
30
31
32
 
47
48
49
50
 
 
51
52
53
 
76
77
78
 
79
80
 
81
82
83
 
89
90
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
93
94
 
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
324
325
 
16
17
18
 
19
20
21
22
 
26
27
28
 
29
30
31
32
 
47
48
49
 
50
51
52
53
54
 
77
78
79
80
81
82
83
84
85
86
 
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
 
325
326
327
 
 
 
 
 
 
 
 
 
 
 
 
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
@@ -16,7 +16,7 @@
 from PyQt4.QtCore import QObject, QEvent, QMimeData, QUrl, QString  from PyQt4.QtGui import QWidget, QVBoxLayout, QSplitter, QTreeView, QLineEdit  from PyQt4.QtGui import QTextEdit, QFont, QColor, QDrag, QSortFilterProxyModel -from PyQt4.QtGui import QFrame, QHBoxLayout, QLabel +from PyQt4.QtGui import QFrame, QHBoxLayout, QLabel, QPushButton, QMenu    # This widget can be used as the basis of the commit tool or any other  # working copy browser. @@ -26,7 +26,7 @@
 # (it interferes with selection the way it is now)  # Thread refreshWctx, connect to an external progress bar  # Thread rowSelected, connect to an external progress bar -# Need mechanisms to clear pats and toggle visibility options +# Need mechanism to clear pats  # Need mechanism to override file size/binary check  # Improve behavior of !?IC files in diff pane  # Show subrepos better @@ -47,7 +47,8 @@
  assert(root)   self.repo = hg.repository(ui.ui(), path=root)   self.wctx = self.repo[None] - self.opts = dict(unknown=True, clean=False, ignored=False) + self.opts = dict(modified=True, added=True, removed=True, deleted=True, + unknown=True, clean=False, ignored=False)   self.opts.update(opts)   self.pats = pats   self.ms = {} @@ -76,8 +77,10 @@
  hbox.setContentsMargins (5, 7, 0, 0)   lbl = QLabel(_('Filter:'))   le = QLineEdit() + pb = QPushButton(_('MAR!?IC')) # needs a better label   hbox.addWidget(lbl)   hbox.addWidget(le) + hbox.addWidget(pb)   tv = WctxFileTree(self.repo)   vbox.addLayout(hbox)   vbox.addWidget(tv) @@ -89,6 +92,20 @@
  tv.setRootIsDecorated(False)   tv.setSortingEnabled(True)   + def statusTypeTrigger(isChecked): + txt = hglib.fromunicode(self.sender().text()) + self.opts[txt[2:]] = isChecked + self.refreshWctx() + menu = QMenu() + for stat in ('M modified', 'A added', 'R removed', '! deleted', + '? unknown', 'I ignored', 'C clean'): + a = menu.addAction(stat) + a.setCheckable(True) + a.setChecked(self.opts[stat[2:]]) + a.triggered.connect(statusTypeTrigger) + pb.setMenu(menu) + pb.storeref = menu +   self.proxy = WctxProxyModel()   self.proxy.setFilterKeyColumn(COL_PATH_DISPLAY)   self.connect(le, SIGNAL('textEdited(QString)'), self.proxy, @@ -308,18 +325,22 @@
  def __init__(self, wctx, ms, opts, parent=None):   QAbstractTableModel.__init__(self, parent)   rows = [] - for m in wctx.modified(): - mst = m in ms and ms[m].upper() or "" - rows.append([True, 'M', mst, hglib.tounicode(m), m]) - for a in wctx.added(): - mst = a in ms and ms[a].upper() or "" - rows.append([True, 'A', mst, hglib.tounicode(a), a]) - for r in wctx.removed(): - mst = r in ms and ms[r].upper() or "" - rows.append([True, 'R', mst, hglib.tounicode(r), r]) - for d in wctx.deleted(): - mst = d in ms and ms[d].upper() or "" - rows.append([False, '!', mst, hglib.tounicode(d), d]) + if opts['modified']: + for m in wctx.modified(): + mst = m in ms and ms[m].upper() or "" + rows.append([True, 'M', mst, hglib.tounicode(m), m]) + if opts['added']: + for a in wctx.added(): + mst = a in ms and ms[a].upper() or "" + rows.append([True, 'A', mst, hglib.tounicode(a), a]) + if opts['removed']: + for r in wctx.removed(): + mst = r in ms and ms[r].upper() or "" + rows.append([True, 'R', mst, hglib.tounicode(r), r]) + if opts['deleted']: + for d in wctx.deleted(): + mst = d in ms and ms[d].upper() or "" + rows.append([False, '!', mst, hglib.tounicode(d), d])   if opts['unknown']:   for u in wctx.unknown():   rows.append([False, '?', '', hglib.tounicode(u), u])