1. Yuya Nishihara
  2. thg-qt-mq

Commits

Yuya Nishihara  committed b6d94f8

confirm push patches

  • Participants
  • Parent commits 4be4850
  • Branches default

Comments (0)

Files changed (4)

File repow-pushkwargs.diff

View file
+# HG changeset patch
+# Date 1366645204 -32400
+# Parent 042539f3ded0717fcb3e24595be96151bf65ac5a
+sync: pack confirm parameter in kwargs to let default configurable
+
+diff --git a/tortoisehg/hgqt/repowidget.py b/tortoisehg/hgqt/repowidget.py
+--- a/tortoisehg/hgqt/repowidget.py
++++ b/tortoisehg/hgqt/repowidget.py
+@@ -689,7 +689,7 @@ class RepoWidget(QWidget):
+             acceptbuttontext = _('Nothing to push')
+             w.acceptButton.setEnabled(False)
+         w.acceptButton.setText(acceptbuttontext)
+-        w.accepted.connect(lambda: self.push(False,
++        w.accepted.connect(lambda: self.push(confirm=False,
+             rev=rev, branch=branch, pushall=pushall))  # TODO: to the same URL
+         w.rejected.connect(self.clearRevisionSet)
+ 
+@@ -1220,13 +1220,8 @@ class RepoWidget(QWidget):
+         self.syncDemand.get().pull()
+     def outgoing(self):
+         self.syncDemand.get().outgoing()
+-    def push(self, confirm=True, **kwargs):
+-        """Call sync push.
+-
+-        If confirm is False, the user will not be prompted for
+-        confirmation. If confirm is True, the prompt might be used.
+-        """
+-        self.syncDemand.get().push(confirm, **kwargs)
++    def push(self, **kwargs):
++        self.syncDemand.get().push(**kwargs)
+         self.outgoingMode = False
+ 
+     @pyqtSlot()
+diff --git a/tortoisehg/hgqt/sync.py b/tortoisehg/hgqt/sync.py
+--- a/tortoisehg/hgqt/sync.py
++++ b/tortoisehg/hgqt/sync.py
+@@ -675,11 +675,11 @@ class SyncWidget(QWidget, qtlib.TaskWidg
+         else:
+             self.outclicked()
+ 
+-    def push(self, confirm, **kwargs):
++    def push(self, **kwargs):
+         if self.cmd.core.running():
+             self.showMessage.emit(_('sync command already running'))
+         else:
+-            self.pushclicked(confirm, **kwargs)
++            self.pushclicked(**kwargs)
+ 
+     def pullBundle(self, bundle, rev, bsource=None):
+         'accept bundle changesets'
+@@ -860,6 +860,10 @@ class SyncWidget(QWidget, qtlib.TaskWidg
+         self.run(['--repository', self.repo.root, 'p4pending', '--verbose'], ())
+ 
+     def pushclicked(self, confirm, rev=None, branch=None, pushall=False):
++        """
++        If confirm is False, the user will not be prompted for confirmation.
++        If confirm is True, the prompt might be used.
++        """
+         if rev == '':
+             rev = None
+         if branch == '':

File series

View file
+repow-pushkwargs.diff
+sync-pushconfirmopt.diff
+sync-push-connect.diff
 thread-dup-repoerror.diff
 close-self-by-wb.diff
 wb-closedestroy-trace.diff

File sync-push-connect.diff

View file
+# HG changeset patch
+# Parent 44f1ea8718385effc538d0f2d9be8d9990793ac0
+sync: XXX replace lambda slots
+
+NOT TESTED.
+
+diff --git a/tortoisehg/hgqt/sync.py b/tortoisehg/hgqt/sync.py
+--- a/tortoisehg/hgqt/sync.py
++++ b/tortoisehg/hgqt/sync.py
+@@ -93,7 +93,7 @@ class SyncWidget(QWidget, qtlib.TaskWidg
+             a = QAction(self)
+             a.setToolTip(tip)
+             a.setIcon(qtlib.geticon(icon))
+-            a.triggered.connect(cb)
++            QObject.connect(a, SIGNAL('triggered()'), cb)
+             self.opbuttons.append(a)
+             tb.addAction(a)
+             return a
+@@ -103,13 +103,13 @@ class SyncWidget(QWidget, qtlib.TaskWidg
+              'hg-incoming', self.inclicked)
+         self.pullAction = \
+         newaction(_('Pull incoming changes from selected URL'),
+-             'hg-pull', lambda: self.pullclicked())
++             'hg-pull', self.pullclicked)
+         self.outgoingAction = \
+         newaction(_('Detect outgoing changes to selected URL'),
+              'hg-outgoing', self.outclicked)
+         self.pushAction = \
+         newaction(_('Push outgoing changes to selected URL'),
+-             'hg-push', lambda: self.pushclicked())
++             'hg-push', self.pushclicked)
+         newaction(_('Email outgoing changesets for remote repository'),
+              'mail-forward', self.emailclicked)
+ 

File sync-pushconfirmopt.diff

View file
+# HG changeset patch
+# Date 1366645338 -32400
+# Parent 0b0b4f065099219a7f590a65f369a7740d7c09dc
+sync: allow push without confirmation dialog (closes #190)
+
+Now push target is always visible on toolbar or sync widget, it's safe
+to allow pushing without confirmation.
+
+This patch is based on the one by Arialdo Martini <arialdo.martini@yoox.com>.
+I reversed the logic of 'confirmpush' value in order to make it look like
+the other confirm-x options.
+
+diff --git a/tortoisehg/hgqt/settings.py b/tortoisehg/hgqt/settings.py
+--- a/tortoisehg/hgqt/settings.py
++++ b/tortoisehg/hgqt/settings.py
+@@ -691,6 +691,11 @@ INFO = (
+         '<li><b>revision</b>: Push the changes in the current branch '
+         '<i><u>up to</u> the current revision</i>.</ul><p>'
+         'Default: all')),
++    _fi(_('Confirm Push'), 'tortoisehg.confirmpush', genBoolRBGroup,
++        _('Determines if TortoiseHg should show a confirmation dialog '
++          'before pushing changesets. '
++          'If False, push will be performed without any confirmation dialog. '
++          'Default: True')),
+     _fi(_('Activate Bookmarks'), 'tortoisehg.activatebookmarks', (genDefaultCombo,
+         ['auto', 'prompt', 'never']),
+         _('Select when TortoiseHg will show a prompt to activate a bookmark '
+diff --git a/tortoisehg/hgqt/sync.py b/tortoisehg/hgqt/sync.py
+--- a/tortoisehg/hgqt/sync.py
++++ b/tortoisehg/hgqt/sync.py
+@@ -109,7 +109,7 @@ class SyncWidget(QWidget, qtlib.TaskWidg
+              'hg-outgoing', self.outclicked)
+         self.pushAction = \
+         newaction(_('Push outgoing changes to selected URL'),
+-             'hg-push', lambda: self.pushclicked(True))
++             'hg-push', lambda: self.pushclicked())
+         newaction(_('Email outgoing changesets for remote repository'),
+              'mail-forward', self.emailclicked)
+ 
+@@ -859,11 +859,13 @@ class SyncWidget(QWidget, qtlib.TaskWidg
+         self.showMessage.emit(_('Perforce pending...'))
+         self.run(['--repository', self.repo.root, 'p4pending', '--verbose'], ())
+ 
+-    def pushclicked(self, confirm, rev=None, branch=None, pushall=False):
++    def pushclicked(self, confirm=None, rev=None, branch=None, pushall=False):
+         """
+         If confirm is False, the user will not be prompted for confirmation.
+         If confirm is True, the prompt might be used.
+         """
++        if confirm is None:
++            confirm = self.repo.ui.configbool('tortoisehg', 'confirmpush', True)
+         if rev == '':
+             rev = None
+         if branch == '':