##// END OF EJS Templates
largefiles: display remote errors from putlfile (issue3123) (issue3149)
Kevin Gessner -
r15778:f15c646b default
parent child Browse files
Show More
@@ -27,12 +27,12 def putlfile(repo, proto, sha):
27 27 proto.getfile(tmpfp)
28 28 tmpfp.seek(0)
29 29 if sha != lfutil.hexsha1(tmpfp):
30 return wireproto.pushres(1)
30 raise IOError(0, _('largefile contents do not match hash'))
31 31 tmpfp.close()
32 32 lfutil.copytostoreabsolute(repo, tmpname, sha)
33 33 except IOError, e:
34 repo.ui.warn(_('largefiles: failed to put %s (%s) into store: %s') %
35 (sha, tmpname, e.strerror))
34 repo.ui.warn(_('largefiles: failed to put %s into store: %s') %
35 (sha, e.strerror))
36 36 return wireproto.pushres(1)
37 37 finally:
38 38 tmpfp.close()
@@ -81,10 +81,16 def wirereposetup(ui, repo):
81 81 # input file-like into a bundle before sending it, so we can't use
82 82 # it ...
83 83 if issubclass(self.__class__, httprepo.httprepository):
84 res = None
84 85 try:
85 return int(self._call('putlfile', data=fd, sha=sha,
86 headers={'content-type':'application/mercurial-0.1'}))
86 res = self._call('putlfile', data=fd, sha=sha,
87 headers={'content-type':'application/mercurial-0.1'})
88 d, output = res.split('\n', 1)
89 for l in output.splitlines(True):
90 self.ui.warn(_('remote: '), l, '\n')
91 return int(d)
87 92 except (ValueError, urllib2.HTTPError):
93 self.ui.warn(_('unexpected putlfile response: %s') % res)
88 94 return 1
89 95 # ... but we can't use sshrepository._call because the data=
90 96 # argument won't get sent, and _callpush does exactly what we want
@@ -1,5 +1,7
1 1 $ "$TESTDIR/hghave" symlink unix-permissions serve || exit 80
2 2
3 $ USERCACHE=`pwd`/cache; export USERCACHE
4 $ mkdir -p ${USERCACHE}
3 5 $ cat >> $HGRCPATH <<EOF
4 6 > [extensions]
5 7 > largefiles=
@@ -11,6 +13,7
11 13 > [largefiles]
12 14 > minsize=2
13 15 > patterns=glob:**.dat
16 > usercache=${USERCACHE}
14 17 > EOF
15 18
16 19 Create the repo with a couple of revisions of both large and normal
@@ -824,6 +827,21 largefiles clients refuse to push largef
824 827 [255]
825 828 $ cd ..
826 829
830 putlfile errors are shown (issue3123)
831 Corrupt the cached largefile in r7
832 $ echo corruption > $USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8
833 $ hg init empty
834 $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
835 > --config 'web.allow_push=*' --config web.push_ssl=False
836 $ cat hg.pid >> $DAEMON_PIDS
837 $ hg push -R r7 http://localhost:$HGPORT1
838 pushing to http://localhost:$HGPORT1/
839 searching for changes
840 remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
841 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/
842 [255]
843 $ rm -rf empty
844
827 845 Clone a local repository owned by another user
828 846 We have to simulate that here by setting $HOME and removing write permissions
829 847 $ ORIGHOME="$HOME"
General Comments 0
You need to be logged in to leave comments. Login now