Diversify Raised Exceptions
Thomas Burdick
thomas.burdick at gmail.com
Thu Jan 22 07:14:48 UTC 2009
I realize now this isn't needed at all. I just didn't fully understand
how use hg's api, I still don't entirely but I'm learning day by day
more and more of what this awesome beast has become.
Please disregard.
-Tom
On 1/21/09, Thomas Burdick <thomas.burdick at gmail.com> wrote:
> I think you misunderstood a bit.
>
> In the update dialog presented to the user their current working
> directory is given as a highlighted node in a graph. If they choose to
> select another node on another branch and they do not have local
> changes, I see that as being the users definitive choice to switch to
> that particular branch/node as their working directory.
>
> On the other hand, if the update were to tip without regard to
> seeing/knowing where your at currently then the cross-branches error
> is certainly valid.
>
> So no, the users would never be questioning where their local changes
> went, even in the case of having a dialog display the history as a
> graph and them selecting any node other than the one their on
> currently, this is a valid error indeed. The cross branches error is
> not.
>
> This in fact reduces the amount of input required by the user, in
> cases where its senseless to ask "do you want to force this operation"
> I can simply do it for them as its what they've already chosen to do
> and can visually see the results prior to clicking "update".
>
> If it does not make sense to make exception classes then I will end up
> parsing error message strings which is probably much worse.
>
> -Tom
>
> On 1/21/09, Matt Mackall <mpm at selenic.com> wrote:
>> On Wed, 2009-01-21 at 11:52 -0600, Thomas Burdick wrote:
>>> certainly, best examples I can think of are the
>>>
>>> update crosses branches and...
>>> update overwrites local changes.
>>>
>>> Those two are the first I've run across. They are util.Abort raised
>>> errors, I'd like them to be unique so I can do something like...
>>>
>>> try:
>>> dispatch.dispatch(['update', '-r', somerev])
>>> except util.CrossBranches:
>>> #ignore, this is a pretty useless message, just force it anyways
>>
>> Great. Now you'll have your users wondering where their local changes
>> disappeared to and why they're getting "push adds new remote heads"
>> warnings instead.
>>
>>> except util.OverwritesLocalChanges:
>>> #pop a message box asking if the user if they'd like to overwrite and
>>> continue or just cancel the operation.
>>>
>>> Does this make sense to do?
>>
>> Not really. We'd end up with about 300 exception classes.
>>
>> --
>> http://selenic.com : development and support for Mercurial and Linux
>>
>>
>>
>
More information about the Mercurial
mailing list