##// END OF EJS Templates
largefiles: don't verify largefile hashes on servers when processing statlfile...
Mads Kiilerich -
r18488:a977b42d stable
parent child Browse files
Show More
@@ -63,18 +63,16 b' def getlfile(repo, proto, sha):'
63 return wireproto.streamres(generator())
63 return wireproto.streamres(generator())
64
64
65 def statlfile(repo, proto, sha):
65 def statlfile(repo, proto, sha):
66 '''Return '2\n' if the largefile is missing, '1\n' if it has a
66 '''Return '2\n' if the largefile is missing, '0\n' if it seems to be in
67 mismatched checksum, or '0\n' if it is in good condition'''
67 good condition.
68
69 The value 1 is reserved for mismatched checksum, but that is too expensive
70 to be verified on every stat and must be caught be running 'hg verify'
71 server side.'''
68 filename = lfutil.findfile(repo, sha)
72 filename = lfutil.findfile(repo, sha)
69 if not filename:
73 if not filename:
70 return '2\n'
74 return '2\n'
71 fd = None
75 return '0\n'
72 try:
73 fd = open(filename, 'rb')
74 return lfutil.hexsha1(fd) == sha and '0\n' or '1\n'
75 finally:
76 if fd:
77 fd.close()
78
76
79 def wirereposetup(ui, repo):
77 def wirereposetup(ui, repo):
80 class lfileswirerepository(repo.__class__):
78 class lfileswirerepository(repo.__class__):
@@ -1593,7 +1593,7 b' Corrupt the cached largefile in r7 and m'
1593 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
1593 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
1594 [255]
1594 [255]
1595 $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1595 $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1596 Push of file that exists on server but is corrupted - magic healing is nice ... but too magic
1596 Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic
1597 $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1597 $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1598 $ hg push -R r7 http://localhost:$HGPORT1
1598 $ hg push -R r7 http://localhost:$HGPORT1
1599 pushing to http://localhost:$HGPORT1/
1599 pushing to http://localhost:$HGPORT1/
@@ -1604,7 +1604,7 b' Push of file that exists on server but i'
1604 remote: adding file changes
1604 remote: adding file changes
1605 remote: added 2 changesets with 2 changes to 2 files
1605 remote: added 2 changesets with 2 changes to 2 files
1606 $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1606 $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8
1607 c2
1607 server side corruption
1608 $ rm -rf empty
1608 $ rm -rf empty
1609
1609
1610 Push a largefiles repository to a served empty repository
1610 Push a largefiles repository to a served empty repository
@@ -1670,8 +1670,9 b' largefiles pulled on update - a largefil'
1670 $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
1670 $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
1671 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1671 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1672 getting changed largefiles
1672 getting changed largefiles
1673 abort: remotestore: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 is invalid
1673 f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
1674 [255]
1674 0 largefiles updated, 0 removed
1675 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1675 $ hg -R http-clone st
1676 $ hg -R http-clone st
1676 ! f1
1677 ! f1
1677 $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1678 $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
@@ -1684,9 +1685,7 b' largefiles pulled on update - a largefil'
1684 checking files
1685 checking files
1685 1 files, 1 changesets, 1 total revisions
1686 1 files, 1 changesets, 1 total revisions
1686 searching 1 changesets for largefiles
1687 searching 1 changesets for largefiles
1687 changeset 0:cf03e5bb9936: f1: contents differ
1688 verified contents of 1 revisions of 1 largefiles
1688 verified contents of 1 revisions of 1 largefiles
1689 [1]
1690 $ hg -R http-clone up -Cqr null
1689 $ hg -R http-clone up -Cqr null
1691
1690
1692 largefiles pulled on update - no server side problems:
1691 largefiles pulled on update - no server side problems:
General Comments 0
You need to be logged in to leave comments. Login now