[PATCH 1 of 4] revert: move manifest membership condition outside of the loop

Sean Farley sean.michael.farley at gmail.com
Wed Aug 13 15:19:59 CDT 2014


Pierre-Yves David writes:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1403620102 -3600
> #      Tue Jun 24 15:28:22 2014 +0100
> # Node ID da0fc935abb80656cfb7e315589c05bd57a3e9d2
> # Parent  88d54549740874519609f79c2c064033726644c2
> revert: move manifest membership condition outside of the loop
>
> Currently, revset is using information from dirstate status and alter its
> behavior whenever the file exist in the target manifest or not. This tests are
> done a big for loop. We move this member ship testing outside of the loop and
> simplifies associates data structure.
>
> This is a step toward a cleaner implementation of revert based on status.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -2384,32 +2384,42 @@ def revert(ui, repo, ctx, parents, *pats
>          def removeforget(abs):
>              if repo.dirstate[abs] == 'a':
>                  return _('forgetting %s\n')
>              return _('removing %s\n')
>  
> +        # split between files known in target manifest and the others
> +        smf = set(mf)

Sweet variable name, bro.


More information about the Mercurial-devel mailing list