diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py --- a/mercurial/streamclone.py +++ b/mercurial/streamclone.py @@ -132,8 +132,19 @@ repo.ui.status(_('streaming all changes\n')) + narrowsupport = (remote.capable('narrowstream') and + remote.capable('exp-narrow-1')) + if (pullop.includepats or pullop.excludepats) and not narrowsupport: + repo.ui.status(_('server does not support narrow stream clones, cloning' + ' full repository\n')) with remote.commandexecutor() as e: - fp = e.callcommand('stream_out', {}).result() + if narrowsupport: + args = {} + args['includes'] = pullop.includepats + args['excludes'] = pullop.excludepats + fp = e.callcommand('stream_out', args).result() + else: + fp = e.callcommand('stream_out', {}).result() # TODO strictly speaking, this code should all be inside the context # manager because the context manager is supposed to ensure all wire state diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py --- a/mercurial/wireprotov1peer.py +++ b/mercurial/wireprotov1peer.py @@ -409,8 +409,10 @@ self.ui.status(_('remote: '), l) yield d - def stream_out(self): - return self._callstream('stream_out') + def stream_out(self, includes=[], excludes=[]): + i = wireprototypes.encodelist(includes) + e = wireprototypes.encodelist(excludes) + return self._callstream('stream_out', includes=i, excludes=e) def getbundle(self, source, **kwargs): kwargs = pycompat.byteskwargs(kwargs)