[PATCH 2 of 2 stable] largefiles: fix explicit commit of normal/largefile switch

Augie Fackler raf at durin42.com
Thu Oct 22 05:28:06 CDT 2015


On Wed, Oct 21, 2015 at 12:28:50AM +0200, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski at unity3d.com>
> # Date 1445379491 -7200
> #      Wed Oct 21 00:18:11 2015 +0200
> # Branch stable
> # Node ID b68797f244e4bb97021ba77531d3080b1abc1489
> # Parent  e82bce7ec843eff37e917d072c7c333146bb573f
> largefiles: fix explicit commit of normal/largefile switch
>

queued these for stable, thanks

>
> Commit of corresponding normal/largefiles pairs would only commit the standin.
> That is usually fine, except if either the normal file or the standin is a
> remove while the other is an add. In that case it would either give duplicate
> colliding entries or lose the file.
>
> Instead, commit both filenames if one of them is a remove.
>
> diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
> --- a/hgext/largefiles/lfutil.py
> +++ b/hgext/largefiles/lfutil.py
> @@ -562,8 +562,11 @@ def updatestandinsbymatch(repo, match):
>      for f in match._files:
>          fstandin = standin(f)
>
> -        # ignore known largefiles and standins
> -        if f in lfiles or fstandin in standins:
> +        # For largefiles, only one of the normal and standin should be
> +        # committed (except if one of them is a remove).
> +        # Thus, skip plain largefile names but keep the standin.
> +        if (f in lfiles or fstandin in standins) and \
> +            repo.dirstate[f] != 'r' and repo.dirstate[fstandin] != 'r':
>              continue
>
>          actualfiles.append(f)
> diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
> --- a/tests/test-largefiles.t
> +++ b/tests/test-largefiles.t
> @@ -1850,7 +1850,7 @@ the add and the remove is committed.
>    .hglf/normal3
>    .hglf/sub2/large6
>    .hglf/sub2/large7
> -  normal3
> +  large4-renamed
>    sub/normal4
>
>    $ cd ..
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list