[PATCH 3 of 4 STABLE] context.status: remove incorrect swapping of added/removed in workingctx

Sean Farley sean.michael.farley at gmail.com
Thu Oct 23 16:35:21 CDT 2014


Martin von Zweigbergk writes:

> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1414095679 25200
> #      Thu Oct 23 13:21:19 2014 -0700
> # Branch stable
> # Node ID 2eb04f88de4b5103fb3c3584811b557b3ec2b771
> # Parent  066f1db71b729c05d74418e214d21b377f51c396
> context.status: remove incorrect swapping of added/removed in workingctx
>
> The comment in workingctx.status() says that "calling 'super' subtly
> reveresed the contexts", but that is simply not true, so we should not
> be swapping added and removed fields.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -1499,13 +1499,9 @@
>                 listclean=False, listunknown=False, listsubrepos=False):
>          # yet to be determined: what to do if 'other' is a 'workingctx' or a
>          # 'memctx'?
> -        s = super(workingctx, self).status(other, match, listignored, listclean,
> -                                           listunknown, listsubrepos)
> -        # calling 'super' subtly reveresed the contexts, so we flip the results
> -        # (s[1] is 'added' and s[2] is 'removed')
> -        s = list(s)
> -        s[1], s[2] = s[2], s[1]
> -        return scmutil.status(*s)
> +        return super(workingctx, self).status(other, match, listignored,
> +                                              listclean, listunknown,
> +                                              listsubrepos)

Ouch. Good catch. This subtle swapping of contexts was from a previous
refactoring :-(


More information about the Mercurial-devel mailing list