[PATCH 02 of 10 stable] largefiles: adopt verify to batched remote statlfile (issue3780)
Mads Kiilerich
mads at kiilerich.com
Thu Jan 24 23:17:01 CST 2013
# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1359090858 -3600
# Branch stable
# Node ID d956326990d42e04627d0d8077380c6f69921132
# Parent 4ac7648ee50c5a799fec5cd2c48d89b99b6dd044
largefiles: adopt verify to batched remote statlfile (issue3780)
9e1616307c4c introduced batching of statlfile, but not all codepaths got
converted.
'hg verify' with a remotestore could thus crash with
TypeError: 'builtin_function_or_method' object is not iterable
Also, the 'hash' variable was used without assigning to it. Don't use variable
names that collide with Python built-in functions. Instead we use 'expecthash'
as in localstore.
diff --git a/hgext/largefiles/remotestore.py b/hgext/largefiles/remotestore.py
--- a/hgext/largefiles/remotestore.py
+++ b/hgext/largefiles/remotestore.py
@@ -87,7 +87,8 @@
verified.add(key)
- stat = self._stat(hash)
+ expecthash = fctx.data()[0:40]
+ stat = self._stat([expecthash])[expecthash]
if not stat:
return False
elif stat == 1:
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1539,10 +1539,38 @@
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
+ $ [ -f "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
+ $ [ -f empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
-Clone over http, with largefiles being pulled on update, not on clone.
+Clone over http, no largefiles pulled on clone.
- $ hg clone -q http://localhost:$HGPORT2/ http-clone -U
+ $ hg clone http://localhost:$HGPORT2/ http-clone -U
+ requesting all changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 1 changesets with 1 changes to 1 files
+
+verify remotestore verify:
+
+ $ mv "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 .
+ $ rm empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
+ $ hg -R http-clone verify --large --lfa
+ checking changesets
+ checking manifests
+ crosschecking files in changesets and manifests
+ checking files
+ 1 files, 1 changesets, 1 total revisions
+ searching 1 changesets for largefiles
+ changeset 0:cf03e5bb9936: f1 missing
+ verified existence of 1 revisions of 1 largefiles
+ [1]
+ $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 "${USERCACHE}"/
+ $ hg -R http-clone -q verify --large --lfa
+ searching 1 changesets for largefiles
+ verified existence of 1 revisions of 1 largefiles
+
+largefiles pulled on update:
$ hg -R http-clone --debug up --config largefiles.usercache=http-clone-usercache
resolving manifests
@@ -1562,8 +1590,19 @@
1 largefiles updated, 0 removed
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ ls http-clone-usercache/*
- http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90
+undo update and its pull
+ $ hg -R http-clone up -q -r null
+ $ rm http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90
+ $ rm http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
+make largefile missing on server
+ $ rm empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
+ $ rm "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90
+try again and expect error
+ $ hg -R http-clone up
+ getting changed largefiles
+ error getting id 02a439e5c31c526465ab1a0ca1f431f76b827b90 from url http://localhost:$HGPORT2/ for file f1: HTTP Error 500: Internal Server Error
+ 0 largefiles updated, 0 removed
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ rm -rf empty http-clone http-clone-usercache
More information about the Mercurial-devel
mailing list