##// 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 b' def putlfile(repo, proto, sha):'
27 proto.getfile(tmpfp)
27 proto.getfile(tmpfp)
28 tmpfp.seek(0)
28 tmpfp.seek(0)
29 if sha != lfutil.hexsha1(tmpfp):
29 if sha != lfutil.hexsha1(tmpfp):
30 return wireproto.pushres(1)
30 raise IOError(0, _('largefile contents do not match hash'))
31 tmpfp.close()
31 tmpfp.close()
32 lfutil.copytostoreabsolute(repo, tmpname, sha)
32 lfutil.copytostoreabsolute(repo, tmpname, sha)
33 except IOError, e:
33 except IOError, e:
34 repo.ui.warn(_('largefiles: failed to put %s (%s) into store: %s') %
34 repo.ui.warn(_('largefiles: failed to put %s into store: %s') %
35 (sha, tmpname, e.strerror))
35 (sha, e.strerror))
36 return wireproto.pushres(1)
36 return wireproto.pushres(1)
37 finally:
37 finally:
38 tmpfp.close()
38 tmpfp.close()
@@ -81,10 +81,16 b' def wirereposetup(ui, repo):'
81 # input file-like into a bundle before sending it, so we can't use
81 # input file-like into a bundle before sending it, so we can't use
82 # it ...
82 # it ...
83 if issubclass(self.__class__, httprepo.httprepository):
83 if issubclass(self.__class__, httprepo.httprepository):
84 res = None
84 try:
85 try:
85 return int(self._call('putlfile', data=fd, sha=sha,
86 res = self._call('putlfile', data=fd, sha=sha,
86 headers={'content-type':'application/mercurial-0.1'}))
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 except (ValueError, urllib2.HTTPError):
92 except (ValueError, urllib2.HTTPError):
93 self.ui.warn(_('unexpected putlfile response: %s') % res)
88 return 1
94 return 1
89 # ... but we can't use sshrepository._call because the data=
95 # ... but we can't use sshrepository._call because the data=
90 # argument won't get sent, and _callpush does exactly what we want
96 # argument won't get sent, and _callpush does exactly what we want
@@ -1,5 +1,7 b''
1 $ "$TESTDIR/hghave" symlink unix-permissions serve || exit 80
1 $ "$TESTDIR/hghave" symlink unix-permissions serve || exit 80
2
2
3 $ USERCACHE=`pwd`/cache; export USERCACHE
4 $ mkdir -p ${USERCACHE}
3 $ cat >> $HGRCPATH <<EOF
5 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
6 > [extensions]
5 > largefiles=
7 > largefiles=
@@ -11,6 +13,7 b''
11 > [largefiles]
13 > [largefiles]
12 > minsize=2
14 > minsize=2
13 > patterns=glob:**.dat
15 > patterns=glob:**.dat
16 > usercache=${USERCACHE}
14 > EOF
17 > EOF
15
18
16 Create the repo with a couple of revisions of both large and normal
19 Create the repo with a couple of revisions of both large and normal
@@ -824,6 +827,21 b' largefiles clients refuse to push largef'
824 [255]
827 [255]
825 $ cd ..
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 Clone a local repository owned by another user
845 Clone a local repository owned by another user
828 We have to simulate that here by setting $HOME and removing write permissions
846 We have to simulate that here by setting $HOME and removing write permissions
829 $ ORIGHOME="$HOME"
847 $ ORIGHOME="$HOME"
General Comments 0
You need to be logged in to leave comments. Login now