[PATCH 5 of 6] merge: make calculateupdates() return file->action dict

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Dec 18 18:20:43 CST 2014



On 12/17/2014 01:24 PM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1418364461 28800
> #      Thu Dec 11 22:07:41 2014 -0800
> # Node ID d15256ef6ca65ce717fe48306e06e9d143c37bc9
> # Parent  8c8d94bee5ed8f86b679db55a6deabf5a04188fb
> merge: make calculateupdates() return file->action dict
>
> This simplifies largefiles' overridecalculateupdates(), which no
> longer has to do the conversion it started doing in 38e55e55ae4d
> (largefiles: rewrite merge code using dictionary with entry per file,
> 2014-12-09).
>
> To keep this patch small, we'll leave the name 'actionbyfile' in
> overrides.py. It will be renamed in the next patch.
>
> diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
> --- a/hgext/largefiles/overrides.py
> +++ b/hgext/largefiles/overrides.py
> @@ -428,15 +428,13 @@
>
>       # Convert to dictionary with filename as key and action as value.
>       lfiles = set()
> -    actionbyfile = {}
> -    for m, l in actions.iteritems():
> -        for f, args, msg in l:
> -            actionbyfile[f] = m, args, msg
> -            splitstandin = f and lfutil.splitstandin(f)
> -            if splitstandin in p1:
> -                lfiles.add(splitstandin)
> -            elif lfutil.standin(f) in p1:
> -                lfiles.add(f)
> +    actionbyfile = actions
> +    for f in actionbyfile.keys():

Any reason we use "keys() here? instead of direct iteration over 
actionbyfiles (or iterkeys?)

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list