Angel Ezquerra  committed 233ccda

qtlib: HgRepoView.forward() must forward keyword parameters

The main side effect of this bug was that "push to revision" and
"push selected branch" where not working.

With the original version of the forward() method it was not really possible to
pass keyword parameters to the forwarded method because the forward() method
itself could receive a keyword parameter named "default". This was used in
several forward calls to "canExit" with "default=True".

The solution has been to add a default canExit() method to the TaskWidget and
DemandWidget classes, and directly call canExit where necessary.

Meanwhile the original forward() method has been modified to no longer accept a
"default" keyword argument, while passing any keyword arguments to the forwarded

  • Participants
  • Parent commits 52eb1f2
  • Branches stable

Comments (0)

Files changed (2)

File tortoisehg/hgqt/

         """Return True if the widget allows to switch away from it"""
         return True
+    def canExit(self):
+        return True
 class DemandWidget(QWidget):
     'Create a widget the first time it is shown'
     def forward(self, funcname, *args, **opts):
         if self._widget:
-            return getattr(self._widget, funcname)(*args)
-        return opts.get('default')
+            return getattr(self._widget, funcname)(*args, **opts)
+        return None
     def get(self):
         """Returns the stored widget"""
             return True
         return self._widget.canswitch()
+    def canExit(self):
+        if self._widget is None:
+            return True
+        return self._widget.canExit()
     def __getattr__(self, name):
         return getattr(self._widget, name)
 class Spacer(QWidget):
     """Spacer to separate controls in a toolbar"""
     def __init__(self, width, height, parent=None):
         QWidget.__init__(self, parent)
         self.width = width
         self.height = height
     def sizeHint(self):
         return QSize(self.width, self.height)

File tortoisehg/hgqt/

         QTimer.singleShot(0, lambda: self.toolbarVisibilityChanged.emit())
     def okToContinue(self):
-        if not self.commitDemand.forward('canExit', default=True):
+        if not self.commitDemand.canExit():
             self.showMessage(_('Commit tab cannot exit'))
             return False
-        if not self.syncDemand.forward('canExit', default=True):
+        if not self.syncDemand.canExit():
             self.showMessage(_('Sync tab cannot exit'))
             return False
         if 'mq' in self.repo.extensions():
-            if not self.mqDemand.forward('canExit', default=True):
+            if not self.mqDemand.canExit():
                 self.showMessage(_('MQ tab cannot exit'))
                 return False
-        if not self.grepDemand.forward('canExit', default=True):
+        if not self.grepDemand.canExit():
             self.showMessage(_('Search tab cannot exit'))
             return False