Commits

Yuya Nishihara committed 6ab8057

sync: add option to push without confirmation dialog (closes #190)

Now push target is always visible in 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>,
but I reversed the logic of `confirmpush` value in order to make it look like
the other confirm-xxx options.

Instead of several `confirm=None`s, pushclicked() should provide it by default.
But this patch doesn't change the API to avoid possible breakage.

Comments (0)

Files changed (3)

tortoisehg/hgqt/repowidget.py

         self.syncDemand.get().pull()
     def outgoing(self):
         self.syncDemand.get().outgoing()
-    def push(self, confirm=True, **kwargs):
+    def push(self, confirm=None, **kwargs):
         """Call sync push.
 
         If confirm is False, the user will not be prompted for

tortoisehg/hgqt/settings.py

         '<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 '

tortoisehg/hgqt/sync.py

              'hg-outgoing', self.outclicked)
         self.pushAction = \
         newaction(_('Push outgoing changes to selected URL'),
-             'hg-push', lambda: self.pushclicked(True))
+             'hg-push', lambda: self.pushclicked(None))
         newaction(_('Email outgoing changesets for remote repository'),
              'mail-forward', self.emailclicked)
 
         self.run(['--repository', self.repo.root, 'p4pending', '--verbose'], ())
 
     def pushclicked(self, confirm, rev=None, branch=None, pushall=False):
+        if confirm is None:
+            confirm = self.repo.ui.configbool('tortoisehg', 'confirmpush', True)
         if rev == '':
             rev = None
         if branch == '':