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

login
register
mail settings
Submitter Durham Goode
Date Jan. 28, 2015, 4:19 a.m.
Message ID <9ade3bdbd88b0203c128.1422418774@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/7568/
State Accepted
Commit 6156edaa82aab1193875f8ccd9c2cbe5661996b9
Headers show

Comments

Durham Goode - Jan. 28, 2015, 4:19 a.m.
# HG changeset patch
# User Durham Goode <durham@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.
Ryan McElroy - Jan. 28, 2015, 6:27 p.m.
On 1/27/2015 8:19 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@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.
Matt Mackall - Jan. 28, 2015, 8:36 p.m.
On Tue, 2015-01-27 at 20:19 -0800, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@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

Queued for stable, thanks.

Patch

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