[PATCH STABLE] revert: move prefetch to after the actions logic

Ryan McElroy rm at fb.com
Wed Jan 28 12:27:30 CST 2015


On 1/27/2015 8:19 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1422417146 28800
> #      Tue Jan 27 19:52:26 2015 -0800
> # Branch stable
> # Node ID 9ade3bdbd88b0203c128df057142d43efb478098
> # Parent  1f3b94e8dc4012051482f54b51a07ff66e15dee2
> revert: move prefetch to after the actions logic
>
> The prefetch logic came before the actual population of the actions collection,
> so it was always being passed an empty action list. This fixes it by moving it
> to after that logic.
>
> The only consumer of this function at the moment is remotefilelog, and I
> verified it works with this change.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -2765,9 +2765,6 @@ def revert(ui, repo, ctx, parents, *pats
>               (unknown,       actions['unknown'],  discard),
>               )
>   
> -        needdata = ('revert', 'add', 'undelete')
> -        _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
> -
>           wctx = repo[None]
>           for abs, (rel, exact) in sorted(names.items()):
>               # target file to be touch on disk (relative to cwd)
> @@ -2797,6 +2794,9 @@ def revert(ui, repo, ctx, parents, *pats
>   
>   
>           if not opts.get('dry_run'):
> +            needdata = ('revert', 'add', 'undelete')
> +            _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
> +
>               _performrevert(repo, parents, ctx, actions)
>   
>               # get the list of subrepos that must be reverted
>
Patch looks good to me after poking around in the code a bit.


More information about the Mercurial-devel mailing list