1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

Yuya Nishihara  committed 86fcc65

workbench: eliminate signal chain by simply updating basenode on repo changed

  • Participants
  • Parent commits a6434bb
  • Branches default

Comments (0)

Files changed (3)

File tortoisehg/hgqt/reporegistry.py

View file
             it.setShortName(uname)
             self.tview.model().layoutChanged.emit()
 
-    @pyqtSlot(QString, object)
-    def baseNodeChanged(self, uroot, basenode):
+    def setBaseNode(self, uroot, basenode):
         it = self.tview.model().getRepoItem(hglib.fromunicode(uroot))
         if it:
             it.setBaseNode(basenode)

File tortoisehg/hgqt/repowidget.py

View file
     beginSuppressPrompt = pyqtSignal()
     endSuppressPrompt = pyqtSignal()
 
-    # The following signals should be exchanged directly between workbench and
-    # thgrepo. But it isn't possible because workbench cannot filter out known
-    # repo from the result of thgrepo.repository().
-    baseNodeChanged = pyqtSignal(QString, object)
-
     revisionSelected = pyqtSignal(object)
 
     titleChanged = pyqtSignal(unicode)
         self.busyIcons = []
         self.namedTabs = {}
         self.repolen = len(repo)
-        self.basenode = None
         self.destroyed.connect(self.repo.thginvalidate)
 
         # Determine the "initial revision" that must be shown when
         'initial batch of revisions loaded'
         self.repoview.goto(self._reload_rev) # emits revisionSelected
         self.repoview.resizeColumns()
-        if len(self.repo) and self.repo[0].node() != self.basenode:
-            self.basenode = self.repo[0].node()
-            self.baseNodeChanged.emit(hglib.tounicode(self.repo.root),
-                                      self.basenode)
 
     def modelLoaded(self):
         'all revisions loaded (graph generator completed)'

File tortoisehg/hgqt/workbench.py

View file
         self._repomanager = repomanager
         self._repomanager.configChanged.connect(self._setupUrlComboIfCurrent)
         self._repomanager.configChanged.connect(self._updateRepoShortName)
+        self._repomanager.repositoryChanged.connect(self._updateRepoBaseNode)
         self._repomanager.repositoryDestroyed.connect(self.closeRepo)
         self._repomanager.repositoryOpened.connect(self._updateRepoRegItem)
 
     @pyqtSlot(unicode)
     def _updateRepoRegItem(self, root):
         self._updateRepoShortName(root)
+        self._updateRepoBaseNode(root)
 
     @pyqtSlot(unicode)
     def _updateRepoShortName(self, root):
         repo = self._repomanager.repoAgent(root).rawRepo()
         self.reporegistry.setShortName(root, repo.shortname)
 
+    @pyqtSlot(unicode)
+    def _updateRepoBaseNode(self, root):
+        repo = self._repomanager.repoAgent(root).rawRepo()
+        self.reporegistry.setBaseNode(root, repo[0].node())
+
     @pyqtSlot(int)
     def repoTabCloseRequested(self, index):
         tw = self.repoTabsWidget
         rw.repoLinkClicked.connect(self.openLinkedRepo)
         rw.taskTabsWidget.currentChanged.connect(self.updateTaskViewMenu)
         rw.toolbarVisibilityChanged.connect(self.updateToolBarActions)
-        rw.baseNodeChanged.connect(self.reporegistry.baseNodeChanged)
 
         tw = self.repoTabsWidget
         # We can open new tabs next to the current one or next to the last tab