Patchwork [v2,stable] largefiles: fix support for local largefiles while using share extension

login
register
mail settings
Submitter Henrik Stuart
Date June 7, 2016, 6:39 a.m.
Message ID <29373afaa1799b3f3505.1465281555@DESKTOP-HENRIKS.hq.unity3d.com>
Download mbox | patch
Permalink /patch/15426/
State Accepted
Headers show

Comments

Henrik Stuart - June 7, 2016, 6:39 a.m.
# HG changeset patch
# User Henrik Stuart <henriks@unity3d.com>
# Date 1465281153 -7200
#      Tue Jun 07 08:32:33 2016 +0200
# Branch stable
# Node ID 29373afaa1799b3f3505c7ab738bd81b2155a77a
# Parent  e82ca7d0967cd10d92562820297c3413abe6fc29
largefiles: fix support for local largefiles while using share extension

Prior to revision 2a3f24786d09, largefiles were saved in the local repository,
even if it was using the share extension. After that change, all largefiles are
now stored in the shared repository. However, the backward compatibility for
existing largefiles already placed in the local repository was never tested,
and has been broken since.
Augie Fackler - June 10, 2016, 3:30 a.m.
On Tue, Jun 07, 2016 at 08:39:15AM +0200, Henrik Stuart wrote:
> # HG changeset patch
> # User Henrik Stuart <henriks@unity3d.com>
> # Date 1465281153 -7200
> #      Tue Jun 07 08:32:33 2016 +0200
> # Branch stable
> # Node ID 29373afaa1799b3f3505c7ab738bd81b2155a77a
> # Parent  e82ca7d0967cd10d92562820297c3413abe6fc29
> largefiles: fix support for local largefiles while using share extension

Queued for stable, thanks.

>
> Prior to revision 2a3f24786d09, largefiles were saved in the local repository,
> even if it was using the share extension. After that change, all largefiles are
> now stored in the shared repository. However, the backward compatibility for
> existing largefiles already placed in the local repository was never tested,
> and has been broken since.
>
> diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
> --- a/hgext/largefiles/lfutil.py
> +++ b/hgext/largefiles/lfutil.py
> @@ -204,7 +204,7 @@
>      if instore(repo, hash):
>          return (path, True)
>      elif repo.shared() and instore(repo, hash, True):
> -        return storepath(repo, hash, True)
> +        return storepath(repo, hash, True), True
>
>      return (path, False)
>
> diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t
> --- a/tests/test-largefiles-cache.t
> +++ b/tests/test-largefiles-cache.t
> @@ -186,6 +186,10 @@
>    src/.hg/largefiles/dirstate
>    src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
>
> +Verify that backwards compatibility is maintained for old storage layout
> +  $ mv src/.hg/largefiles/$hash share_dst/.hg/largefiles
> +  $ hg verify --quiet --lfa -R share_dst --config largefiles.usercache=
> +
>  Inject corruption into the largefiles store and see how update handles that:
>
>    $ cd src
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -204,7 +204,7 @@ 
     if instore(repo, hash):
         return (path, True)
     elif repo.shared() and instore(repo, hash, True):
-        return storepath(repo, hash, True)
+        return storepath(repo, hash, True), True
 
     return (path, False)
 
diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t
--- a/tests/test-largefiles-cache.t
+++ b/tests/test-largefiles-cache.t
@@ -186,6 +186,10 @@ 
   src/.hg/largefiles/dirstate
   src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
 
+Verify that backwards compatibility is maintained for old storage layout
+  $ mv src/.hg/largefiles/$hash share_dst/.hg/largefiles
+  $ hg verify --quiet --lfa -R share_dst --config largefiles.usercache=
+
 Inject corruption into the largefiles store and see how update handles that:
 
   $ cd src