Patchwork [06,of,10,stable] largefiles: report localstore errors with single line warnings messages

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 25, 2013, 5:17 a.m.
Message ID <7f9af5ed51988a7807d7.1359091025@mk-desktop>
Download mbox | patch
Permalink /patch/726/
State Accepted
Commit a49b7c9fc246cd3c70b468f4587ed60c717bd0a8
Headers show

Comments

Mads Kiilerich - Jan. 25, 2013, 5:17 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1359090896 -3600
# Branch stable
# Node ID 7f9af5ed51988a7807d7c15ed559fe4b63c8e880
# Parent  73d88c056d7bb51cc61344395c3c790962f55e07
largefiles: report localstore errors with single line warnings messages

The actual hash is also not relevant to report.

This makes verify output with multiple failures easier to process.
Matt Harbison - Jan. 28, 2013, 3 a.m.
On Fri, 25 Jan 2013 06:17:05 +0100, Mads Kiilerich wrote:

> # HG changeset patch # User Mads Kiilerich <madski@unity3d.com>
> # Date 1359090896 -3600 # Branch stable # Node ID
> 7f9af5ed51988a7807d7c15ed559fe4b63c8e880 # Parent 
> 73d88c056d7bb51cc61344395c3c790962f55e07 largefiles: report localstore
> errors with single line warnings messages
> 
> The actual hash is also not relevant to report.
> 
> This makes verify output with multiple failures easier to process.

...

> changeset 1:ce8896473775: large1 references missing
> $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f
> changeset 1:ce8896473775: sub/large2 references corrupted
> $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4

+1 for better readability.

This idea might be too much so close to a release because I'm sure there 
are other places, but what would you think of dropping the reference to 
the cached largefile to make it even shorter?  Given a cset and the normal 
name, you can 'hg cat -r <rev> .hglf/<name>' to get the hash, and 
therefore the .hg/largefiles/<hash> path.  So something like this:

  changeset 1:ce8896473775: large1 is missing
  changeset 1:ce8896473775: sub/large2 is corrupt

Or are there cases I'm not thinking of where the path may be different, 
and/or be more useful if directly available?  This may be obscure for a 
newbie, but they probably shouldn't be fiddling with the cache directory 
anyway.

When cached files are missing, I typically point path.default to a repo I 
know has it and update to that rev.  Or, since verify seems to ignore the 
local files and look to the parent repo's cache (last I checked anyway), 
point path.default to "" to force verification of the local files.

--Matt
Mads Kiilerich - Jan. 28, 2013, 2:17 p.m.
On 01/28/2013 04:00 AM, Matt Harbison wrote:
> On Fri, 25 Jan 2013 06:17:05 +0100, Mads Kiilerich wrote:
>
>> # HG changeset patch # User Mads Kiilerich <madski@unity3d.com>
>> # Date 1359090896 -3600 # Branch stable # Node ID
>> 7f9af5ed51988a7807d7c15ed559fe4b63c8e880 # Parent
>> 73d88c056d7bb51cc61344395c3c790962f55e07 largefiles: report localstore
>> errors with single line warnings messages
>>
>> The actual hash is also not relevant to report.
>>
>> This makes verify output with multiple failures easier to process.
> ...
>
>> changeset 1:ce8896473775: large1 references missing
>> $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f
>> changeset 1:ce8896473775: sub/large2 references corrupted
>> $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
> +1 for better readability.
>
> This idea might be too much so close to a release because I'm sure there
> are other places, but what would you think of dropping the reference to
> the cached largefile to make it even shorter?

Fine.

I will push this patch to default when it opens again. Please follow up 
with further improvements ;-)

> Given a cset and the normal
> name, you can 'hg cat -r <rev> .hglf/<name>' to get the hash, and
> therefore the .hg/largefiles/<hash> path.  So something like this:
>
>    changeset 1:ce8896473775: large1 is missing
>    changeset 1:ce8896473775: sub/large2 is corrupt
>
> Or are there cases I'm not thinking of where the path may be different,
> and/or be more useful if directly available?  This may be obscure for a
> newbie, but they probably shouldn't be fiddling with the cache directory
> anyway.

Sometimes it is nice to be told where it is looking - whether it is 
using usercache and where it is. I think the full path is relevant when 
reporting corruptions - but probably not in any other cases.

> When cached files are missing, I typically point path.default to a repo I
> know has it and update to that rev.  Or, since verify seems to ignore the
> local files and look to the parent repo's cache (last I checked anyway),

This area probably needs some further work as well.

> point path.default to "" to force verification of the local files.

/Mads

Patch

diff --git a/hgext/largefiles/localstore.py b/hgext/largefiles/localstore.py
--- a/hgext/largefiles/localstore.py
+++ b/hgext/largefiles/localstore.py
@@ -63,23 +63,19 @@ 
             return False
 
         expecthash = fctx.data()[0:40]
