##// END OF EJS Templates
clone: do not make streaming default. add --stream option instead.
Vadim Gelfer -
r2613:479e26af default
parent child Browse files
Show More
@@ -959,6 +959,7 b' def clone(ui, source, dest=None, **opts)'
959 ui.setconfig_remoteopts(**opts)
959 ui.setconfig_remoteopts(**opts)
960 hg.clone(ui, ui.expandpath(source), dest,
960 hg.clone(ui, ui.expandpath(source), dest,
961 pull=opts['pull'],
961 pull=opts['pull'],
962 stream=opts['stream'],
962 rev=opts['rev'],
963 rev=opts['rev'],
963 update=not opts['noupdate'])
964 update=not opts['noupdate'])
964
965
@@ -2850,6 +2851,7 b' table = {'
2850 ('r', 'rev', [],
2851 ('r', 'rev', [],
2851 _('a changeset you would like to have after cloning')),
2852 _('a changeset you would like to have after cloning')),
2852 ('', 'pull', None, _('use pull protocol to copy metadata')),
2853 ('', 'pull', None, _('use pull protocol to copy metadata')),
2854 ('', 'stream', None, _('use streaming protocol (fast over LAN)')),
2853 ('e', 'ssh', '', _('specify ssh command to use')),
2855 ('e', 'ssh', '', _('specify ssh command to use')),
2854 ('', 'remotecmd', '',
2856 ('', 'remotecmd', '',
2855 _('specify hg command to run on the remote side'))],
2857 _('specify hg command to run on the remote side'))],
@@ -74,7 +74,8 b' def repository(ui, path=None, create=0):'
74 scheme)
74 scheme)
75 return ctor(ui, path)
75 return ctor(ui, path)
76
76
77 def clone(ui, source, dest=None, pull=False, rev=None, update=True):
77 def clone(ui, source, dest=None, pull=False, rev=None, update=True,
78 stream=False):
78 """Make a copy of an existing repository.
79 """Make a copy of an existing repository.
79
80
80 Create a copy of an existing repository in a new directory. The
81 Create a copy of an existing repository in a new directory. The
@@ -96,6 +97,8 b' def clone(ui, source, dest=None, pull=Fa'
96
97
97 pull: always pull from source repository, even in local case
98 pull: always pull from source repository, even in local case
98
99
100 stream: stream from repository (fast over LAN, slow over WAN)
101
99 rev: revision to clone up to (implies pull=True)
102 rev: revision to clone up to (implies pull=True)
100
103
101 update: update working directory after clone completes, if
104 update: update working directory after clone completes, if
@@ -179,7 +182,7 b' def clone(ui, source, dest=None, pull=Fa'
179 revs = [src_repo.lookup(r) for r in rev]
182 revs = [src_repo.lookup(r) for r in rev]
180
183
181 if dest_repo.local():
184 if dest_repo.local():
182 dest_repo.clone(src_repo, heads=revs, pull=pull)
185 dest_repo.clone(src_repo, heads=revs, stream=stream)
183 elif src_repo.local():
186 elif src_repo.local():
184 src_repo.push(dest_repo, revs=revs)
187 src_repo.push(dest_repo, revs=revs)
185 else:
188 else:
@@ -2225,9 +2225,8 b' class localrepository(repo.repository):'
2225 self.reload()
2225 self.reload()
2226 return len(self.heads()) + 1
2226 return len(self.heads()) + 1
2227
2227
2228 def clone(self, remote, heads=[], pull=False):
2228 def clone(self, remote, heads=[], stream=False):
2229 '''clone remote repository.
2229 '''clone remote repository.
2230 if possible, changes are streamed from remote server.
2231
2230
2232 keyword arguments:
2231 keyword arguments:
2233 heads: list of revs to clone (forces use of pull)
2232 heads: list of revs to clone (forces use of pull)
@@ -2240,7 +2239,7 b' class localrepository(repo.repository):'
2240 # and format flags on "stream" capability, and stream only if
2239 # and format flags on "stream" capability, and stream only if
2241 # compatible.
2240 # compatible.
2242
2241
2243 if not pull and not heads and remote.capable('stream'):
2242 if stream and not heads and remote.capable('stream'):
2244 return self.stream_in(remote)
2243 return self.stream_in(remote)
2245 return self.pull(remote, heads)
2244 return self.pull(remote, heads)
2246
2245
@@ -12,7 +12,7 b' cat hg.pid >> $DAEMON_PIDS'
12 cd ..
12 cd ..
13
13
14 echo % clone via stream
14 echo % clone via stream
15 http_proxy= hg clone http://localhost:20059/ copy 2>&1 | \
15 http_proxy= hg clone --stream http://localhost:20059/ copy 2>&1 | \
16 sed -e 's/[0-9][0-9.]*/XXX/g'
16 sed -e 's/[0-9][0-9.]*/XXX/g'
17 cd copy
17 cd copy
18 hg verify
18 hg verify
@@ -20,6 +20,6 b' hg verify'
20 cd ..
20 cd ..
21
21
22 echo % clone via pull
22 echo % clone via pull
23 http_proxy= hg clone --pull http://localhost:20059/ copy-pull
23 http_proxy= hg clone http://localhost:20059/ copy-pull
24 cd copy-pull
24 cd copy-pull
25 hg verify
25 hg verify
@@ -14,26 +14,26 b' cat proxy.pid >> $DAEMON_PIDS'
14 sleep 2
14 sleep 2
15
15
16 echo %% url for proxy, stream
16 echo %% url for proxy, stream
17 http_proxy=http://localhost:20060/ hg --config http_proxy.always=True clone http://localhost:20059/ b | \
17 http_proxy=http://localhost:20060/ hg --config http_proxy.always=True clone --stream http://localhost:20059/ b | \
18 sed -e 's/[0-9][0-9.]*/XXX/g'
18 sed -e 's/[0-9][0-9.]*/XXX/g'
19 cd b
19 cd b
20 hg verify
20 hg verify
21 cd ..
21 cd ..
22
22
23 echo %% url for proxy, pull
23 echo %% url for proxy, pull
24 http_proxy=http://localhost:20060/ hg --config http_proxy.always=True clone --pull http://localhost:20059/ b-pull
24 http_proxy=http://localhost:20060/ hg --config http_proxy.always=True clone http://localhost:20059/ b-pull
25 cd b-pull
25 cd b-pull
26 hg verify
26 hg verify
27 cd ..
27 cd ..
28
28
29 echo %% host:port for proxy
29 echo %% host:port for proxy
30 http_proxy=localhost:20060 hg clone --pull --config http_proxy.always=True http://localhost:20059/ c
30 http_proxy=localhost:20060 hg clone --config http_proxy.always=True http://localhost:20059/ c
31
31
32 echo %% proxy url with user name and password
32 echo %% proxy url with user name and password
33 http_proxy=http://user:passwd@localhost:20060 hg clone --pull --config http_proxy.always=True http://localhost:20059/ d
33 http_proxy=http://user:passwd@localhost:20060 hg clone --config http_proxy.always=True http://localhost:20059/ d
34
34
35 echo %% url with user name and password
35 echo %% url with user name and password
36 http_proxy=http://user:passwd@localhost:20060 hg clone --pull --config http_proxy.always=True http://user:passwd@localhost:20059/ e
36 http_proxy=http://user:passwd@localhost:20060 hg clone --config http_proxy.always=True http://user:passwd@localhost:20059/ e
37
37
38 echo %% bad host:port for proxy
38 echo %% bad host:port for proxy
39 http_proxy=localhost:20061 hg clone --config http_proxy.always=True http://localhost:20059/ f
39 http_proxy=localhost:20061 hg clone --config http_proxy.always=True http://localhost:20059/ f
@@ -31,14 +31,14 b' hg ci -A -m "init" -d "1000000 0" foo'
31 cd ..
31 cd ..
32
32
33 echo "# clone remote via stream"
33 echo "# clone remote via stream"
34 hg clone -e ./dummyssh ssh://user@dummy/remote local-stream 2>&1 | \
34 hg clone -e ./dummyssh --stream ssh://user@dummy/remote local-stream 2>&1 | \
35 sed -e 's/[0-9][0-9.]*/XXX/g'
35 sed -e 's/[0-9][0-9.]*/XXX/g'
36 cd local-stream
36 cd local-stream
37 hg verify
37 hg verify
38 cd ..
38 cd ..
39
39
40 echo "# clone remote via pull"
40 echo "# clone remote via pull"
41 hg clone -e ./dummyssh --pull ssh://user@dummy/remote local
41 hg clone -e ./dummyssh ssh://user@dummy/remote local
42
42
43 echo "# verify"
43 echo "# verify"
44 cd local
44 cd local
General Comments 0
You need to be logged in to leave comments. Login now