[PATCH 6 of 6 V2] largefiles: don't duplicate 'actions' into 'actionbyfile'

Augie Fackler raf at durin42.com
Mon Dec 22 16:06:22 CST 2014


On Mon, Dec 22, 2014 at 01:36:22PM -0800, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1418367089 28800
> #      Thu Dec 11 22:51:29 2014 -0800
> # Node ID 140c6c438f0e93737a10bc9942e0aae92b0c46a2
> # Parent  787b47dc08bb4bfb86d4cc8d9cff6ceddbb26b94
> largefiles: don't duplicate 'actions' into 'actionbyfile'

Per marmoute's review and my own, queued. Thanks!

>
> diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
> --- a/hgext/largefiles/overrides.py
> +++ b/hgext/largefiles/overrides.py
> @@ -435,8 +435,7 @@
>
>      # Convert to dictionary with filename as key and action as value.
>      lfiles = set()
> -    actionbyfile = actions
> -    for f in actionbyfile:
> +    for f in actions:
>          splitstandin = f and lfutil.splitstandin(f)
>          if splitstandin in p1:
>              lfiles.add(splitstandin)
> @@ -445,8 +444,8 @@
>
>      for lfile in lfiles:
>          standin = lfutil.standin(lfile)
> -        (lm, largs, lmsg) = actionbyfile.get(lfile, (None, None, None))
> -        (sm, sargs, smsg) = actionbyfile.get(standin, (None, None, None))
> +        (lm, largs, lmsg) = actions.get(lfile, (None, None, None))
> +        (sm, sargs, smsg) = actions.get(standin, (None, None, None))
>          if sm in ('g', 'dc') and lm != 'r':
>              # Case 1: normal file in the working copy, largefile in
>              # the second parent
> @@ -454,16 +453,14 @@
>                          'use (l)argefile or keep (n)ormal file?'
>                          '$$ &Largefile $$ &Normal file') % lfile
>              if repo.ui.promptchoice(usermsg, 0) == 0: # pick remote largefile
> -                actionbyfile[lfile] = ('r', None, 'replaced by standin')
> -                actionbyfile[standin] = ('g', sargs, 'replaces standin')
> +                actions[lfile] = ('r', None, 'replaced by standin')
> +                actions[standin] = ('g', sargs, 'replaces standin')
>              else: # keep local normal file
> -                actionbyfile[lfile] = ('k', None, 'replaces standin')
> +                actions[lfile] = ('k', None, 'replaces standin')
>                  if branchmerge:
> -                    actionbyfile[standin] = ('k', None,
> -                                             'replaced by non-standin')
> +                    actions[standin] = ('k', None, 'replaced by non-standin')
>                  else:
> -                    actionbyfile[standin] = ('r', None,
> -                                             'replaced by non-standin')
> +                    actions[standin] = ('r', None, 'replaced by non-standin')
>          elif lm in ('g', 'dc') and sm != 'r':
>              # Case 2: largefile in the working copy, normal file in
>              # the second parent
> @@ -473,21 +470,21 @@
>              if repo.ui.promptchoice(usermsg, 0) == 0: # keep local largefile
>                  if branchmerge:
>                      # largefile can be restored from standin safely
> -                    actionbyfile[lfile] = ('k', None, 'replaced by standin')
> -                    actionbyfile[standin] = ('k', None, 'replaces standin')
> +                    actions[lfile] = ('k', None, 'replaced by standin')
> +                    actions[standin] = ('k', None, 'replaces standin')
>                  else:
>                      # "lfile" should be marked as "removed" without
>                      # removal of itself
> -                    actionbyfile[lfile] = ('lfmr', None,
> -                                           'forget non-standin largefile')
> +                    actions[lfile] = ('lfmr', None,
> +                                      'forget non-standin largefile')
>
>                      # linear-merge should treat this largefile as 're-added'
> -                    actionbyfile[standin] = ('a', None, 'keep standin')
> +                    actions[standin] = ('a', None, 'keep standin')
>              else: # pick remote normal file
> -                actionbyfile[lfile] = ('g', largs, 'replaces standin')
> -                actionbyfile[standin] = ('r', None, 'replaced by non-standin')
> +                actions[lfile] = ('g', largs, 'replaces standin')
> +                actions[standin] = ('r', None, 'replaced by non-standin')
>
> -    return actionbyfile, diverge, renamedelete
> +    return actions, diverge, renamedelete
>
>  def mergerecordupdates(orig, repo, actions, branchmerge):
>      if 'lfmr' in actions:


More information about the Mercurial-devel mailing list