Mercurial > hg-stable
changeset 2613:479e26afa10f
clone: do not make streaming default. add --stream option instead.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Fri, 14 Jul 2006 14:51:36 -0700 |
parents | ffb895f16925 |
children | 8ba1c31f6864 |
files | mercurial/commands.py mercurial/hg.py mercurial/localrepo.py tests/test-http tests/test-http-proxy tests/test-ssh |
diffstat | 6 files changed, 18 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Jul 14 11:17:22 2006 -0700 +++ b/mercurial/commands.py Fri Jul 14 14:51:36 2006 -0700 @@ -959,6 +959,7 @@ ui.setconfig_remoteopts(**opts) hg.clone(ui, ui.expandpath(source), dest, pull=opts['pull'], + stream=opts['stream'], rev=opts['rev'], update=not opts['noupdate']) @@ -2850,6 +2851,7 @@ ('r', 'rev', [], _('a changeset you would like to have after cloning')), ('', 'pull', None, _('use pull protocol to copy metadata')), + ('', 'stream', None, _('use streaming protocol (fast over LAN)')), ('e', 'ssh', '', _('specify ssh command to use')), ('', 'remotecmd', '', _('specify hg command to run on the remote side'))],
--- a/mercurial/hg.py Fri Jul 14 11:17:22 2006 -0700 +++ b/mercurial/hg.py Fri Jul 14 14:51:36 2006 -0700 @@ -74,7 +74,8 @@ scheme) return ctor(ui, path) -def clone(ui, source, dest=None, pull=False, rev=None, update=True): +def clone(ui, source, dest=None, pull=False, rev=None, update=True, + stream=False): """Make a copy of an existing repository. Create a copy of an existing repository in a new directory. The @@ -96,6 +97,8 @@ pull: always pull from source repository, even in local case + stream: stream from repository (fast over LAN, slow over WAN) + rev: revision to clone up to (implies pull=True) update: update working directory after clone completes, if @@ -179,7 +182,7 @@ revs = [src_repo.lookup(r) for r in rev] if dest_repo.local(): - dest_repo.clone(src_repo, heads=revs, pull=pull) + dest_repo.clone(src_repo, heads=revs, stream=stream) elif src_repo.local(): src_repo.push(dest_repo, revs=revs) else:
--- a/mercurial/localrepo.py Fri Jul 14 11:17:22 2006 -0700 +++ b/mercurial/localrepo.py Fri Jul 14 14:51:36 2006 -0700 @@ -2225,9 +2225,8 @@ self.reload() return len(self.heads()) + 1 - def clone(self, remote, heads=[], pull=False): + def clone(self, remote, heads=[], stream=False): '''clone remote repository. - if possible, changes are streamed from remote server. keyword arguments: heads: list of revs to clone (forces use of pull) @@ -2240,7 +2239,7 @@ # and format flags on "stream" capability, and stream only if # compatible. - if not pull and not heads and remote.capable('stream'): + if stream and not heads and remote.capable('stream'): return self.stream_in(remote) return self.pull(remote, heads)
--- a/tests/test-http Fri Jul 14 11:17:22 2006 -0700 +++ b/tests/test-http Fri Jul 14 14:51:36 2006 -0700 @@ -12,7 +12,7 @@ cd .. echo % clone via stream -http_proxy= hg clone http://localhost:20059/ copy 2>&1 | \ +http_proxy= hg clone --stream http://localhost:20059/ copy 2>&1 | \ sed -e 's/[0-9][0-9.]*/XXX/g' cd copy hg verify @@ -20,6 +20,6 @@ cd .. echo % clone via pull -http_proxy= hg clone --pull http://localhost:20059/ copy-pull +http_proxy= hg clone http://localhost:20059/ copy-pull cd copy-pull hg verify
--- a/tests/test-http-proxy Fri Jul 14 11:17:22 2006 -0700 +++ b/tests/test-http-proxy Fri Jul 14 14:51:36 2006 -0700 @@ -14,26 +14,26 @@ sleep 2 echo %% url for proxy, stream -http_proxy=http://localhost:20060/ hg --config http_proxy.always=True clone http://localhost:20059/ b | \ +http_proxy=http://localhost:20060/ hg --config http_proxy.always=True clone --stream http://localhost:20059/ b | \ sed -e 's/[0-9][0-9.]*/XXX/g' cd b hg verify cd .. echo %% url for proxy, pull -http_proxy=http://localhost:20060/ hg --config http_proxy.always=True clone --pull http://localhost:20059/ b-pull +http_proxy=http://localhost:20060/ hg --config http_proxy.always=True clone http://localhost:20059/ b-pull cd b-pull hg verify cd .. echo %% host:port for proxy -http_proxy=localhost:20060 hg clone --pull --config http_proxy.always=True http://localhost:20059/ c +http_proxy=localhost:20060 hg clone --config http_proxy.always=True http://localhost:20059/ c echo %% proxy url with user name and password -http_proxy=http://user:passwd@localhost:20060 hg clone --pull --config http_proxy.always=True http://localhost:20059/ d +http_proxy=http://user:passwd@localhost:20060 hg clone --config http_proxy.always=True http://localhost:20059/ d echo %% url with user name and password -http_proxy=http://user:passwd@localhost:20060 hg clone --pull --config http_proxy.always=True http://user:passwd@localhost:20059/ e +http_proxy=http://user:passwd@localhost:20060 hg clone --config http_proxy.always=True http://user:passwd@localhost:20059/ e echo %% bad host:port for proxy http_proxy=localhost:20061 hg clone --config http_proxy.always=True http://localhost:20059/ f
--- a/tests/test-ssh Fri Jul 14 11:17:22 2006 -0700 +++ b/tests/test-ssh Fri Jul 14 14:51:36 2006 -0700 @@ -31,14 +31,14 @@ cd .. echo "# clone remote via stream" -hg clone -e ./dummyssh ssh://user@dummy/remote local-stream 2>&1 | \ +hg clone -e ./dummyssh --stream ssh://user@dummy/remote local-stream 2>&1 | \ sed -e 's/[0-9][0-9.]*/XXX/g' cd local-stream hg verify cd .. echo "# clone remote via pull" -hg clone -e ./dummyssh --pull ssh://user@dummy/remote local +hg clone -e ./dummyssh ssh://user@dummy/remote local echo "# verify" cd local