+        storepath = lfutil.storepath(self.remote, expecthash)
         verified.add(key)
         if not lfutil.instore(self.remote, expecthash):
             self.ui.warn(
-                _('changeset %s: %s missing\n'
-                  '  (looked for hash %s)\n')
-                % (cset, filename, expecthash))
+                _('changeset %s: %s references missing %s\n')
+                % (cset, filename, storepath))
             return True                 # failed
 
         if contents:
-            storepath = lfutil.storepath(self.remote, expecthash)
             actualhash = lfutil.hashfile(storepath)
             if actualhash != expecthash:
                 self.ui.warn(
-                    _('changeset %s: %s: contents differ\n'
-                      '  (%s:\n'
-                      '  expected hash %s,\n'
-                      '  but got %s)\n')
-                    % (cset, filename, storepath, expecthash, actualhash))
+                    _('changeset %s: %s references corrupted %s\n')
+                    % (cset, filename, storepath))
                 return True             # failed
         return False
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1202,8 +1202,7 @@ 
   checking files
   10 files, 10 changesets, 28 total revisions
   searching 1 changesets for largefiles
-  changeset 9:598410d3eb9a: sub/large4 missing
-    (looked for hash e166e74c7303192238d60af5a9c4ce9bef0b7928)
+  changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
   verified existence of 3 revisions of 3 largefiles
   [1]
 
@@ -1211,10 +1210,7 @@ 
   $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
   $ hg verify -q --large --lfc
   searching 1 changesets for largefiles
-  changeset 9:598410d3eb9a: sub/large4: contents differ
-    ($TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928:
-    expected hash e166e74c7303192238d60af5a9c4ce9bef0b7928,
-    but got 1f19b76d5b3cad1472c87efb42b582c97e040060)
+  changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
   verified contents of 3 revisions of 3 largefiles
   [1]
 
@@ -1225,28 +1221,13 @@ 
   $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
   $ hg verify -q --large --lfa --lfc
   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 1:ce8896473775: sub/large2: contents differ
-    ($TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4:
-    expected hash eb7338044dc27f9bc59b8dd5a246b065ead7a9c4,
-    but got cfef678f24d3e339944138ecdd8fd85ca21d820f)
-  changeset 3:9e8fbc4bce62: large1: contents differ
-    ($TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4:
-    expected hash eb7338044dc27f9bc59b8dd5a246b065ead7a9c4,
-    but got cfef678f24d3e339944138ecdd8fd85ca21d820f)
-  changeset 4:74c02385b94c: large3: contents differ
-    ($TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4:
-    expected hash eb7338044dc27f9bc59b8dd5a246b065ead7a9c4,
-    but got cfef678f24d3e339944138ecdd8fd85ca21d820f)
-  changeset 4:74c02385b94c: sub/large4: contents differ
-    ($TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4:
-    expected hash eb7338044dc27f9bc59b8dd5a246b065ead7a9c4,
-    but got cfef678f24d3e339944138ecdd8fd85ca21d820f)
+  changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64
+  changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d
+  changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f
+  changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
+  changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
+  changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
+  changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
   verified contents of 15 revisions of 6 largefiles
   [1]
 
diff --git a/tests/test-lfconvert.t b/tests/test-lfconvert.t
--- a/tests/test-lfconvert.t
+++ b/tests/test-lfconvert.t
@@ -317,18 +317,12 @@ 
   checking files
   8 files, 7 changesets, 12 total revisions
   searching 7 changesets for largefiles
-  changeset 0:d4892ec57ce2: large missing
-    (looked for hash 2e000fa7e85759c7f4c254d4d9c33ef481e459a7)
-  changeset 1:334e5237836d: sub/maybelarge.dat missing
-    (looked for hash 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c)
-  changeset 2:261ad3f3f037: stuff/maybelarge.dat missing
-    (looked for hash 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c)
-  changeset 3:55759520c76f: sub/maybelarge.dat missing
-    (looked for hash 76236b6a2c6102826c61af4297dd738fb3b1de38)
-  changeset 5:9cc5aa7204f0: stuff/maybelarge.dat missing
-    (looked for hash 76236b6a2c6102826c61af4297dd738fb3b1de38)
-  changeset 6:17126745edfd: anotherlarge missing
-    (looked for hash 3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3)
+  changeset 0:d4892ec57ce2: large references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/2e000fa7e85759c7f4c254d4d9c33ef481e459a7
+  changeset 1:334e5237836d: sub/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
+  changeset 2:261ad3f3f037: stuff/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
+  changeset 3:55759520c76f: sub/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/76236b6a2c6102826c61af4297dd738fb3b1de38
+  changeset 5:9cc5aa7204f0: stuff/maybelarge.dat references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/76236b6a2c6102826c61af4297dd738fb3b1de38
+  changeset 6:17126745edfd: anotherlarge references missing $TESTTMP/largefiles-repo-hg/.hg/largefiles/3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3
   verified existence of 6 revisions of 4 largefiles
   [1]
   $ hg -R largefiles-repo-hg showconfig paths