[PATCH 1 of 2 v2] copies: create and use _loosenext function for _related

Yuya Nishihara yuya at tcha.org
Fri Apr 6 13:06:49 EDT 2018


On Thu, 05 Apr 2018 17:57:41 +0200, Gábor Stefanik wrote:
> # HG changeset patch
> # User Gábor Stefanik <gabor.stefanik at nng.com>
> # Date 1522943551 -7200
> #      Thu Apr 05 17:52:31 2018 +0200
> # Node ID 7d13af1b5cd6e5c95dceefc7d905429889583c8c
> # Parent  656ac240f39284eec4435d25c01d71056aa4e8a5
> copies: create and use _loosenext function for _related
> 
> _loosenext is going to be a variant of the next function that tries to follow
> grafts and similar relationship when the regular next raises StopIteration.
> This is needed for bug 5834.
> 
> diff -r 656ac240f392 -r 7d13af1b5cd6 mercurial/copies.py
> --- a/mercurial/copies.py       Sat Mar 24 01:30:50 2018 -0400
> +++ b/mercurial/copies.py       Thu Apr 05 17:52:31 2018 +0200
> @@ -731,6 +731,12 @@
> 
>      return copies, {}, {}, {}, {}
> 
> +def _loosenext(g):
> +    try:
> +        return next(g), g
> +    except StopIteration:
> +        raise

Seems fine, but please resend with the subsequent patches that will probably
extend _loosenext(g).


More information about the Mercurial-devel mailing list