[PATCH 1 of 5] rebase: extract final changesets cleanup logic in a dedicated function

Bryan O'Sullivan bos at serpentine.com
Tue Sep 18 16:58:25 CDT 2012

On Tue, Sep 18, 2012 at 2:49 PM, Pierre-Yves David <
pierre-yves.david at ens-lyon.org> wrote:

> +    rebased = [rev for rev in state if state[rev] != nullmerge]
> +    if rebased:

A style thing: rebase in particular has lots of deep "if" nesting. When you
break out pieces of functionality into functions of their own, that really
helps keep the amount of indentation under control. So thanks.

It's possible to do a little better in cases like this:

if not rebased:

That can keep the code that follows less indented, which is a win for
readability (it ensures that we don't have to worry about reading an
"else:" some lines later).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120918/7fa908b0/attachment.html>

More information about the Mercurial-devel mailing list