diff --git a/remotefilelog/fileserverclient.py b/remotefilelog/fileserverclient.py --- a/remotefilelog/fileserverclient.py +++ b/remotefilelog/fileserverclient.py @@ -218,7 +218,7 @@ progresstick() def _getfiles( - remote, receivemissing, progresstick, missed, idmap, step): + remote, receivemissing, progresstick, missed, idmap, bufsize): remote._callstream("getfiles") i = 0 pipeo = shallowutil.trygetattr(remote, ('_pipeo', 'pipeo')) @@ -226,18 +226,21 @@ while i < len(missed): # issue a batch of requests start = i - end = min(len(missed), start + step) - i = end - for missingid in missed[start:end]: - # issue new request + written = 0 + while i < len(missed): + missingid = missed[i] versionid = missingid[-40:] file = idmap[missingid] sshrequest = "%s%s\n" % (versionid, file) + if len(sshrequest) > bufsize - written: + break pipeo.write(sshrequest) + i = i + 1 + written += len(sshrequest) pipeo.flush() # receive batch results - for missingid in missed[start:end]: + for missingid in missed[start:i]: versionid = missingid[-40:] file = idmap[missingid] receivemissing(pipei, file, versionid) @@ -363,10 +366,16 @@ if not isinstance(remote, sshpeer.sshpeer): raise error.Abort('remotefilelog requires ssh ' 'servers') - step = self.ui.configint('remotefilelog', - 'getfilesstep', 10000) + # by default, Linux has a pipe capacity of 65536, + # while Windows - 4096. However, Windows pipe + # buffer size is now configurable + bufsize = 65536 + if os.name == 'nt': + bufsize = self.ui.configint('experimental', + 'winpipebufsize', + 4096) _getfiles(remote, self.receivemissing, progresstick, - missed, idmap, step) + missed, idmap, bufsize) elif remote.capable("getfile"): if remote.capable('batch'): batchdefault = 100 diff --git a/tests/test-check-config-hg.t b/tests/test-check-config-hg.t --- a/tests/test-check-config-hg.t +++ b/tests/test-check-config-hg.t @@ -59,7 +59,6 @@ undocumented: remotefilelog.fastdatapack (bool) undocumented: remotefilelog.fetchpacks (bool) undocumented: remotefilelog.fetchwarning (str) - undocumented: remotefilelog.getfilesstep (int) [10000] undocumented: remotefilelog.history.gencountlimit (int) [2] undocumented: remotefilelog.includepattern (list) undocumented: remotefilelog.pullprefetch (str)