##// END OF EJS Templates
wireprotoserver: rename getfile() to forwardpayload() (API)...
Gregory Szorc -
r36087:90ca4986 default
parent child Browse files
Show More
@@ -40,7 +40,7 b' def putlfile(repo, proto, sha):'
40 40 tmpfp = util.atomictempfile(path, createmode=repo.store.createmode)
41 41
42 42 try:
43 proto.getfile(tmpfp)
43 proto.forwardpayload(tmpfp)
44 44 tmpfp._fp.seek(0)
45 45 if sha != lfutil.hexsha1(tmpfp._fp):
46 46 raise IOError(0, _('largefile contents do not match hash'))
@@ -1008,7 +1008,7 b' def unbundle(repo, proto, heads):'
1008 1008 fp = os.fdopen(fd, pycompat.sysstr('wb+'))
1009 1009 r = 0
1010 1010 try:
1011 proto.getfile(fp)
1011 proto.forwardpayload(fp)
1012 1012 fp.seek(0)
1013 1013 gen = exchange.readbundle(repo.ui, fp, None)
1014 1014 if (isinstance(gen, changegroupmod.cg1unpacker)
@@ -64,14 +64,10 b' class baseprotocolhandler(object):'
64 64 returns a list of values (same order as <args>)"""
65 65
66 66 @abc.abstractmethod
67 def getfile(self, fp):
68 """write the whole content of a file into a file like object
67 def forwardpayload(self, fp):
68 """Read the raw payload and forward to a file.
69 69
70 The file is in the form::
71
72 (<chunk-size>\n<chunk>)+0\n
73
74 chunk size is the ascii version of the int.
70 The payload is read in full before the function returns.
75 71 """
76 72
77 73 @abc.abstractmethod
@@ -145,7 +141,7 b' class webproto(baseprotocolhandler):'
145 141 args.update(cgi.parse_qs(argvalue, keep_blank_values=True))
146 142 return args
147 143
148 def getfile(self, fp):
144 def forwardpayload(self, fp):
149 145 length = int(self._req.env[r'CONTENT_LENGTH'])
150 146 # If httppostargs is used, we need to read Content-Length
151 147 # minus the amount that was consumed by args.
@@ -392,7 +388,12 b' class sshv1protocolhandler(baseprotocolh'
392 388 data[arg] = val
393 389 return [data[k] for k in keys]
394 390
395 def getfile(self, fpout):
391 def forwardpayload(self, fpout):
392 # The file is in the form:
393 #
394 # <chunk size>\n<chunk>
395 # ...
396 # 0\n
396 397 _sshv1respondbytes(self._fout, b'')
397 398 count = int(self._fin.readline())
398 399 while count:
General Comments 0
You need to be logged in to leave comments. Login now