Patchwork [01,of,10,stable] largefiles: let wirestore._stat return stats as expected by remotestore verify

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 25, 2013, 5:17 a.m.
Message ID <4ac7648ee50c5a799fec.1359091020@mk-desktop>
Download mbox | patch
Permalink /patch/723/
State Accepted
Commit ed647c59753baaa7fc6da5c2d0f88672cf187a37
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 4ac7648ee50c5a799fec5cd2c48d89b99b6dd044
# Parent  692cbda1eb50fe30c70792cb1e9380b28769467c
largefiles: let wirestore._stat return stats as expected by remotestore verify

- preparing for fixing verify crash.

Patch

diff --git a/hgext/largefiles/remotestore.py b/hgext/largefiles/remotestore.py
--- a/hgext/largefiles/remotestore.py
+++ b/hgext/largefiles/remotestore.py
@@ -74,7 +74,7 @@ 
         return lfutil.copyandhash(lfutil.blockstream(infile), tmpfile)
 
     def _verify(self, hashes):
-        return self._stat(hashes)
+        return dict((h, s == 0) for (h, s) in self._stat(hashes).iteritems())
 
     def _verifyfile(self, cctx, cset, contents, standin, verified):
         filename = lfutil.splitstandin(standin)
diff --git a/hgext/largefiles/wirestore.py b/hgext/largefiles/wirestore.py
--- a/hgext/largefiles/wirestore.py
+++ b/hgext/largefiles/wirestore.py
@@ -26,6 +26,8 @@ 
         return self.remote.getlfile(hash)
 
     def _stat(self, hashes):
+        '''For each hash, return 2 if the largefile is missing, 1 if it has a
+        mismatched checksum, or 0 if it is in good condition'''
         batch = self.remote.batch()
         futures = {}
         for hash in hashes:
@@ -33,5 +35,5 @@ 
         batch.submit()
         retval = {}
         for hash in hashes:
-            retval[hash] = not futures[hash].value
+            retval[hash] = futures[hash].value
         return retval