changeset 358:ea6f76c0aa76

Make username/password prompts in easyhg.py more helpful; use a distinctive return for cancel in these dialogs, and avoid showing command-failed in the main program when cancelled
author Chris Cannam
date Thu, 17 Mar 2011 13:52:57 +0000
parents 4373061dd20e
children 550650bbb959 f34848e8094b 4cd753e083cc
files easyhg.py mainwindow.cpp
diffstat 2 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/easyhg.py	Thu Mar 17 13:45:05 2011 +0000
+++ b/easyhg.py	Thu Mar 17 13:52:57 2011 +0000
@@ -54,7 +54,7 @@
         self.write(msg, ' ', default, "\n")
         return default
     if msg == _('user:'):
-        msg = _('User:')
+        msg = _('Username for remote repository:')
     d = QtGui.QInputDialog()
     d.setInputMode(QtGui.QInputDialog.TextInput)
     d.setTextEchoMode(QtGui.QLineEdit.Normal)
@@ -65,7 +65,7 @@
     ok = d.exec_()
     r = d.textValue()
     if not ok:
-        raise util.Abort(_('response expected'))
+        raise util.Abort(_('username entry cancelled'))
     if not r:
         return default
     return r
@@ -74,7 +74,7 @@
     if not self.interactive():
         return default
     if not prompt or prompt == _('password:'):
-        prompt = _('Password:');
+        prompt = _('Password for remote repository:');
     d = QtGui.QInputDialog()
     d.setInputMode(QtGui.QInputDialog.TextInput)
     d.setTextEchoMode(QtGui.QLineEdit.Password)
@@ -85,8 +85,9 @@
     ok = d.exec_()
     r = d.textValue()
     if not ok:
-        raise util.Abort(_('response expected'))
+        raise util.Abort(_('password entry cancelled'))
     if not r:
         return default
     return r
 
+ 
--- a/mainwindow.cpp	Thu Mar 17 13:45:05 2011 +0000
+++ b/mainwindow.cpp	Thu Mar 17 13:52:57 2011 +0000
@@ -1802,6 +1802,9 @@
         if (output.contains("authorization failed")) {
             reportAuthFailed(output);
             return;
+        } else if (output.contains("entry cancelled")) {
+            // ignore this, user cancelled username or password dialog
+            return;
         } else {
             // Incoming returns non-zero code and no output if the
             // check was successful but there are no changes
@@ -1826,6 +1829,9 @@
         if (output.contains("authorization failed")) {
             reportAuthFailed(output);
             return;
+        } else if (output.contains("entry cancelled")) {
+            // ignore this, user cancelled username or password dialog
+            return;
         }
         break; // go on to default report
     case ACT_PUSH:
@@ -1835,6 +1841,9 @@
         } else if (output.contains("authorization failed")) {
             reportAuthFailed(output);
             return;
+        } else if (output.contains("entry cancelled")) {
+            // ignore this, user cancelled username or password dialog
+            return;
         }
         break; // go on to default report
     case ACT_QUERY_HEADS: