84 def putlfile(self, sha, fd): |
84 def putlfile(self, sha, fd): |
85 # unfortunately, httprepository._callpush tries to convert its |
85 # unfortunately, httprepository._callpush tries to convert its |
86 # input file-like into a bundle before sending it, so we can't use |
86 # input file-like into a bundle before sending it, so we can't use |
87 # it ... |
87 # it ... |
88 if issubclass(self.__class__, httppeer.httppeer): |
88 if issubclass(self.__class__, httppeer.httppeer): |
89 res = None |
89 res = self._call('putlfile', data=fd, sha=sha, |
|
90 headers={'content-type':'application/mercurial-0.1'}) |
90 try: |
91 try: |
91 res = self._call('putlfile', data=fd, sha=sha, |
|
92 headers={'content-type':'application/mercurial-0.1'}) |
|
93 d, output = res.split('\n', 1) |
92 d, output = res.split('\n', 1) |
94 for l in output.splitlines(True): |
93 for l in output.splitlines(True): |
95 self.ui.warn(_('remote: '), l) # assume l ends with \n |
94 self.ui.warn(_('remote: '), l) # assume l ends with \n |
96 return int(d) |
95 return int(d) |
97 except (ValueError, urllib2.HTTPError): |
96 except ValueError: |
98 self.ui.warn(_('unexpected putlfile response: %r\n') % res) |
97 self.ui.warn(_('unexpected putlfile response: %r\n') % res) |
99 return 1 |
98 return 1 |
100 # ... but we can't use sshrepository._call because the data= |
99 # ... but we can't use sshrepository._call because the data= |
101 # argument won't get sent, and _callpush does exactly what we want |
100 # argument won't get sent, and _callpush does exactly what we want |
102 # in this case: send the data straight through |
101 # in this case: send the data straight through |