[PATCH] obsutil: clarify the access to "repo"

Yuya Nishihara yuya at tcha.org
Mon Nov 5 06:29:35 EST 2018


On Mon, 05 Nov 2018 11:42:19 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1526995577 -7200
> #      Tue May 22 15:26:17 2018 +0200
> # Node ID f4f31bac4057231d97000967cb731ac0da25f30b
> # Parent  e0dea186ab6edfab124b1dfd84237a4b8142f13b
> # EXP-Topic gratuitous-cleanup
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r f4f31bac4057
> obsutil: clarify the access to "repo"
> 
> We use the variable multiple times and we might use it even more in the
> future. We use a temporary variable instead.
> 
> diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
> --- a/mercurial/obsutil.py
> +++ b/mercurial/obsutil.py
> @@ -397,11 +397,14 @@ def _cmpdiff(leftctx, rightctx):
>      This is a first and basic implementation, with many shortcoming.
>      """
>      diffopts = diffutil.diffallopts(leftctx.repo().ui, {'git': True})
> +
> +    # lefctx._repo and right_ctx._repo are the same here
> +    repo = leftctx._repo

Can you update the leftctx.repo() in the first line as well? It's better
to use repo() instead of _repo.


More information about the Mercurial-devel mailing list