1. Steve Test
  2. My test repo


Angel Ezquerra  committed 8c32919

commit: prompt the user to set a default username on commit if necessary

Currently TortoiseHg does not ever prompt the user to set its default username.
This means that is quite easy to make a commit with an undesired username. This
is particularly true on Windows, where the default username is the current
account name followed by "@" and the full network computer name.

With this change TortoiseHg checks whether a default username is set, and if not
it prompts the user to set one (letting the user open the settings dialog right
from the prompt).

  • Participants
  • Parent commits 0472f43
  • Branches default

Comments (0)

Files changed (1)

File tortoisehg/hgqt/commit.py

View file
     def commit(self, amend=False):
         repo = self.repo
+        defaultusername = ui.ui().config('ui', 'username')
+        if not defaultusername:
+            res = qtlib.CustomPrompt(
+                _('Default username is not configured'),
+                _('A default username is not configured. ') +
+                _('This username is used when you commit '
+                  'unless you set a different username on a given repository.\n\n') +
+                _('You must configure a default username before being able to commit.\n\n') +
+                _('Do you want to configure your default username now?'), self,
+                (_('&Configure'), _('Cancel')), 0, 1, []).run()
+            if res == 0:
+                from tortoisehg.hgqt import settings
+                settings.SettingsDialog(parent=self, focus='ui.username').exec_()
+            return
             msg = self.getMessage(False)
         except UnicodeEncodeError: