Patchwork [05,of,10,stable] largefiles: verify all files in each revision and fail on errors in any revision

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 25, 2013, 5:17 a.m.
Message ID <73d88c056d7bb51cc613.1359091024@mk-desktop>
Download mbox | patch
Permalink /patch/727/
State Deferred, archived
Headers show

Comments

Mads Kiilerich - Jan. 25, 2013, 5:17 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1359090858 -3600
# Branch stable
# Node ID 73d88c056d7bb51cc61344395c3c790962f55e07
# Parent  6d3c31020d0135405d757cd128aecec476e6698b
largefiles: verify all files in each revision and fail on errors in any revision
Pierre-Yves David - Jan. 28, 2013, 1:41 p.m.
On Fri, Jan 25, 2013 at 06:17:04AM +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1359090858 -3600
> # Branch stable
> # Node ID 73d88c056d7bb51cc61344395c3c790962f55e07
> # Parent  6d3c31020d0135405d757cd128aecec476e6698b
> largefiles: verify all files in each revision and fail on errors in any revision

What was the previous behavior? Checking the last revision only? The changeset
description should probably makes that clear.

note: you summary line is a bit long, Bryan will complains.

> 
> diff --git a/hgext/largefiles/basestore.py b/hgext/largefiles/basestore.py
> --- a/hgext/largefiles/basestore.py
> +++ b/hgext/largefiles/basestore.py
> @@ -105,8 +105,9 @@
>              cctx = self.repo[rev]
>              cset = "%d:%s" % (cctx.rev(), node.short(cctx.node()))
>  
> -            failed = util.any(self._verifyfile(
> -                cctx, cset, contents, standin, verified) for standin in cctx)
> +            for standin in cctx:
> +                if self._verifyfile(cctx, cset, contents, standin, verified):
> +                    failed = True
>  
>          numrevs = len(verified)
>          numlfiles = len(set([fname for (fname, fnode) in verified]))
> diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
> --- a/tests/test-largefiles.t
> +++ b/tests/test-largefiles.t
> @@ -1204,7 +1204,7 @@
>    searching 1 changesets for largefiles
>    changeset 9:598410d3eb9a: sub/large4 missing
>      (looked for hash e166e74c7303192238d60af5a9c4ce9bef0b7928)
> -  verified existence of 1 revisions of 1 largefiles
> +  verified existence of 3 revisions of 3 largefiles
>    [1]
>  
>  - introduce corruption and make sure that it is caught when checking content:
> @@ -1215,7 +1215,7 @@
>      ($TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928:
>      expected hash e166e74c7303192238d60af5a9c4ce9bef0b7928,
>      but got 1f19b76d5b3cad1472c87efb42b582c97e040060)
> -  verified contents of 1 revisions of 1 largefiles
> +  verified contents of 3 revisions of 3 largefiles
>    [1]
>  
>  - cleanup
> @@ -1227,9 +1227,11 @@
>    searching 10 changesets for largefiles
>    changeset 0:30d30fe6a5be: large1 missing
>      (looked for hash 4669e532d5b2c093a78eca010077e708a071bb64)
> +  changeset 0:30d30fe6a5be: sub/large2 missing
> +    (looked for hash 1deebade43c8c498a3c8daddac0244dc55d1331d)
>    changeset 1:ce8896473775: large1 missing
>      (looked for hash 5f78770c0e77ba4287ad6ef3071c9bf9c379742f)
> -  changeset 2:51a0ae4d5864: sub/large2: contents differ
> +  changeset 1:ce8896473775: sub/large2: contents differ
>      ($TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4:
>      expected hash eb7338044dc27f9bc59b8dd5a246b065ead7a9c4,
>      but got cfef678f24d3e339944138ecdd8fd85ca21d820f)
> @@ -1241,7 +1243,12 @@
>      ($TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4:
>      expected hash eb7338044dc27f9bc59b8dd5a246b065ead7a9c4,
>      but got cfef678f24d3e339944138ecdd8fd85ca21d820f)
> -  verified contents of 13 revisions of 6 largefiles
> +  changeset 4:74c02385b94c: sub/large4: contents differ
> +    ($TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4:
> +    expected hash eb7338044dc27f9bc59b8dd5a246b065ead7a9c4,
> +    but got cfef678f24d3e339944138ecdd8fd85ca21d820f)
> +  verified contents of 15 revisions of 6 largefiles
> +  [1]
>  
>  - cleanup
>    $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Mads Kiilerich - Jan. 28, 2013, 2:07 p.m.
On 01/28/2013 02:41 PM, Pierre-Yves David wrote:
> On Fri, Jan 25, 2013 at 06:17:04AM +0100, Mads Kiilerich wrote:
>> # HG changeset patch
>> # User Mads Kiilerich <madski@unity3d.com>
>> # Date 1359090858 -3600
>> # Branch stable
>> # Node ID 73d88c056d7bb51cc61344395c3c790962f55e07
>> # Parent  6d3c31020d0135405d757cd128aecec476e6698b
>> largefiles: verify all files in each revision and fail on errors in any revision
> What was the previous behavior? Checking the last revision only? The changeset
> description should probably makes that clear.

