[qt4] do **not** display closed branches if not asked for

authorDavid Douard <david.douard@logilab.fr>
changeset2d2912f9a121
branchdefault
phasepublic
hiddenno
parent revision#6d2c6c8de454 [graph] add support for hiding closed branches in ``revision_grapher``
child revision#fb5ee4cf21dd [qt] always select the working directory at startup (closes #82231)
files modified by this revision
hgviewlib/qt4/hgrepomodel.py
hgviewlib/qt4/hgrepoviewer.py
# HG changeset patch
# User David Douard <david.douard@logilab.fr>
# Date 1338380045 -7200
# Wed May 30 14:14:05 2012 +0200
# Node ID 2d2912f9a1215c4652f6c157230e1c710e9d4044
# Parent 6d2c6c8de454be38224496f4631bd3dd4f6d44dc
[qt4] do **not** display closed branches if not asked for

diff --git a/hgviewlib/qt4/hgrepomodel.py b/hgviewlib/qt4/hgrepomodel.py
@@ -115,20 +115,20 @@
1      _allcolumns = ('ID', 'Branch', 'Log', 'Author', 'Date', 'Tags',)
2      _columns = ('ID', 'Branch', 'Log', 'Author', 'Date', 'Tags',)
3      _stretchs = {'Log': 1, }
4      _getcolumns = "getChangelogColumns"
5 
6 -    def __init__(self, repo, branch='', fromhead=None, follow=False, parent=None, show_hidden=False):
7 +    def __init__(self, repo, branch='', fromhead=None, follow=False, parent=None, show_hidden=False, closed=False):
8          """
9          repo is a hg repo instance
10          """
11          self._fill_timer = None
12          QtCore.QAbstractTableModel.__init__(self, parent)
13 -        HgRepoListWalker.__init__(self, repo, branch, fromhead, follow)
14 +        HgRepoListWalker.__init__(self, repo, branch, fromhead, follow, closed=closed)
15 
16 -    def setRepo(self, repo, branch='', fromhead=None, follow=False):
17 -        HgRepoListWalker.setRepo(self, repo, branch, fromhead, follow)
18 +    def setRepo(self, repo, branch='', fromhead=None, follow=False, closed=False):
19 +        HgRepoListWalker.setRepo(self, repo, branch, fromhead, follow, closed=closed)
20          self.emit(SIGNAL('layoutChanged()'))
21          QtCore.QTimer.singleShot(0, Curry(self.emit, SIGNAL('filled')))
22          self._fill_timer = self.startTimer(50)
23 
24      def timerEvent(self, event):
@@ -353,11 +353,11 @@
25          data is a HgHLRepo instance
26          """
27          HgRepoListModel.__init__(self, repo, parent=parent)
28          self.setFilename(filename)
29 
30 -    def setRepo(self, repo, branch='', fromhead=None, follow=False):
31 +    def setRepo(self, repo, branch='', fromhead=None, follow=False, closed=False):
32          self.repo = repo
33          self._datacache = {}
34          self.load_config()
35 
36      def setFilename(self, filename):
diff --git a/hgviewlib/qt4/hgrepoviewer.py b/hgviewlib/qt4/hgrepoviewer.py
@@ -92,10 +92,14 @@
37                  self.statusBar().showMessage("Repository has been modified, "
38                                               "reloading...", 2000)
39 
40                  self.reload()
41 
42 +    def setupBranchComboAndReload(self, *args):
43 +        self.setupBranchCombo()
44 +        self.reload()
45 +
46      def setupBranchCombo(self, *args):
47          allbranches = sorted(self.repo.branchtags().items())
48 
49          openbr = []
50          for branch, brnode in allbranches:
@@ -154,11 +158,11 @@
51          self.branch_label.setMenu(self.branch_menu)
52          self.branch_comboBox = QtGui.QComboBox()
53          connect(self.branch_comboBox, SIGNAL('activated(const QString &)'),
54                  self.refreshRevisionTable)
55          connect(cbranch_action, SIGNAL('toggled(bool)'),
56 -                self.setupBranchCombo)
57 +                self.setupBranchComboAndReload)
58 
59          self.toolBar_treefilters.layout().setSpacing(3)
60 
61          self.branch_label_action = self.toolBar_treefilters.addWidget(self.branch_label)
62          self.branch_comboBox_action = self.toolBar_treefilters.addWidget(self.branch_comboBox)
@@ -499,14 +503,15 @@
63          # this method is called directly (not via a connected signal);
64          # the 'sender' keyword is a way to discrimimne that the method
65          # has been called directly (thus caller MUST set this kw arg)
66          sender = kw.get('sender') or self.sender()
67          follow = kw.get('follow', False)
68 +        closed = self.branch_checkBox_action.isChecked()
69          startrev = self.repo.changectx(startrev).rev()
70          self.repomodel.show_hidden = self.actionShowHidden.isChecked()
71          self.repomodel.setRepo(self.repo, branch=branch, fromhead=startrev,
72 -                               follow=follow)
73 +                               follow=follow, closed=closed)
74 
75      def on_about(self, *args):
76          """ Display about dialog """
77          from hgviewlib.__pkginfo__ import modname, version, short_desc, long_desc
78          try: