[PATCH 2 of 2] error: add structured exception for EOF at prompt

Martin von Zweigbergk martinvonz at google.com
Tue Nov 10 17:26:46 CST 2015


I talked more to Sid about this and even though I don't understand the
patches, I'll push them so he can make progress. Tests are running now, so
will push within ~10 minutes.

On Tue, Nov 10, 2015 at 10:02 AM Martin von Zweigbergk <
martinvonz at google.com> wrote:

> The natural thing to do if one found the code in the state after these two
> patches would be to undo the changes, so I'm reluctant to accept the
> patches without seeing where this is going. Could you push the entire
> series to some public place?
>
> On Tue, Nov 10, 2015 at 12:50 AM Siddharth Agarwal <sid0 at fb.com> wrote:
>
>> # HG changeset patch
>> # User Siddharth Agarwal <sid0 at fb.com>
>> # Date 1447145205 28800
>> #      Tue Nov 10 00:46:45 2015 -0800
>> # Node ID 451c59f03bec5133d93604df82697fdac6755286
>> # Parent  5a25f53a58a973404e4de43e0221d076f8c07e27
>> error: add structured exception for EOF at prompt
>>
>> We'll catch this exception for promptchoice queries to provide better
>> error
>> handling.
>>
>> diff --git a/mercurial/error.py b/mercurial/error.py
>> --- a/mercurial/error.py
>> +++ b/mercurial/error.py
>> @@ -72,6 +72,12 @@ class ConfigError(Abort):
>>  class UpdateAbort(Abort):
>>      """Raised when an update is aborted for destination issue"""
>>
>> +class ResponseExpected(Abort):
>> +    """Raised when an EOF is received for a prompt"""
>> +    def __init__(self):
>> +        from .i18n import _
>> +        Abort.__init__(self, _('response expected'))
>> +
>>  class OutOfBandError(Exception):
>>      """Exception raised when a remote repo reports failure"""
>>
>> diff --git a/mercurial/ui.py b/mercurial/ui.py
>> --- a/mercurial/ui.py
>> +++ b/mercurial/ui.py
>> @@ -756,7 +756,7 @@ class ui(object):
>>                  self.write(r, "\n")
>>              return r
>>          except EOFError:
>> -            raise error.Abort(_('response expected'))
>> +            raise error.ResponseExpected()
>>
>>      @staticmethod
>>      def extractchoices(prompt):
>> @@ -803,7 +803,7 @@ class ui(object):
>>              else:
>>                  return getpass.getpass('')
>>          except EOFError:
>> -            raise error.Abort(_('response expected'))
>> +            raise error.ResponseExpected()
>>      def status(self, *msg, **opts):
>>          '''write status message to output (if ui.quiet is False)
>>
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> https://selenic.com/mailman/listinfo/mercurial-devel
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20151110/3d784076/attachment.html>


More information about the Mercurial-devel mailing list