Verify used 'any' and would stop verifying after the first failure in each
changeset.

The exit code only reported the result from the last changeset.

>
> note: you summary line is a bit long, Bryan will complains.

It is 80 characters. That is max but ok for Mercurial code. But yeah, 
ContributingChanges says less than 80 for descriptions. That 
inconsistency must be a bug in ContributingChanges ;-)

/Mads

Patch

diff --git a/hgext/largefiles/basestore.py b/hgext/largefiles/basestore.py
--- a/hgext/largefiles/basestore.py
+++ b/hgext/largefiles/basestore.py
@@ -105,8 +105,9 @@ 
             cctx = self.repo[rev]
             cset = "%d:%s" % (cctx.rev(), node.short(cctx.node()))
 
-            failed = util.any(self._verifyfile(
-                cctx, cset, contents, standin, verified) for standin in cctx)
+            for standin in cctx:
+                if self._verifyfile(cctx, cset, contents, standin, verified):
+                    failed = True
 
         numrevs = len(verified)
         numlfiles = len(set([fname for (fname, fnode) in verified]))
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1204,7 +1204,7 @@ 
   searching 1 changesets for largefiles
   changeset 9:598410d3eb9a: sub/large4 missing
     (looked for hash e166e74c7303192238d60af5a9c4ce9bef0b7928)
-  verified existence of 1 revisions of 1 largefiles
+  verified existence of 3 revisions of 3 largefiles
   [1]
 
 - introduce corruption and make sure that it is caught when checking content:
@@ -1215,7 +1215,7 @@ 
     ($TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928:
     expected hash e166e74c7303192238d60af5a9c4ce9bef0b7928,
     but got 1f19b76d5b3cad1472c87efb42b582c97e040060)
-  verified contents of 1 revisions of 1 largefiles
+  verified contents of 3 revisions of 3 largefiles
   [1]
 
 - cleanup
@@ -1227,9 +1227,11 @@ 
   searching 10 changesets for largefiles
   changeset 0:30d30fe6a5be: large1 missing
     (looked for hash 4669e532d5b2c093a78eca010077e708a071bb64)
+  changeset 0:30d30fe6a5be: sub/large2 missing
+    (looked for hash 1deebade43c8c498a3c8daddac0244dc55d1331d)
   changeset 1:ce8896473775: large1 missing
     (looked for hash 5f78770c0e77ba4287ad6ef3071c9bf9c379742f)
-  changeset 2:51a0ae4d5864: sub/large2: contents differ
+  changeset 1:ce8896473775: sub/large2: contents differ
     ($TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4:
     expected hash eb7338044dc27f9bc59b8dd5a246b065ead7a9c4,
     but got cfef678f24d3e339944138ecdd8fd85ca21d820f)
@@ -1241,7 +1243,12 @@ 
     ($TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4:
     expected hash eb7338044dc27f9bc59b8dd5a246b065ead7a9c4,
     but got cfef678f24d3e339944138ecdd8fd85ca21d820f)
-  verified contents of 13 revisions of 6 largefiles
+  changeset 4:74c02385b94c: sub/large4: contents differ
+    ($TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4:
+    expected hash eb7338044dc27f9bc59b8dd5a246b065ead7a9c4,
+    but got cfef678f24d3e339944138ecdd8fd85ca21d820f)
+  verified contents of 15 revisions of 6 largefiles
+  [1]
 
 - cleanup
   $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4