Source

thg-qt-mq / wb-tabcurrent.diff

Full commit
# HG changeset patch
# Parent 40c6779a1b656bc4c96a3fe48eef560af753fcaf
workbench: allow addRepoTab() without changing current index

diff --git a/tortoisehg/hgqt/workbench.py b/tortoisehg/hgqt/workbench.py
--- a/tortoisehg/hgqt/workbench.py
+++ b/tortoisehg/hgqt/workbench.py
@@ -770,7 +770,6 @@ class Workbench(QMainWindow):
         else:
             index = self.repoTabsWidget.addTab(rw, rw.title())
         tw.setTabToolTip(index, hglib.tounicode(repo.root))
-        tw.setCurrentIndex(index)
         rw.titleChanged.connect(
             lambda title: tw.setTabText(tw.indexOf(rw), title))
         rw.showIcon.connect(
@@ -887,7 +886,9 @@ class Workbench(QMainWindow):
                     return
             try:
                 repo = thgrepo.repository(path=root)
-                return self.addRepoTab(repo, bundle)
+                rw = self.addRepoTab(repo, bundle)
+                self.repoTabsWidget.setCurrentWidget(rw)
+                return rw
             except RepoError, e:
                 qtlib.WarningMsgBox(_('Failed to open repository'),
                                     hglib.tounicode(str(e)), parent=self)