[PATCH V2] rebase: do not raise an UnboundLocalError when called with wrong rev (issue4106)
David Soria Parra
davidsp at fb.com
Wed Feb 19 13:55:19 CST 2014
On 2/19/14, 2:55 AM, "Simon Heimberg" <simohe at besonet.ch> wrote:
>diff -r 0e2877f8605d -r 2554f90793b6 hgext/rebase.py
>--- a/hgext/rebase.py Sat Feb 15 22:09:32 2014 -0600
>+++ b/hgext/rebase.py Fri Feb 14 00:34:20 2014 +0100
>@@ -513,6 +513,11 @@
> if state.get(p.rev()) == repo[p1].rev():
> base = p.node()
> break
>+ else:
>+ # fallback when base not found (unnormal, see issue 4106)
>+ #
>+ # Raise because this function is (probaby) called wrong
>+ raise AssertionError('function is called wrong')
1. I think we could do better as Œfunction is called wrong¹. Maybe Œbase
must be defined¹.
2. I personally would have an invariant before the
assert Œbase¹ in locals()
if base is not None:
making it clear that base needs to be defined after the whole if-else
statement.
- David
More information about the Mercurial-devel
mailing list