Anonymous avatar Anonymous committed c52933e

workbench: improve push infobar message

Up until now the infobar message that is shown on outgoing had a button with
the text 'Push' on it. This did not take into account the
'tortoisehg.defaultpush' setting, which can change the behavior of the push
button.

This patch shows a different text on te push button depending on the defaultpush
setting ('Push', 'Push current branch' or 'Push current revision').

I thought about putting the actual branch name or revision number on the button
as well. However this could lead to error if the user updates to a different
revision or branch while the infobar push message is being shown.

I could fix the rev and/or revision that is being pushed to when you click the
button, rather than using the current one to solve that issue. However I think
that is less flexible than the current solution (that let's you update to a
different revision before push without having to do a new update), and it could
also break down if the user stripped the current revision before hitting push.

My only concern is that an unexperienced user may believe that 'Push current
revision' will only push the current revision, not its ancestors. However this
should not be a common mistake (and if it is, the user has greater problems
anyway :-P). Another concern is that a user could believe that 'current revision'
equals 'selected revision'. In any case I still think that this is an
improvement over the current situation, where you do not know what you are
pushing.

Comments (0)

Files changed (1)

tortoisehg/hgqt/repowidget.py

         w = self.setInfoBar(qtlib.ConfirmInfoBar,
                             _('%d outgoing changesets') % len(nodes))
         assert w
-        w.acceptButton.setText(_('Push'))
+
+        # Read the tortoisehg.defaultpush setting to determine what to push
+        # by default
+        acceptbuttontext = _('Push')
+        defaultpush = self.repo.ui.config('tortoisehg', 'defaultpush', 'all')
+        if defaultpush == 'branch':
+            acceptbuttontext = _('Push current branch')
+        elif defaultpush == 'revision':
+            acceptbuttontext = _('Push current revision')
+
+        w.acceptButton.setText(acceptbuttontext)
         w.accepted.connect(lambda: self.push(False))  # TODO: to the same URL
         w.rejected.connect(self.clearRevisionSet)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.