##// END OF EJS Templates
errors: use InputError for some errors on `hg clone`...
Martin von Zweigbergk -
r46451:d6861895 default
parent child Browse files
Show More
@@ -1,1482 +1,1482 b''
1 # hg.py - repository classes for mercurial
1 # hg.py - repository classes for mercurial
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
4 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
5 #
5 #
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 from __future__ import absolute_import
9 from __future__ import absolute_import
10
10
11 import errno
11 import errno
12 import os
12 import os
13 import shutil
13 import shutil
14 import stat
14 import stat
15
15
16 from .i18n import _
16 from .i18n import _
17 from .node import nullid
17 from .node import nullid
18 from .pycompat import getattr
18 from .pycompat import getattr
19
19
20 from . import (
20 from . import (
21 bookmarks,
21 bookmarks,
22 bundlerepo,
22 bundlerepo,
23 cacheutil,
23 cacheutil,
24 cmdutil,
24 cmdutil,
25 destutil,
25 destutil,
26 discovery,
26 discovery,
27 error,
27 error,
28 exchange,
28 exchange,
29 extensions,
29 extensions,
30 httppeer,
30 httppeer,
31 localrepo,
31 localrepo,
32 lock,
32 lock,
33 logcmdutil,
33 logcmdutil,
34 logexchange,
34 logexchange,
35 merge as mergemod,
35 merge as mergemod,
36 mergestate as mergestatemod,
36 mergestate as mergestatemod,
37 narrowspec,
37 narrowspec,
38 node,
38 node,
39 phases,
39 phases,
40 pycompat,
40 pycompat,
41 requirements,
41 requirements,
42 scmutil,
42 scmutil,
43 sshpeer,
43 sshpeer,
44 statichttprepo,
44 statichttprepo,
45 ui as uimod,
45 ui as uimod,
46 unionrepo,
46 unionrepo,
47 url,
47 url,
48 util,
48 util,
49 verify as verifymod,
49 verify as verifymod,
50 vfs as vfsmod,
50 vfs as vfsmod,
51 )
51 )
52 from .utils import hashutil
52 from .utils import hashutil
53
53
54 release = lock.release
54 release = lock.release
55
55
56 # shared features
56 # shared features
57 sharedbookmarks = b'bookmarks'
57 sharedbookmarks = b'bookmarks'
58
58
59
59
60 def _local(path):
60 def _local(path):
61 path = util.expandpath(util.urllocalpath(path))
61 path = util.expandpath(util.urllocalpath(path))
62
62
63 try:
63 try:
64 # we use os.stat() directly here instead of os.path.isfile()
64 # we use os.stat() directly here instead of os.path.isfile()
65 # because the latter started returning `False` on invalid path
65 # because the latter started returning `False` on invalid path
66 # exceptions starting in 3.8 and we care about handling
66 # exceptions starting in 3.8 and we care about handling
67 # invalid paths specially here.
67 # invalid paths specially here.
68 st = os.stat(path)
68 st = os.stat(path)
69 isfile = stat.S_ISREG(st.st_mode)
69 isfile = stat.S_ISREG(st.st_mode)
70 # Python 2 raises TypeError, Python 3 ValueError.
70 # Python 2 raises TypeError, Python 3 ValueError.
71 except (TypeError, ValueError) as e:
71 except (TypeError, ValueError) as e:
72 raise error.Abort(
72 raise error.Abort(
73 _(b'invalid path %s: %s') % (path, pycompat.bytestr(e))
73 _(b'invalid path %s: %s') % (path, pycompat.bytestr(e))
74 )
74 )
75 except OSError:
75 except OSError:
76 isfile = False
76 isfile = False
77
77
78 return isfile and bundlerepo or localrepo
78 return isfile and bundlerepo or localrepo
79
79
80
80
81 def addbranchrevs(lrepo, other, branches, revs):
81 def addbranchrevs(lrepo, other, branches, revs):
82 peer = other.peer() # a courtesy to callers using a localrepo for other
82 peer = other.peer() # a courtesy to callers using a localrepo for other
83 hashbranch, branches = branches
83 hashbranch, branches = branches
84 if not hashbranch and not branches:
84 if not hashbranch and not branches:
85 x = revs or None
85 x = revs or None
86 if revs:
86 if revs:
87 y = revs[0]
87 y = revs[0]
88 else:
88 else:
89 y = None
89 y = None
90 return x, y
90 return x, y
91 if revs:
91 if revs:
92 revs = list(revs)
92 revs = list(revs)
93 else:
93 else:
94 revs = []
94 revs = []
95
95
96 if not peer.capable(b'branchmap'):
96 if not peer.capable(b'branchmap'):
97 if branches:
97 if branches:
98 raise error.Abort(_(b"remote branch lookup not supported"))
98 raise error.Abort(_(b"remote branch lookup not supported"))
99 revs.append(hashbranch)
99 revs.append(hashbranch)
100 return revs, revs[0]
100 return revs, revs[0]
101
101
102 with peer.commandexecutor() as e:
102 with peer.commandexecutor() as e:
103 branchmap = e.callcommand(b'branchmap', {}).result()
103 branchmap = e.callcommand(b'branchmap', {}).result()
104
104
105 def primary(branch):
105 def primary(branch):
106 if branch == b'.':
106 if branch == b'.':
107 if not lrepo:
107 if not lrepo:
108 raise error.Abort(_(b"dirstate branch not accessible"))
108 raise error.Abort(_(b"dirstate branch not accessible"))
109 branch = lrepo.dirstate.branch()
109 branch = lrepo.dirstate.branch()
110 if branch in branchmap:
110 if branch in branchmap:
111 revs.extend(node.hex(r) for r in reversed(branchmap[branch]))
111 revs.extend(node.hex(r) for r in reversed(branchmap[branch]))
112 return True
112 return True
113 else:
113 else:
114 return False
114 return False
115
115
116 for branch in branches:
116 for branch in branches:
117 if not primary(branch):
117 if not primary(branch):
118 raise error.RepoLookupError(_(b"unknown branch '%s'") % branch)
118 raise error.RepoLookupError(_(b"unknown branch '%s'") % branch)
119 if hashbranch:
119 if hashbranch:
120 if not primary(hashbranch):
120 if not primary(hashbranch):
121 revs.append(hashbranch)
121 revs.append(hashbranch)
122 return revs, revs[0]
122 return revs, revs[0]
123
123
124
124
125 def parseurl(path, branches=None):
125 def parseurl(path, branches=None):
126 '''parse url#branch, returning (url, (branch, branches))'''
126 '''parse url#branch, returning (url, (branch, branches))'''
127
127
128 u = util.url(path)
128 u = util.url(path)
129 branch = None
129 branch = None
130 if u.fragment:
130 if u.fragment:
131 branch = u.fragment
131 branch = u.fragment
132 u.fragment = None
132 u.fragment = None
133 return bytes(u), (branch, branches or [])
133 return bytes(u), (branch, branches or [])
134
134
135
135
136 schemes = {
136 schemes = {
137 b'bundle': bundlerepo,
137 b'bundle': bundlerepo,
138 b'union': unionrepo,
138 b'union': unionrepo,
139 b'file': _local,
139 b'file': _local,
140 b'http': httppeer,
140 b'http': httppeer,
141 b'https': httppeer,
141 b'https': httppeer,
142 b'ssh': sshpeer,
142 b'ssh': sshpeer,
143 b'static-http': statichttprepo,
143 b'static-http': statichttprepo,
144 }
144 }
145
145
146
146
147 def _peerlookup(path):
147 def _peerlookup(path):
148 u = util.url(path)
148 u = util.url(path)
149 scheme = u.scheme or b'file'
149 scheme = u.scheme or b'file'
150 thing = schemes.get(scheme) or schemes[b'file']
150 thing = schemes.get(scheme) or schemes[b'file']
151 try:
151 try:
152 return thing(path)
152 return thing(path)
153 except TypeError:
153 except TypeError:
154 # we can't test callable(thing) because 'thing' can be an unloaded
154 # we can't test callable(thing) because 'thing' can be an unloaded
155 # module that implements __call__
155 # module that implements __call__
156 if not util.safehasattr(thing, b'instance'):
156 if not util.safehasattr(thing, b'instance'):
157 raise
157 raise
158 return thing
158 return thing
159
159
160
160
161 def islocal(repo):
161 def islocal(repo):
162 '''return true if repo (or path pointing to repo) is local'''
162 '''return true if repo (or path pointing to repo) is local'''
163 if isinstance(repo, bytes):
163 if isinstance(repo, bytes):
164 try:
164 try:
165 return _peerlookup(repo).islocal(repo)
165 return _peerlookup(repo).islocal(repo)
166 except AttributeError:
166 except AttributeError:
167 return False
167 return False
168 return repo.local()
168 return repo.local()
169
169
170
170
171 def openpath(ui, path, sendaccept=True):
171 def openpath(ui, path, sendaccept=True):
172 '''open path with open if local, url.open if remote'''
172 '''open path with open if local, url.open if remote'''
173 pathurl = util.url(path, parsequery=False, parsefragment=False)
173 pathurl = util.url(path, parsequery=False, parsefragment=False)
174 if pathurl.islocal():
174 if pathurl.islocal():
175 return util.posixfile(pathurl.localpath(), b'rb')
175 return util.posixfile(pathurl.localpath(), b'rb')
176 else:
176 else:
177 return url.open(ui, path, sendaccept=sendaccept)
177 return url.open(ui, path, sendaccept=sendaccept)
178
178
179
179
180 # a list of (ui, repo) functions called for wire peer initialization
180 # a list of (ui, repo) functions called for wire peer initialization
181 wirepeersetupfuncs = []
181 wirepeersetupfuncs = []
182
182
183
183
184 def _peerorrepo(
184 def _peerorrepo(
185 ui, path, create=False, presetupfuncs=None, intents=None, createopts=None
185 ui, path, create=False, presetupfuncs=None, intents=None, createopts=None
186 ):
186 ):
187 """return a repository object for the specified path"""
187 """return a repository object for the specified path"""
188 obj = _peerlookup(path).instance(
188 obj = _peerlookup(path).instance(
189 ui, path, create, intents=intents, createopts=createopts
189 ui, path, create, intents=intents, createopts=createopts
190 )
190 )
191 ui = getattr(obj, "ui", ui)
191 ui = getattr(obj, "ui", ui)
192 for f in presetupfuncs or []:
192 for f in presetupfuncs or []:
193 f(ui, obj)
193 f(ui, obj)
194 ui.log(b'extension', b'- executing reposetup hooks\n')
194 ui.log(b'extension', b'- executing reposetup hooks\n')
195 with util.timedcm('all reposetup') as allreposetupstats:
195 with util.timedcm('all reposetup') as allreposetupstats:
196 for name, module in extensions.extensions(ui):
196 for name, module in extensions.extensions(ui):
197 ui.log(b'extension', b' - running reposetup for %s\n', name)
197 ui.log(b'extension', b' - running reposetup for %s\n', name)
198 hook = getattr(module, 'reposetup', None)
198 hook = getattr(module, 'reposetup', None)
199 if hook:
199 if hook:
200 with util.timedcm('reposetup %r', name) as stats:
200 with util.timedcm('reposetup %r', name) as stats:
201 hook(ui, obj)
201 hook(ui, obj)
202 ui.log(
202 ui.log(
203 b'extension', b' > reposetup for %s took %s\n', name, stats
203 b'extension', b' > reposetup for %s took %s\n', name, stats
204 )
204 )
205 ui.log(b'extension', b'> all reposetup took %s\n', allreposetupstats)
205 ui.log(b'extension', b'> all reposetup took %s\n', allreposetupstats)
206 if not obj.local():
206 if not obj.local():
207 for f in wirepeersetupfuncs:
207 for f in wirepeersetupfuncs:
208 f(ui, obj)
208 f(ui, obj)
209 return obj
209 return obj
210
210
211
211
212 def repository(
212 def repository(
213 ui,
213 ui,
214 path=b'',
214 path=b'',
215 create=False,
215 create=False,
216 presetupfuncs=None,
216 presetupfuncs=None,
217 intents=None,
217 intents=None,
218 createopts=None,
218 createopts=None,
219 ):
219 ):
220 """return a repository object for the specified path"""
220 """return a repository object for the specified path"""
221 peer = _peerorrepo(
221 peer = _peerorrepo(
222 ui,
222 ui,
223 path,
223 path,
224 create,
224 create,
225 presetupfuncs=presetupfuncs,
225 presetupfuncs=presetupfuncs,
226 intents=intents,
226 intents=intents,
227 createopts=createopts,
227 createopts=createopts,
228 )
228 )
229 repo = peer.local()
229 repo = peer.local()
230 if not repo:
230 if not repo:
231 raise error.Abort(
231 raise error.Abort(
232 _(b"repository '%s' is not local") % (path or peer.url())
232 _(b"repository '%s' is not local") % (path or peer.url())
233 )
233 )
234 return repo.filtered(b'visible')
234 return repo.filtered(b'visible')
235
235
236
236
237 def peer(uiorrepo, opts, path, create=False, intents=None, createopts=None):
237 def peer(uiorrepo, opts, path, create=False, intents=None, createopts=None):
238 '''return a repository peer for the specified path'''
238 '''return a repository peer for the specified path'''
239 rui = remoteui(uiorrepo, opts)
239 rui = remoteui(uiorrepo, opts)
240 return _peerorrepo(
240 return _peerorrepo(
241 rui, path, create, intents=intents, createopts=createopts
241 rui, path, create, intents=intents, createopts=createopts
242 ).peer()
242 ).peer()
243
243
244
244
245 def defaultdest(source):
245 def defaultdest(source):
246 '''return default destination of clone if none is given
246 '''return default destination of clone if none is given
247
247
248 >>> defaultdest(b'foo')
248 >>> defaultdest(b'foo')
249 'foo'
249 'foo'
250 >>> defaultdest(b'/foo/bar')
250 >>> defaultdest(b'/foo/bar')
251 'bar'
251 'bar'
252 >>> defaultdest(b'/')
252 >>> defaultdest(b'/')
253 ''
253 ''
254 >>> defaultdest(b'')
254 >>> defaultdest(b'')
255 ''
255 ''
256 >>> defaultdest(b'http://example.org/')
256 >>> defaultdest(b'http://example.org/')
257 ''
257 ''
258 >>> defaultdest(b'http://example.org/foo/')
258 >>> defaultdest(b'http://example.org/foo/')
259 'foo'
259 'foo'
260 '''
260 '''
261 path = util.url(source).path
261 path = util.url(source).path
262 if not path:
262 if not path:
263 return b''
263 return b''
264 return os.path.basename(os.path.normpath(path))
264 return os.path.basename(os.path.normpath(path))
265
265
266
266
267 def sharedreposource(repo):
267 def sharedreposource(repo):
268 """Returns repository object for source repository of a shared repo.
268 """Returns repository object for source repository of a shared repo.
269
269
270 If repo is not a shared repository, returns None.
270 If repo is not a shared repository, returns None.
271 """
271 """
272 if repo.sharedpath == repo.path:
272 if repo.sharedpath == repo.path:
273 return None
273 return None
274
274
275 if util.safehasattr(repo, b'srcrepo') and repo.srcrepo:
275 if util.safehasattr(repo, b'srcrepo') and repo.srcrepo:
276 return repo.srcrepo
276 return repo.srcrepo
277
277
278 # the sharedpath always ends in the .hg; we want the path to the repo
278 # the sharedpath always ends in the .hg; we want the path to the repo
279 source = repo.vfs.split(repo.sharedpath)[0]
279 source = repo.vfs.split(repo.sharedpath)[0]
280 srcurl, branches = parseurl(source)
280 srcurl, branches = parseurl(source)
281 srcrepo = repository(repo.ui, srcurl)
281 srcrepo = repository(repo.ui, srcurl)
282 repo.srcrepo = srcrepo
282 repo.srcrepo = srcrepo
283 return srcrepo
283 return srcrepo
284
284
285
285
286 def share(
286 def share(
287 ui,
287 ui,
288 source,
288 source,
289 dest=None,
289 dest=None,
290 update=True,
290 update=True,
291 bookmarks=True,
291 bookmarks=True,
292 defaultpath=None,
292 defaultpath=None,
293 relative=False,
293 relative=False,
294 ):
294 ):
295 '''create a shared repository'''
295 '''create a shared repository'''
296
296
297 if not islocal(source):
297 if not islocal(source):
298 raise error.Abort(_(b'can only share local repositories'))
298 raise error.Abort(_(b'can only share local repositories'))
299
299
300 if not dest:
300 if not dest:
301 dest = defaultdest(source)
301 dest = defaultdest(source)
302 else:
302 else:
303 dest = ui.expandpath(dest)
303 dest = ui.expandpath(dest)
304
304
305 if isinstance(source, bytes):
305 if isinstance(source, bytes):
306 origsource = ui.expandpath(source)
306 origsource = ui.expandpath(source)
307 source, branches = parseurl(origsource)
307 source, branches = parseurl(origsource)
308 srcrepo = repository(ui, source)
308 srcrepo = repository(ui, source)
309 rev, checkout = addbranchrevs(srcrepo, srcrepo, branches, None)
309 rev, checkout = addbranchrevs(srcrepo, srcrepo, branches, None)
310 else:
310 else:
311 srcrepo = source.local()
311 srcrepo = source.local()
312 checkout = None
312 checkout = None
313
313
314 shareditems = set()
314 shareditems = set()
315 if bookmarks:
315 if bookmarks:
316 shareditems.add(sharedbookmarks)
316 shareditems.add(sharedbookmarks)
317
317
318 r = repository(
318 r = repository(
319 ui,
319 ui,
320 dest,
320 dest,
321 create=True,
321 create=True,
322 createopts={
322 createopts={
323 b'sharedrepo': srcrepo,
323 b'sharedrepo': srcrepo,
324 b'sharedrelative': relative,
324 b'sharedrelative': relative,
325 b'shareditems': shareditems,
325 b'shareditems': shareditems,
326 },
326 },
327 )
327 )
328
328
329 postshare(srcrepo, r, defaultpath=defaultpath)
329 postshare(srcrepo, r, defaultpath=defaultpath)
330 r = repository(ui, dest)
330 r = repository(ui, dest)
331 _postshareupdate(r, update, checkout=checkout)
331 _postshareupdate(r, update, checkout=checkout)
332 return r
332 return r
333
333
334
334
335 def _prependsourcehgrc(repo):
335 def _prependsourcehgrc(repo):
336 """ copies the source repo config and prepend it in current repo .hg/hgrc
336 """ copies the source repo config and prepend it in current repo .hg/hgrc
337 on unshare. This is only done if the share was perfomed using share safe
337 on unshare. This is only done if the share was perfomed using share safe
338 method where we share config of source in shares"""
338 method where we share config of source in shares"""
339 srcvfs = vfsmod.vfs(repo.sharedpath)
339 srcvfs = vfsmod.vfs(repo.sharedpath)
340 dstvfs = vfsmod.vfs(repo.path)
340 dstvfs = vfsmod.vfs(repo.path)
341
341
342 if not srcvfs.exists(b'hgrc'):
342 if not srcvfs.exists(b'hgrc'):
343 return
343 return
344
344
345 currentconfig = b''
345 currentconfig = b''
346 if dstvfs.exists(b'hgrc'):
346 if dstvfs.exists(b'hgrc'):
347 currentconfig = dstvfs.read(b'hgrc')
347 currentconfig = dstvfs.read(b'hgrc')
348
348
349 with dstvfs(b'hgrc', b'wb') as fp:
349 with dstvfs(b'hgrc', b'wb') as fp:
350 sourceconfig = srcvfs.read(b'hgrc')
350 sourceconfig = srcvfs.read(b'hgrc')
351 fp.write(b"# Config copied from shared source\n")
351 fp.write(b"# Config copied from shared source\n")
352 fp.write(sourceconfig)
352 fp.write(sourceconfig)
353 fp.write(b'\n')
353 fp.write(b'\n')
354 fp.write(currentconfig)
354 fp.write(currentconfig)
355
355
356
356
357 def unshare(ui, repo):
357 def unshare(ui, repo):
358 """convert a shared repository to a normal one
358 """convert a shared repository to a normal one
359
359
360 Copy the store data to the repo and remove the sharedpath data.
360 Copy the store data to the repo and remove the sharedpath data.
361
361
362 Returns a new repository object representing the unshared repository.
362 Returns a new repository object representing the unshared repository.
363
363
364 The passed repository object is not usable after this function is
364 The passed repository object is not usable after this function is
365 called.
365 called.
366 """
366 """
367
367
368 with repo.lock():
368 with repo.lock():
369 # we use locks here because if we race with commit, we
369 # we use locks here because if we race with commit, we
370 # can end up with extra data in the cloned revlogs that's
370 # can end up with extra data in the cloned revlogs that's
371 # not pointed to by changesets, thus causing verify to
371 # not pointed to by changesets, thus causing verify to
372 # fail
372 # fail
373 destlock = copystore(ui, repo, repo.path)
373 destlock = copystore(ui, repo, repo.path)
374 with destlock or util.nullcontextmanager():
374 with destlock or util.nullcontextmanager():
375 if requirements.SHARESAFE_REQUIREMENT in repo.requirements:
375 if requirements.SHARESAFE_REQUIREMENT in repo.requirements:
376 # we were sharing .hg/hgrc of the share source with the current
376 # we were sharing .hg/hgrc of the share source with the current
377 # repo. We need to copy that while unsharing otherwise it can
377 # repo. We need to copy that while unsharing otherwise it can
378 # disable hooks and other checks
378 # disable hooks and other checks
379 _prependsourcehgrc(repo)
379 _prependsourcehgrc(repo)
380
380
381 sharefile = repo.vfs.join(b'sharedpath')
381 sharefile = repo.vfs.join(b'sharedpath')
382 util.rename(sharefile, sharefile + b'.old')
382 util.rename(sharefile, sharefile + b'.old')
383
383
384 repo.requirements.discard(requirements.SHARED_REQUIREMENT)
384 repo.requirements.discard(requirements.SHARED_REQUIREMENT)
385 repo.requirements.discard(requirements.RELATIVE_SHARED_REQUIREMENT)
385 repo.requirements.discard(requirements.RELATIVE_SHARED_REQUIREMENT)
386 scmutil.writereporequirements(repo)
386 scmutil.writereporequirements(repo)
387
387
388 # Removing share changes some fundamental properties of the repo instance.
388 # Removing share changes some fundamental properties of the repo instance.
389 # So we instantiate a new repo object and operate on it rather than
389 # So we instantiate a new repo object and operate on it rather than
390 # try to keep the existing repo usable.
390 # try to keep the existing repo usable.
391 newrepo = repository(repo.baseui, repo.root, create=False)
391 newrepo = repository(repo.baseui, repo.root, create=False)
392
392
393 # TODO: figure out how to access subrepos that exist, but were previously
393 # TODO: figure out how to access subrepos that exist, but were previously
394 # removed from .hgsub
394 # removed from .hgsub
395 c = newrepo[b'.']
395 c = newrepo[b'.']
396 subs = c.substate
396 subs = c.substate
397 for s in sorted(subs):
397 for s in sorted(subs):
398 c.sub(s).unshare()
398 c.sub(s).unshare()
399
399
400 localrepo.poisonrepository(repo)
400 localrepo.poisonrepository(repo)
401
401
402 return newrepo
402 return newrepo
403
403
404
404
405 def postshare(sourcerepo, destrepo, defaultpath=None):
405 def postshare(sourcerepo, destrepo, defaultpath=None):
406 """Called after a new shared repo is created.
406 """Called after a new shared repo is created.
407
407
408 The new repo only has a requirements file and pointer to the source.
408 The new repo only has a requirements file and pointer to the source.
409 This function configures additional shared data.
409 This function configures additional shared data.
410
410
411 Extensions can wrap this function and write additional entries to
411 Extensions can wrap this function and write additional entries to
412 destrepo/.hg/shared to indicate additional pieces of data to be shared.
412 destrepo/.hg/shared to indicate additional pieces of data to be shared.
413 """
413 """
414 default = defaultpath or sourcerepo.ui.config(b'paths', b'default')
414 default = defaultpath or sourcerepo.ui.config(b'paths', b'default')
415 if default:
415 if default:
416 template = b'[paths]\ndefault = %s\n'
416 template = b'[paths]\ndefault = %s\n'
417 destrepo.vfs.write(b'hgrc', util.tonativeeol(template % default))
417 destrepo.vfs.write(b'hgrc', util.tonativeeol(template % default))
418 if requirements.NARROW_REQUIREMENT in sourcerepo.requirements:
418 if requirements.NARROW_REQUIREMENT in sourcerepo.requirements:
419 with destrepo.wlock():
419 with destrepo.wlock():
420 narrowspec.copytoworkingcopy(destrepo)
420 narrowspec.copytoworkingcopy(destrepo)
421
421
422
422
423 def _postshareupdate(repo, update, checkout=None):
423 def _postshareupdate(repo, update, checkout=None):
424 """Maybe perform a working directory update after a shared repo is created.
424 """Maybe perform a working directory update after a shared repo is created.
425
425
426 ``update`` can be a boolean or a revision to update to.
426 ``update`` can be a boolean or a revision to update to.
427 """
427 """
428 if not update:
428 if not update:
429 return
429 return
430
430
431 repo.ui.status(_(b"updating working directory\n"))
431 repo.ui.status(_(b"updating working directory\n"))
432 if update is not True:
432 if update is not True:
433 checkout = update
433 checkout = update
434 for test in (checkout, b'default', b'tip'):
434 for test in (checkout, b'default', b'tip'):
435 if test is None:
435 if test is None:
436 continue
436 continue
437 try:
437 try:
438 uprev = repo.lookup(test)
438 uprev = repo.lookup(test)
439 break
439 break
440 except error.RepoLookupError:
440 except error.RepoLookupError:
441 continue
441 continue
442 _update(repo, uprev)
442 _update(repo, uprev)
443
443
444
444
445 def copystore(ui, srcrepo, destpath):
445 def copystore(ui, srcrepo, destpath):
446 '''copy files from store of srcrepo in destpath
446 '''copy files from store of srcrepo in destpath
447
447
448 returns destlock
448 returns destlock
449 '''
449 '''
450 destlock = None
450 destlock = None
451 try:
451 try:
452 hardlink = None
452 hardlink = None
453 topic = _(b'linking') if hardlink else _(b'copying')
453 topic = _(b'linking') if hardlink else _(b'copying')
454 with ui.makeprogress(topic, unit=_(b'files')) as progress:
454 with ui.makeprogress(topic, unit=_(b'files')) as progress:
455 num = 0
455 num = 0
456 srcpublishing = srcrepo.publishing()
456 srcpublishing = srcrepo.publishing()
457 srcvfs = vfsmod.vfs(srcrepo.sharedpath)
457 srcvfs = vfsmod.vfs(srcrepo.sharedpath)
458 dstvfs = vfsmod.vfs(destpath)
458 dstvfs = vfsmod.vfs(destpath)
459 for f in srcrepo.store.copylist():
459 for f in srcrepo.store.copylist():
460 if srcpublishing and f.endswith(b'phaseroots'):
460 if srcpublishing and f.endswith(b'phaseroots'):
461 continue
461 continue
462 dstbase = os.path.dirname(f)
462 dstbase = os.path.dirname(f)
463 if dstbase and not dstvfs.exists(dstbase):
463 if dstbase and not dstvfs.exists(dstbase):
464 dstvfs.mkdir(dstbase)
464 dstvfs.mkdir(dstbase)
465 if srcvfs.exists(f):
465 if srcvfs.exists(f):
466 if f.endswith(b'data'):
466 if f.endswith(b'data'):
467 # 'dstbase' may be empty (e.g. revlog format 0)
467 # 'dstbase' may be empty (e.g. revlog format 0)
468 lockfile = os.path.join(dstbase, b"lock")
468 lockfile = os.path.join(dstbase, b"lock")
469 # lock to avoid premature writing to the target
469 # lock to avoid premature writing to the target
470 destlock = lock.lock(dstvfs, lockfile)
470 destlock = lock.lock(dstvfs, lockfile)
471 hardlink, n = util.copyfiles(
471 hardlink, n = util.copyfiles(
472 srcvfs.join(f), dstvfs.join(f), hardlink, progress
472 srcvfs.join(f), dstvfs.join(f), hardlink, progress
473 )
473 )
474 num += n
474 num += n
475 if hardlink:
475 if hardlink:
476 ui.debug(b"linked %d files\n" % num)
476 ui.debug(b"linked %d files\n" % num)
477 else:
477 else:
478 ui.debug(b"copied %d files\n" % num)
478 ui.debug(b"copied %d files\n" % num)
479 return destlock
479 return destlock
480 except: # re-raises
480 except: # re-raises
481 release(destlock)
481 release(destlock)
482 raise
482 raise
483
483
484
484
485 def clonewithshare(
485 def clonewithshare(
486 ui,
486 ui,
487 peeropts,
487 peeropts,
488 sharepath,
488 sharepath,
489 source,
489 source,
490 srcpeer,
490 srcpeer,
491 dest,
491 dest,
492 pull=False,
492 pull=False,
493 rev=None,
493 rev=None,
494 update=True,
494 update=True,
495 stream=False,
495 stream=False,
496 ):
496 ):
497 """Perform a clone using a shared repo.
497 """Perform a clone using a shared repo.
498
498
499 The store for the repository will be located at <sharepath>/.hg. The
499 The store for the repository will be located at <sharepath>/.hg. The
500 specified revisions will be cloned or pulled from "source". A shared repo
500 specified revisions will be cloned or pulled from "source". A shared repo
501 will be created at "dest" and a working copy will be created if "update" is
501 will be created at "dest" and a working copy will be created if "update" is
502 True.
502 True.
503 """
503 """
504 revs = None
504 revs = None
505 if rev:
505 if rev:
506 if not srcpeer.capable(b'lookup'):
506 if not srcpeer.capable(b'lookup'):
507 raise error.Abort(
507 raise error.Abort(
508 _(
508 _(
509 b"src repository does not support "
509 b"src repository does not support "
510 b"revision lookup and so doesn't "
510 b"revision lookup and so doesn't "
511 b"support clone by revision"
511 b"support clone by revision"
512 )
512 )
513 )
513 )
514
514
515 # TODO this is batchable.
515 # TODO this is batchable.
516 remoterevs = []
516 remoterevs = []
517 for r in rev:
517 for r in rev:
518 with srcpeer.commandexecutor() as e:
518 with srcpeer.commandexecutor() as e:
519 remoterevs.append(
519 remoterevs.append(
520 e.callcommand(b'lookup', {b'key': r,}).result()
520 e.callcommand(b'lookup', {b'key': r,}).result()
521 )
521 )
522 revs = remoterevs
522 revs = remoterevs
523
523
524 # Obtain a lock before checking for or cloning the pooled repo otherwise
524 # Obtain a lock before checking for or cloning the pooled repo otherwise
525 # 2 clients may race creating or populating it.
525 # 2 clients may race creating or populating it.
526 pooldir = os.path.dirname(sharepath)
526 pooldir = os.path.dirname(sharepath)
527 # lock class requires the directory to exist.
527 # lock class requires the directory to exist.
528 try:
528 try:
529 util.makedir(pooldir, False)
529 util.makedir(pooldir, False)
530 except OSError as e:
530 except OSError as e:
531 if e.errno != errno.EEXIST:
531 if e.errno != errno.EEXIST:
532 raise
532 raise
533
533
534 poolvfs = vfsmod.vfs(pooldir)
534 poolvfs = vfsmod.vfs(pooldir)
535 basename = os.path.basename(sharepath)
535 basename = os.path.basename(sharepath)
536
536
537 with lock.lock(poolvfs, b'%s.lock' % basename):
537 with lock.lock(poolvfs, b'%s.lock' % basename):
538 if os.path.exists(sharepath):
538 if os.path.exists(sharepath):
539 ui.status(
539 ui.status(
540 _(b'(sharing from existing pooled repository %s)\n') % basename
540 _(b'(sharing from existing pooled repository %s)\n') % basename
541 )
541 )
542 else:
542 else:
543 ui.status(
543 ui.status(
544 _(b'(sharing from new pooled repository %s)\n') % basename
544 _(b'(sharing from new pooled repository %s)\n') % basename
545 )
545 )
546 # Always use pull mode because hardlinks in share mode don't work
546 # Always use pull mode because hardlinks in share mode don't work
547 # well. Never update because working copies aren't necessary in
547 # well. Never update because working copies aren't necessary in
548 # share mode.
548 # share mode.
549 clone(
549 clone(
550 ui,
550 ui,
551 peeropts,
551 peeropts,
552 source,
552 source,
553 dest=sharepath,
553 dest=sharepath,
554 pull=True,
554 pull=True,
555 revs=rev,
555 revs=rev,
556 update=False,
556 update=False,
557 stream=stream,
557 stream=stream,
558 )
558 )
559
559
560 # Resolve the value to put in [paths] section for the source.
560 # Resolve the value to put in [paths] section for the source.
561 if islocal(source):
561 if islocal(source):
562 defaultpath = os.path.abspath(util.urllocalpath(source))
562 defaultpath = os.path.abspath(util.urllocalpath(source))
563 else:
563 else:
564 defaultpath = source
564 defaultpath = source
565
565
566 sharerepo = repository(ui, path=sharepath)
566 sharerepo = repository(ui, path=sharepath)
567 destrepo = share(
567 destrepo = share(
568 ui,
568 ui,
569 sharerepo,
569 sharerepo,
570 dest=dest,
570 dest=dest,
571 update=False,
571 update=False,
572 bookmarks=False,
572 bookmarks=False,
573 defaultpath=defaultpath,
573 defaultpath=defaultpath,
574 )
574 )
575
575
576 # We need to perform a pull against the dest repo to fetch bookmarks
576 # We need to perform a pull against the dest repo to fetch bookmarks
577 # and other non-store data that isn't shared by default. In the case of
577 # and other non-store data that isn't shared by default. In the case of
578 # non-existing shared repo, this means we pull from the remote twice. This
578 # non-existing shared repo, this means we pull from the remote twice. This
579 # is a bit weird. But at the time it was implemented, there wasn't an easy
579 # is a bit weird. But at the time it was implemented, there wasn't an easy
580 # way to pull just non-changegroup data.
580 # way to pull just non-changegroup data.
581 exchange.pull(destrepo, srcpeer, heads=revs)
581 exchange.pull(destrepo, srcpeer, heads=revs)
582
582
583 _postshareupdate(destrepo, update)
583 _postshareupdate(destrepo, update)
584
584
585 return srcpeer, peer(ui, peeropts, dest)
585 return srcpeer, peer(ui, peeropts, dest)
586
586
587
587
588 # Recomputing branch cache might be slow on big repos,
588 # Recomputing branch cache might be slow on big repos,
589 # so just copy it
589 # so just copy it
590 def _copycache(srcrepo, dstcachedir, fname):
590 def _copycache(srcrepo, dstcachedir, fname):
591 """copy a cache from srcrepo to destcachedir (if it exists)"""
591 """copy a cache from srcrepo to destcachedir (if it exists)"""
592 srcbranchcache = srcrepo.vfs.join(b'cache/%s' % fname)
592 srcbranchcache = srcrepo.vfs.join(b'cache/%s' % fname)
593 dstbranchcache = os.path.join(dstcachedir, fname)
593 dstbranchcache = os.path.join(dstcachedir, fname)
594 if os.path.exists(srcbranchcache):
594 if os.path.exists(srcbranchcache):
595 if not os.path.exists(dstcachedir):
595 if not os.path.exists(dstcachedir):
596 os.mkdir(dstcachedir)
596 os.mkdir(dstcachedir)
597 util.copyfile(srcbranchcache, dstbranchcache)
597 util.copyfile(srcbranchcache, dstbranchcache)
598
598
599
599
600 def clone(
600 def clone(
601 ui,
601 ui,
602 peeropts,
602 peeropts,
603 source,
603 source,
604 dest=None,
604 dest=None,
605 pull=False,
605 pull=False,
606 revs=None,
606 revs=None,
607 update=True,
607 update=True,
608 stream=False,
608 stream=False,
609 branch=None,
609 branch=None,
610 shareopts=None,
610 shareopts=None,
611 storeincludepats=None,
611 storeincludepats=None,
612 storeexcludepats=None,
612 storeexcludepats=None,
613 depth=None,
613 depth=None,
614 ):
614 ):
615 """Make a copy of an existing repository.
615 """Make a copy of an existing repository.
616
616
617 Create a copy of an existing repository in a new directory. The
617 Create a copy of an existing repository in a new directory. The
618 source and destination are URLs, as passed to the repository
618 source and destination are URLs, as passed to the repository
619 function. Returns a pair of repository peers, the source and
619 function. Returns a pair of repository peers, the source and
620 newly created destination.
620 newly created destination.
621
621
622 The location of the source is added to the new repository's
622 The location of the source is added to the new repository's
623 .hg/hgrc file, as the default to be used for future pulls and
623 .hg/hgrc file, as the default to be used for future pulls and
624 pushes.
624 pushes.
625
625
626 If an exception is raised, the partly cloned/updated destination
626 If an exception is raised, the partly cloned/updated destination
627 repository will be deleted.
627 repository will be deleted.
628
628
629 Arguments:
629 Arguments:
630
630
631 source: repository object or URL
631 source: repository object or URL
632
632
633 dest: URL of destination repository to create (defaults to base
633 dest: URL of destination repository to create (defaults to base
634 name of source repository)
634 name of source repository)
635
635
636 pull: always pull from source repository, even in local case or if the
636 pull: always pull from source repository, even in local case or if the
637 server prefers streaming
637 server prefers streaming
638
638
639 stream: stream raw data uncompressed from repository (fast over
639 stream: stream raw data uncompressed from repository (fast over
640 LAN, slow over WAN)
640 LAN, slow over WAN)
641
641
642 revs: revision to clone up to (implies pull=True)
642 revs: revision to clone up to (implies pull=True)
643
643
644 update: update working directory after clone completes, if
644 update: update working directory after clone completes, if
645 destination is local repository (True means update to default rev,
645 destination is local repository (True means update to default rev,
646 anything else is treated as a revision)
646 anything else is treated as a revision)
647
647
648 branch: branches to clone
648 branch: branches to clone
649
649
650 shareopts: dict of options to control auto sharing behavior. The "pool" key
650 shareopts: dict of options to control auto sharing behavior. The "pool" key
651 activates auto sharing mode and defines the directory for stores. The
651 activates auto sharing mode and defines the directory for stores. The
652 "mode" key determines how to construct the directory name of the shared
652 "mode" key determines how to construct the directory name of the shared
653 repository. "identity" means the name is derived from the node of the first
653 repository. "identity" means the name is derived from the node of the first
654 changeset in the repository. "remote" means the name is derived from the
654 changeset in the repository. "remote" means the name is derived from the
655 remote's path/URL. Defaults to "identity."
655 remote's path/URL. Defaults to "identity."
656
656
657 storeincludepats and storeexcludepats: sets of file patterns to include and
657 storeincludepats and storeexcludepats: sets of file patterns to include and
658 exclude in the repository copy, respectively. If not defined, all files
658 exclude in the repository copy, respectively. If not defined, all files
659 will be included (a "full" clone). Otherwise a "narrow" clone containing
659 will be included (a "full" clone). Otherwise a "narrow" clone containing
660 only the requested files will be performed. If ``storeincludepats`` is not
660 only the requested files will be performed. If ``storeincludepats`` is not
661 defined but ``storeexcludepats`` is, ``storeincludepats`` is assumed to be
661 defined but ``storeexcludepats`` is, ``storeincludepats`` is assumed to be
662 ``path:.``. If both are empty sets, no files will be cloned.
662 ``path:.``. If both are empty sets, no files will be cloned.
663 """
663 """
664
664
665 if isinstance(source, bytes):
665 if isinstance(source, bytes):
666 origsource = ui.expandpath(source)
666 origsource = ui.expandpath(source)
667 source, branches = parseurl(origsource, branch)
667 source, branches = parseurl(origsource, branch)
668 srcpeer = peer(ui, peeropts, source)
668 srcpeer = peer(ui, peeropts, source)
669 else:
669 else:
670 srcpeer = source.peer() # in case we were called with a localrepo
670 srcpeer = source.peer() # in case we were called with a localrepo
671 branches = (None, branch or [])
671 branches = (None, branch or [])
672 origsource = source = srcpeer.url()
672 origsource = source = srcpeer.url()
673 revs, checkout = addbranchrevs(srcpeer, srcpeer, branches, revs)
673 revs, checkout = addbranchrevs(srcpeer, srcpeer, branches, revs)
674
674
675 if dest is None:
675 if dest is None:
676 dest = defaultdest(source)
676 dest = defaultdest(source)
677 if dest:
677 if dest:
678 ui.status(_(b"destination directory: %s\n") % dest)
678 ui.status(_(b"destination directory: %s\n") % dest)
679 else:
679 else:
680 dest = ui.expandpath(dest)
680 dest = ui.expandpath(dest)
681
681
682 dest = util.urllocalpath(dest)
682 dest = util.urllocalpath(dest)
683 source = util.urllocalpath(source)
683 source = util.urllocalpath(source)
684
684
685 if not dest:
685 if not dest:
686 raise error.Abort(_(b"empty destination path is not valid"))
686 raise error.InputError(_(b"empty destination path is not valid"))
687
687
688 destvfs = vfsmod.vfs(dest, expandpath=True)
688 destvfs = vfsmod.vfs(dest, expandpath=True)
689 if destvfs.lexists():
689 if destvfs.lexists():
690 if not destvfs.isdir():
690 if not destvfs.isdir():
691 raise error.Abort(_(b"destination '%s' already exists") % dest)
691 raise error.InputError(_(b"destination '%s' already exists") % dest)
692 elif destvfs.listdir():
692 elif destvfs.listdir():
693 raise error.Abort(_(b"destination '%s' is not empty") % dest)
693 raise error.InputError(_(b"destination '%s' is not empty") % dest)
694
694
695 createopts = {}
695 createopts = {}
696 narrow = False
696 narrow = False
697
697
698 if storeincludepats is not None:
698 if storeincludepats is not None:
699 narrowspec.validatepatterns(storeincludepats)
699 narrowspec.validatepatterns(storeincludepats)
700 narrow = True
700 narrow = True
701
701
702 if storeexcludepats is not None:
702 if storeexcludepats is not None:
703 narrowspec.validatepatterns(storeexcludepats)
703 narrowspec.validatepatterns(storeexcludepats)
704 narrow = True
704 narrow = True
705
705
706 if narrow:
706 if narrow:
707 # Include everything by default if only exclusion patterns defined.
707 # Include everything by default if only exclusion patterns defined.
708 if storeexcludepats and not storeincludepats:
708 if storeexcludepats and not storeincludepats:
709 storeincludepats = {b'path:.'}
709 storeincludepats = {b'path:.'}
710
710
711 createopts[b'narrowfiles'] = True
711 createopts[b'narrowfiles'] = True
712
712
713 if depth:
713 if depth:
714 createopts[b'shallowfilestore'] = True
714 createopts[b'shallowfilestore'] = True
715
715
716 if srcpeer.capable(b'lfs-serve'):
716 if srcpeer.capable(b'lfs-serve'):
717 # Repository creation honors the config if it disabled the extension, so
717 # Repository creation honors the config if it disabled the extension, so
718 # we can't just announce that lfs will be enabled. This check avoids
718 # we can't just announce that lfs will be enabled. This check avoids
719 # saying that lfs will be enabled, and then saying it's an unknown
719 # saying that lfs will be enabled, and then saying it's an unknown
720 # feature. The lfs creation option is set in either case so that a
720 # feature. The lfs creation option is set in either case so that a
721 # requirement is added. If the extension is explicitly disabled but the
721 # requirement is added. If the extension is explicitly disabled but the
722 # requirement is set, the clone aborts early, before transferring any
722 # requirement is set, the clone aborts early, before transferring any
723 # data.
723 # data.
724 createopts[b'lfs'] = True
724 createopts[b'lfs'] = True
725
725
726 if extensions.disabled_help(b'lfs'):
726 if extensions.disabled_help(b'lfs'):
727 ui.status(
727 ui.status(
728 _(
728 _(
729 b'(remote is using large file support (lfs), but it is '
729 b'(remote is using large file support (lfs), but it is '
730 b'explicitly disabled in the local configuration)\n'
730 b'explicitly disabled in the local configuration)\n'
731 )
731 )
732 )
732 )
733 else:
733 else:
734 ui.status(
734 ui.status(
735 _(
735 _(
736 b'(remote is using large file support (lfs); lfs will '
736 b'(remote is using large file support (lfs); lfs will '
737 b'be enabled for this repository)\n'
737 b'be enabled for this repository)\n'
738 )
738 )
739 )
739 )
740
740
741 shareopts = shareopts or {}
741 shareopts = shareopts or {}
742 sharepool = shareopts.get(b'pool')
742 sharepool = shareopts.get(b'pool')
743 sharenamemode = shareopts.get(b'mode')
743 sharenamemode = shareopts.get(b'mode')
744 if sharepool and islocal(dest):
744 if sharepool and islocal(dest):
745 sharepath = None
745 sharepath = None
746 if sharenamemode == b'identity':
746 if sharenamemode == b'identity':
747 # Resolve the name from the initial changeset in the remote
747 # Resolve the name from the initial changeset in the remote
748 # repository. This returns nullid when the remote is empty. It
748 # repository. This returns nullid when the remote is empty. It
749 # raises RepoLookupError if revision 0 is filtered or otherwise
749 # raises RepoLookupError if revision 0 is filtered or otherwise
750 # not available. If we fail to resolve, sharing is not enabled.
750 # not available. If we fail to resolve, sharing is not enabled.
751 try:
751 try:
752 with srcpeer.commandexecutor() as e:
752 with srcpeer.commandexecutor() as e:
753 rootnode = e.callcommand(
753 rootnode = e.callcommand(
754 b'lookup', {b'key': b'0',}
754 b'lookup', {b'key': b'0',}
755 ).result()
755 ).result()
756
756
757 if rootnode != node.nullid:
757 if rootnode != node.nullid:
758 sharepath = os.path.join(sharepool, node.hex(rootnode))
758 sharepath = os.path.join(sharepool, node.hex(rootnode))
759 else:
759 else:
760 ui.status(
760 ui.status(
761 _(
761 _(
762 b'(not using pooled storage: '
762 b'(not using pooled storage: '
763 b'remote appears to be empty)\n'
763 b'remote appears to be empty)\n'
764 )
764 )
765 )
765 )
766 except error.RepoLookupError:
766 except error.RepoLookupError:
767 ui.status(
767 ui.status(
768 _(
768 _(
769 b'(not using pooled storage: '
769 b'(not using pooled storage: '
770 b'unable to resolve identity of remote)\n'
770 b'unable to resolve identity of remote)\n'
771 )
771 )
772 )
772 )
773 elif sharenamemode == b'remote':
773 elif sharenamemode == b'remote':
774 sharepath = os.path.join(
774 sharepath = os.path.join(
775 sharepool, node.hex(hashutil.sha1(source).digest())
775 sharepool, node.hex(hashutil.sha1(source).digest())
776 )
776 )
777 else:
777 else:
778 raise error.Abort(
778 raise error.Abort(
779 _(b'unknown share naming mode: %s') % sharenamemode
779 _(b'unknown share naming mode: %s') % sharenamemode
780 )
780 )
781
781
782 # TODO this is a somewhat arbitrary restriction.
782 # TODO this is a somewhat arbitrary restriction.
783 if narrow:
783 if narrow:
784 ui.status(_(b'(pooled storage not supported for narrow clones)\n'))
784 ui.status(_(b'(pooled storage not supported for narrow clones)\n'))
785 sharepath = None
785 sharepath = None
786
786
787 if sharepath:
787 if sharepath:
788 return clonewithshare(
788 return clonewithshare(
789 ui,
789 ui,
790 peeropts,
790 peeropts,
791 sharepath,
791 sharepath,
792 source,
792 source,
793 srcpeer,
793 srcpeer,
794 dest,
794 dest,
795 pull=pull,
795 pull=pull,
796 rev=revs,
796 rev=revs,
797 update=update,
797 update=update,
798 stream=stream,
798 stream=stream,
799 )
799 )
800
800
801 srclock = destlock = cleandir = None
801 srclock = destlock = cleandir = None
802 srcrepo = srcpeer.local()
802 srcrepo = srcpeer.local()
803 try:
803 try:
804 abspath = origsource
804 abspath = origsource
805 if islocal(origsource):
805 if islocal(origsource):
806 abspath = os.path.abspath(util.urllocalpath(origsource))
806 abspath = os.path.abspath(util.urllocalpath(origsource))
807
807
808 if islocal(dest):
808 if islocal(dest):
809 cleandir = dest
809 cleandir = dest
810
810
811 copy = False
811 copy = False
812 if (
812 if (
813 srcrepo
813 srcrepo
814 and srcrepo.cancopy()
814 and srcrepo.cancopy()
815 and islocal(dest)
815 and islocal(dest)
816 and not phases.hassecret(srcrepo)
816 and not phases.hassecret(srcrepo)
817 ):
817 ):
818 copy = not pull and not revs
818 copy = not pull and not revs
819
819
820 # TODO this is a somewhat arbitrary restriction.
820 # TODO this is a somewhat arbitrary restriction.
821 if narrow:
821 if narrow:
822 copy = False
822 copy = False
823
823
824 if copy:
824 if copy:
825 try:
825 try:
826 # we use a lock here because if we race with commit, we
826 # we use a lock here because if we race with commit, we
827 # can end up with extra data in the cloned revlogs that's
827 # can end up with extra data in the cloned revlogs that's
828 # not pointed to by changesets, thus causing verify to
828 # not pointed to by changesets, thus causing verify to
829 # fail
829 # fail
830 srclock = srcrepo.lock(wait=False)
830 srclock = srcrepo.lock(wait=False)
831 except error.LockError:
831 except error.LockError:
832 copy = False
832 copy = False
833
833
834 if copy:
834 if copy:
835 srcrepo.hook(b'preoutgoing', throw=True, source=b'clone')
835 srcrepo.hook(b'preoutgoing', throw=True, source=b'clone')
836 hgdir = os.path.realpath(os.path.join(dest, b".hg"))
836 hgdir = os.path.realpath(os.path.join(dest, b".hg"))
837 if not os.path.exists(dest):
837 if not os.path.exists(dest):
838 util.makedirs(dest)
838 util.makedirs(dest)
839 else:
839 else:
840 # only clean up directories we create ourselves
840 # only clean up directories we create ourselves
841 cleandir = hgdir
841 cleandir = hgdir
842 try:
842 try:
843 destpath = hgdir
843 destpath = hgdir
844 util.makedir(destpath, notindexed=True)
844 util.makedir(destpath, notindexed=True)
845 except OSError as inst:
845 except OSError as inst:
846 if inst.errno == errno.EEXIST:
846 if inst.errno == errno.EEXIST:
847 cleandir = None
847 cleandir = None
848 raise error.Abort(
848 raise error.Abort(
849 _(b"destination '%s' already exists") % dest
849 _(b"destination '%s' already exists") % dest
850 )
850 )
851 raise
851 raise
852
852
853 destlock = copystore(ui, srcrepo, destpath)
853 destlock = copystore(ui, srcrepo, destpath)
854 # copy bookmarks over
854 # copy bookmarks over
855 srcbookmarks = srcrepo.vfs.join(b'bookmarks')
855 srcbookmarks = srcrepo.vfs.join(b'bookmarks')
856 dstbookmarks = os.path.join(destpath, b'bookmarks')
856 dstbookmarks = os.path.join(destpath, b'bookmarks')
857 if os.path.exists(srcbookmarks):
857 if os.path.exists(srcbookmarks):
858 util.copyfile(srcbookmarks, dstbookmarks)
858 util.copyfile(srcbookmarks, dstbookmarks)
859
859
860 dstcachedir = os.path.join(destpath, b'cache')
860 dstcachedir = os.path.join(destpath, b'cache')
861 for cache in cacheutil.cachetocopy(srcrepo):
861 for cache in cacheutil.cachetocopy(srcrepo):
862 _copycache(srcrepo, dstcachedir, cache)
862 _copycache(srcrepo, dstcachedir, cache)
863
863
864 # we need to re-init the repo after manually copying the data
864 # we need to re-init the repo after manually copying the data
865 # into it
865 # into it
866 destpeer = peer(srcrepo, peeropts, dest)
866 destpeer = peer(srcrepo, peeropts, dest)
867 srcrepo.hook(
867 srcrepo.hook(
868 b'outgoing', source=b'clone', node=node.hex(node.nullid)
868 b'outgoing', source=b'clone', node=node.hex(node.nullid)
869 )
869 )
870 else:
870 else:
871 try:
871 try:
872 # only pass ui when no srcrepo
872 # only pass ui when no srcrepo
873 destpeer = peer(
873 destpeer = peer(
874 srcrepo or ui,
874 srcrepo or ui,
875 peeropts,
875 peeropts,
876 dest,
876 dest,
877 create=True,
877 create=True,
878 createopts=createopts,
878 createopts=createopts,
879 )
879 )
880 except OSError as inst:
880 except OSError as inst:
881 if inst.errno == errno.EEXIST:
881 if inst.errno == errno.EEXIST:
882 cleandir = None
882 cleandir = None
883 raise error.Abort(
883 raise error.Abort(
884 _(b"destination '%s' already exists") % dest
884 _(b"destination '%s' already exists") % dest
885 )
885 )
886 raise
886 raise
887
887
888 if revs:
888 if revs:
889 if not srcpeer.capable(b'lookup'):
889 if not srcpeer.capable(b'lookup'):
890 raise error.Abort(
890 raise error.Abort(
891 _(
891 _(
892 b"src repository does not support "
892 b"src repository does not support "
893 b"revision lookup and so doesn't "
893 b"revision lookup and so doesn't "
894 b"support clone by revision"
894 b"support clone by revision"
895 )
895 )
896 )
896 )
897
897
898 # TODO this is batchable.
898 # TODO this is batchable.
899 remoterevs = []
899 remoterevs = []
900 for rev in revs:
900 for rev in revs:
901 with srcpeer.commandexecutor() as e:
901 with srcpeer.commandexecutor() as e:
902 remoterevs.append(
902 remoterevs.append(
903 e.callcommand(b'lookup', {b'key': rev,}).result()
903 e.callcommand(b'lookup', {b'key': rev,}).result()
904 )
904 )
905 revs = remoterevs
905 revs = remoterevs
906
906
907 checkout = revs[0]
907 checkout = revs[0]
908 else:
908 else:
909 revs = None
909 revs = None
910 local = destpeer.local()
910 local = destpeer.local()
911 if local:
911 if local:
912 if narrow:
912 if narrow:
913 with local.wlock(), local.lock():
913 with local.wlock(), local.lock():
914 local.setnarrowpats(storeincludepats, storeexcludepats)
914 local.setnarrowpats(storeincludepats, storeexcludepats)
915 narrowspec.copytoworkingcopy(local)
915 narrowspec.copytoworkingcopy(local)
916
916
917 u = util.url(abspath)
917 u = util.url(abspath)
918 defaulturl = bytes(u)
918 defaulturl = bytes(u)
919 local.ui.setconfig(b'paths', b'default', defaulturl, b'clone')
919 local.ui.setconfig(b'paths', b'default', defaulturl, b'clone')
920 if not stream:
920 if not stream:
921 if pull:
921 if pull:
922 stream = False
922 stream = False
923 else:
923 else:
924 stream = None
924 stream = None
925 # internal config: ui.quietbookmarkmove
925 # internal config: ui.quietbookmarkmove
926 overrides = {(b'ui', b'quietbookmarkmove'): True}
926 overrides = {(b'ui', b'quietbookmarkmove'): True}
927 with local.ui.configoverride(overrides, b'clone'):
927 with local.ui.configoverride(overrides, b'clone'):
928 exchange.pull(
928 exchange.pull(
929 local,
929 local,
930 srcpeer,
930 srcpeer,
931 revs,
931 revs,
932 streamclonerequested=stream,
932 streamclonerequested=stream,
933 includepats=storeincludepats,
933 includepats=storeincludepats,
934 excludepats=storeexcludepats,
934 excludepats=storeexcludepats,
935 depth=depth,
935 depth=depth,
936 )
936 )
937 elif srcrepo:
937 elif srcrepo:
938 # TODO lift restriction once exchange.push() accepts narrow
938 # TODO lift restriction once exchange.push() accepts narrow
939 # push.
939 # push.
940 if narrow:
940 if narrow:
941 raise error.Abort(
941 raise error.Abort(
942 _(
942 _(
943 b'narrow clone not available for '
943 b'narrow clone not available for '
944 b'remote destinations'
944 b'remote destinations'
945 )
945 )
946 )
946 )
947
947
948 exchange.push(
948 exchange.push(
949 srcrepo,
949 srcrepo,
950 destpeer,
950 destpeer,
951 revs=revs,
951 revs=revs,
952 bookmarks=srcrepo._bookmarks.keys(),
952 bookmarks=srcrepo._bookmarks.keys(),
953 )
953 )
954 else:
954 else:
955 raise error.Abort(
955 raise error.Abort(
956 _(b"clone from remote to remote not supported")
956 _(b"clone from remote to remote not supported")
957 )
957 )
958
958
959 cleandir = None
959 cleandir = None
960
960
961 destrepo = destpeer.local()
961 destrepo = destpeer.local()
962 if destrepo:
962 if destrepo:
963 template = uimod.samplehgrcs[b'cloned']
963 template = uimod.samplehgrcs[b'cloned']
964 u = util.url(abspath)
964 u = util.url(abspath)
965 u.passwd = None
965 u.passwd = None
966 defaulturl = bytes(u)
966 defaulturl = bytes(u)
967 destrepo.vfs.write(b'hgrc', util.tonativeeol(template % defaulturl))
967 destrepo.vfs.write(b'hgrc', util.tonativeeol(template % defaulturl))
968 destrepo.ui.setconfig(b'paths', b'default', defaulturl, b'clone')
968 destrepo.ui.setconfig(b'paths', b'default', defaulturl, b'clone')
969
969
970 if ui.configbool(b'experimental', b'remotenames'):
970 if ui.configbool(b'experimental', b'remotenames'):
971 logexchange.pullremotenames(destrepo, srcpeer)
971 logexchange.pullremotenames(destrepo, srcpeer)
972
972
973 if update:
973 if update:
974 if update is not True:
974 if update is not True:
975 with srcpeer.commandexecutor() as e:
975 with srcpeer.commandexecutor() as e:
976 checkout = e.callcommand(
976 checkout = e.callcommand(
977 b'lookup', {b'key': update,}
977 b'lookup', {b'key': update,}
978 ).result()
978 ).result()
979
979
980 uprev = None
980 uprev = None
981 status = None
981 status = None
982 if checkout is not None:
982 if checkout is not None:
983 # Some extensions (at least hg-git and hg-subversion) have
983 # Some extensions (at least hg-git and hg-subversion) have
984 # a peer.lookup() implementation that returns a name instead
984 # a peer.lookup() implementation that returns a name instead
985 # of a nodeid. We work around it here until we've figured
985 # of a nodeid. We work around it here until we've figured
986 # out a better solution.
986 # out a better solution.
987 if len(checkout) == 20 and checkout in destrepo:
987 if len(checkout) == 20 and checkout in destrepo:
988 uprev = checkout
988 uprev = checkout
989 elif scmutil.isrevsymbol(destrepo, checkout):
989 elif scmutil.isrevsymbol(destrepo, checkout):
990 uprev = scmutil.revsymbol(destrepo, checkout).node()
990 uprev = scmutil.revsymbol(destrepo, checkout).node()
991 else:
991 else:
992 if update is not True:
992 if update is not True:
993 try:
993 try:
994 uprev = destrepo.lookup(update)
994 uprev = destrepo.lookup(update)
995 except error.RepoLookupError:
995 except error.RepoLookupError:
996 pass
996 pass
997 if uprev is None:
997 if uprev is None:
998 try:
998 try:
999 uprev = destrepo._bookmarks[b'@']
999 uprev = destrepo._bookmarks[b'@']
1000 update = b'@'
1000 update = b'@'
1001 bn = destrepo[uprev].branch()
1001 bn = destrepo[uprev].branch()
1002 if bn == b'default':
1002 if bn == b'default':
1003 status = _(b"updating to bookmark @\n")
1003 status = _(b"updating to bookmark @\n")
1004 else:
1004 else:
1005 status = (
1005 status = (
1006 _(b"updating to bookmark @ on branch %s\n") % bn
1006 _(b"updating to bookmark @ on branch %s\n") % bn
1007 )
1007 )
1008 except KeyError:
1008 except KeyError:
1009 try:
1009 try:
1010 uprev = destrepo.branchtip(b'default')
1010 uprev = destrepo.branchtip(b'default')
1011 except error.RepoLookupError:
1011 except error.RepoLookupError:
1012 uprev = destrepo.lookup(b'tip')
1012 uprev = destrepo.lookup(b'tip')
1013 if not status:
1013 if not status:
1014 bn = destrepo[uprev].branch()
1014 bn = destrepo[uprev].branch()
1015 status = _(b"updating to branch %s\n") % bn
1015 status = _(b"updating to branch %s\n") % bn
1016 destrepo.ui.status(status)
1016 destrepo.ui.status(status)
1017 _update(destrepo, uprev)
1017 _update(destrepo, uprev)
1018 if update in destrepo._bookmarks:
1018 if update in destrepo._bookmarks:
1019 bookmarks.activate(destrepo, update)
1019 bookmarks.activate(destrepo, update)
1020 finally:
1020 finally:
1021 release(srclock, destlock)
1021 release(srclock, destlock)
1022 if cleandir is not None:
1022 if cleandir is not None:
1023 shutil.rmtree(cleandir, True)
1023 shutil.rmtree(cleandir, True)
1024 if srcpeer is not None:
1024 if srcpeer is not None:
1025 srcpeer.close()
1025 srcpeer.close()
1026 return srcpeer, destpeer
1026 return srcpeer, destpeer
1027
1027
1028
1028
1029 def _showstats(repo, stats, quietempty=False):
1029 def _showstats(repo, stats, quietempty=False):
1030 if quietempty and stats.isempty():
1030 if quietempty and stats.isempty():
1031 return
1031 return
1032 repo.ui.status(
1032 repo.ui.status(
1033 _(
1033 _(
1034 b"%d files updated, %d files merged, "
1034 b"%d files updated, %d files merged, "
1035 b"%d files removed, %d files unresolved\n"
1035 b"%d files removed, %d files unresolved\n"
1036 )
1036 )
1037 % (
1037 % (
1038 stats.updatedcount,
1038 stats.updatedcount,
1039 stats.mergedcount,
1039 stats.mergedcount,
1040 stats.removedcount,
1040 stats.removedcount,
1041 stats.unresolvedcount,
1041 stats.unresolvedcount,
1042 )
1042 )
1043 )
1043 )
1044
1044
1045
1045
1046 def updaterepo(repo, node, overwrite, updatecheck=None):
1046 def updaterepo(repo, node, overwrite, updatecheck=None):
1047 """Update the working directory to node.
1047 """Update the working directory to node.
1048
1048
1049 When overwrite is set, changes are clobbered, merged else
1049 When overwrite is set, changes are clobbered, merged else
1050
1050
1051 returns stats (see pydoc mercurial.merge.applyupdates)"""
1051 returns stats (see pydoc mercurial.merge.applyupdates)"""
1052 repo.ui.deprecwarn(
1052 repo.ui.deprecwarn(
1053 b'prefer merge.update() or merge.clean_update() over hg.updaterepo()',
1053 b'prefer merge.update() or merge.clean_update() over hg.updaterepo()',
1054 b'5.7',
1054 b'5.7',
1055 )
1055 )
1056 return mergemod._update(
1056 return mergemod._update(
1057 repo,
1057 repo,
1058 node,
1058 node,
1059 branchmerge=False,
1059 branchmerge=False,
1060 force=overwrite,
1060 force=overwrite,
1061 labels=[b'working copy', b'destination'],
1061 labels=[b'working copy', b'destination'],
1062 updatecheck=updatecheck,
1062 updatecheck=updatecheck,
1063 )
1063 )
1064
1064
1065
1065
1066 def update(repo, node, quietempty=False, updatecheck=None):
1066 def update(repo, node, quietempty=False, updatecheck=None):
1067 """update the working directory to node"""
1067 """update the working directory to node"""
1068 stats = mergemod.update(repo[node], updatecheck=updatecheck)
1068 stats = mergemod.update(repo[node], updatecheck=updatecheck)
1069 _showstats(repo, stats, quietempty)
1069 _showstats(repo, stats, quietempty)
1070 if stats.unresolvedcount:
1070 if stats.unresolvedcount:
1071 repo.ui.status(_(b"use 'hg resolve' to retry unresolved file merges\n"))
1071 repo.ui.status(_(b"use 'hg resolve' to retry unresolved file merges\n"))
1072 return stats.unresolvedcount > 0
1072 return stats.unresolvedcount > 0
1073
1073
1074
1074
1075 # naming conflict in clone()
1075 # naming conflict in clone()
1076 _update = update
1076 _update = update
1077
1077
1078
1078
1079 def clean(repo, node, show_stats=True, quietempty=False):
1079 def clean(repo, node, show_stats=True, quietempty=False):
1080 """forcibly switch the working directory to node, clobbering changes"""
1080 """forcibly switch the working directory to node, clobbering changes"""
1081 stats = mergemod.clean_update(repo[node])
1081 stats = mergemod.clean_update(repo[node])
1082 assert stats.unresolvedcount == 0
1082 assert stats.unresolvedcount == 0
1083 if show_stats:
1083 if show_stats:
1084 _showstats(repo, stats, quietempty)
1084 _showstats(repo, stats, quietempty)
1085
1085
1086
1086
1087 # naming conflict in updatetotally()
1087 # naming conflict in updatetotally()
1088 _clean = clean
1088 _clean = clean
1089
1089
1090 _VALID_UPDATECHECKS = {
1090 _VALID_UPDATECHECKS = {
1091 mergemod.UPDATECHECK_ABORT,
1091 mergemod.UPDATECHECK_ABORT,
1092 mergemod.UPDATECHECK_NONE,
1092 mergemod.UPDATECHECK_NONE,
1093 mergemod.UPDATECHECK_LINEAR,
1093 mergemod.UPDATECHECK_LINEAR,
1094 mergemod.UPDATECHECK_NO_CONFLICT,
1094 mergemod.UPDATECHECK_NO_CONFLICT,
1095 }
1095 }
1096
1096
1097
1097
1098 def updatetotally(ui, repo, checkout, brev, clean=False, updatecheck=None):
1098 def updatetotally(ui, repo, checkout, brev, clean=False, updatecheck=None):
1099 """Update the working directory with extra care for non-file components
1099 """Update the working directory with extra care for non-file components
1100
1100
1101 This takes care of non-file components below:
1101 This takes care of non-file components below:
1102
1102
1103 :bookmark: might be advanced or (in)activated
1103 :bookmark: might be advanced or (in)activated
1104
1104
1105 This takes arguments below:
1105 This takes arguments below:
1106
1106
1107 :checkout: to which revision the working directory is updated
1107 :checkout: to which revision the working directory is updated
1108 :brev: a name, which might be a bookmark to be activated after updating
1108 :brev: a name, which might be a bookmark to be activated after updating
1109 :clean: whether changes in the working directory can be discarded
1109 :clean: whether changes in the working directory can be discarded
1110 :updatecheck: how to deal with a dirty working directory
1110 :updatecheck: how to deal with a dirty working directory
1111
1111
1112 Valid values for updatecheck are the UPDATECHECK_* constants
1112 Valid values for updatecheck are the UPDATECHECK_* constants
1113 defined in the merge module. Passing `None` will result in using the
1113 defined in the merge module. Passing `None` will result in using the
1114 configured default.
1114 configured default.
1115
1115
1116 * ABORT: abort if the working directory is dirty
1116 * ABORT: abort if the working directory is dirty
1117 * NONE: don't check (merge working directory changes into destination)
1117 * NONE: don't check (merge working directory changes into destination)
1118 * LINEAR: check that update is linear before merging working directory
1118 * LINEAR: check that update is linear before merging working directory
1119 changes into destination
1119 changes into destination
1120 * NO_CONFLICT: check that the update does not result in file merges
1120 * NO_CONFLICT: check that the update does not result in file merges
1121
1121
1122 This returns whether conflict is detected at updating or not.
1122 This returns whether conflict is detected at updating or not.
1123 """
1123 """
1124 if updatecheck is None:
1124 if updatecheck is None:
1125 updatecheck = ui.config(b'commands', b'update.check')
1125 updatecheck = ui.config(b'commands', b'update.check')
1126 if updatecheck not in _VALID_UPDATECHECKS:
1126 if updatecheck not in _VALID_UPDATECHECKS:
1127 # If not configured, or invalid value configured
1127 # If not configured, or invalid value configured
1128 updatecheck = mergemod.UPDATECHECK_LINEAR
1128 updatecheck = mergemod.UPDATECHECK_LINEAR
1129 if updatecheck not in _VALID_UPDATECHECKS:
1129 if updatecheck not in _VALID_UPDATECHECKS:
1130 raise ValueError(
1130 raise ValueError(
1131 r'Invalid updatecheck value %r (can accept %r)'
1131 r'Invalid updatecheck value %r (can accept %r)'
1132 % (updatecheck, _VALID_UPDATECHECKS)
1132 % (updatecheck, _VALID_UPDATECHECKS)
1133 )
1133 )
1134 with repo.wlock():
1134 with repo.wlock():
1135 movemarkfrom = None
1135 movemarkfrom = None
1136 warndest = False
1136 warndest = False
1137 if checkout is None:
1137 if checkout is None:
1138 updata = destutil.destupdate(repo, clean=clean)
1138 updata = destutil.destupdate(repo, clean=clean)
1139 checkout, movemarkfrom, brev = updata
1139 checkout, movemarkfrom, brev = updata
1140 warndest = True
1140 warndest = True
1141
1141
1142 if clean:
1142 if clean:
1143 ret = _clean(repo, checkout)
1143 ret = _clean(repo, checkout)
1144 else:
1144 else:
1145 if updatecheck == mergemod.UPDATECHECK_ABORT:
1145 if updatecheck == mergemod.UPDATECHECK_ABORT:
1146 cmdutil.bailifchanged(repo, merge=False)
1146 cmdutil.bailifchanged(repo, merge=False)
1147 updatecheck = mergemod.UPDATECHECK_NONE
1147 updatecheck = mergemod.UPDATECHECK_NONE
1148 ret = _update(repo, checkout, updatecheck=updatecheck)
1148 ret = _update(repo, checkout, updatecheck=updatecheck)
1149
1149
1150 if not ret and movemarkfrom:
1150 if not ret and movemarkfrom:
1151 if movemarkfrom == repo[b'.'].node():
1151 if movemarkfrom == repo[b'.'].node():
1152 pass # no-op update
1152 pass # no-op update
1153 elif bookmarks.update(repo, [movemarkfrom], repo[b'.'].node()):
1153 elif bookmarks.update(repo, [movemarkfrom], repo[b'.'].node()):
1154 b = ui.label(repo._activebookmark, b'bookmarks.active')
1154 b = ui.label(repo._activebookmark, b'bookmarks.active')
1155 ui.status(_(b"updating bookmark %s\n") % b)
1155 ui.status(_(b"updating bookmark %s\n") % b)
1156 else:
1156 else:
1157 # this can happen with a non-linear update
1157 # this can happen with a non-linear update
1158 b = ui.label(repo._activebookmark, b'bookmarks')
1158 b = ui.label(repo._activebookmark, b'bookmarks')
1159 ui.status(_(b"(leaving bookmark %s)\n") % b)
1159 ui.status(_(b"(leaving bookmark %s)\n") % b)
1160 bookmarks.deactivate(repo)
1160 bookmarks.deactivate(repo)
1161 elif brev in repo._bookmarks:
1161 elif brev in repo._bookmarks:
1162 if brev != repo._activebookmark:
1162 if brev != repo._activebookmark:
1163 b = ui.label(brev, b'bookmarks.active')
1163 b = ui.label(brev, b'bookmarks.active')
1164 ui.status(_(b"(activating bookmark %s)\n") % b)
1164 ui.status(_(b"(activating bookmark %s)\n") % b)
1165 bookmarks.activate(repo, brev)
1165 bookmarks.activate(repo, brev)
1166 elif brev:
1166 elif brev:
1167 if repo._activebookmark:
1167 if repo._activebookmark:
1168 b = ui.label(repo._activebookmark, b'bookmarks')
1168 b = ui.label(repo._activebookmark, b'bookmarks')
1169 ui.status(_(b"(leaving bookmark %s)\n") % b)
1169 ui.status(_(b"(leaving bookmark %s)\n") % b)
1170 bookmarks.deactivate(repo)
1170 bookmarks.deactivate(repo)
1171
1171
1172 if warndest:
1172 if warndest:
1173 destutil.statusotherdests(ui, repo)
1173 destutil.statusotherdests(ui, repo)
1174
1174
1175 return ret
1175 return ret
1176
1176
1177
1177
1178 def merge(
1178 def merge(
1179 ctx, force=False, remind=True, labels=None,
1179 ctx, force=False, remind=True, labels=None,
1180 ):
1180 ):
1181 """Branch merge with node, resolving changes. Return true if any
1181 """Branch merge with node, resolving changes. Return true if any
1182 unresolved conflicts."""
1182 unresolved conflicts."""
1183 repo = ctx.repo()
1183 repo = ctx.repo()
1184 stats = mergemod.merge(ctx, force=force, labels=labels)
1184 stats = mergemod.merge(ctx, force=force, labels=labels)
1185 _showstats(repo, stats)
1185 _showstats(repo, stats)
1186 if stats.unresolvedcount:
1186 if stats.unresolvedcount:
1187 repo.ui.status(
1187 repo.ui.status(
1188 _(
1188 _(
1189 b"use 'hg resolve' to retry unresolved file merges "
1189 b"use 'hg resolve' to retry unresolved file merges "
1190 b"or 'hg merge --abort' to abandon\n"
1190 b"or 'hg merge --abort' to abandon\n"
1191 )
1191 )
1192 )
1192 )
1193 elif remind:
1193 elif remind:
1194 repo.ui.status(_(b"(branch merge, don't forget to commit)\n"))
1194 repo.ui.status(_(b"(branch merge, don't forget to commit)\n"))
1195 return stats.unresolvedcount > 0
1195 return stats.unresolvedcount > 0
1196
1196
1197
1197
1198 def abortmerge(ui, repo):
1198 def abortmerge(ui, repo):
1199 ms = mergestatemod.mergestate.read(repo)
1199 ms = mergestatemod.mergestate.read(repo)
1200 if ms.active():
1200 if ms.active():
1201 # there were conflicts
1201 # there were conflicts
1202 node = ms.localctx.hex()
1202 node = ms.localctx.hex()
1203 else:
1203 else:
1204 # there were no conficts, mergestate was not stored
1204 # there were no conficts, mergestate was not stored
1205 node = repo[b'.'].hex()
1205 node = repo[b'.'].hex()
1206
1206
1207 repo.ui.status(_(b"aborting the merge, updating back to %s\n") % node[:12])
1207 repo.ui.status(_(b"aborting the merge, updating back to %s\n") % node[:12])
1208 stats = mergemod.clean_update(repo[node])
1208 stats = mergemod.clean_update(repo[node])
1209 assert stats.unresolvedcount == 0
1209 assert stats.unresolvedcount == 0
1210 _showstats(repo, stats)
1210 _showstats(repo, stats)
1211
1211
1212
1212
1213 def _incoming(
1213 def _incoming(
1214 displaychlist, subreporecurse, ui, repo, source, opts, buffered=False
1214 displaychlist, subreporecurse, ui, repo, source, opts, buffered=False
1215 ):
1215 ):
1216 """
1216 """
1217 Helper for incoming / gincoming.
1217 Helper for incoming / gincoming.
1218 displaychlist gets called with
1218 displaychlist gets called with
1219 (remoterepo, incomingchangesetlist, displayer) parameters,
1219 (remoterepo, incomingchangesetlist, displayer) parameters,
1220 and is supposed to contain only code that can't be unified.
1220 and is supposed to contain only code that can't be unified.
1221 """
1221 """
1222 source, branches = parseurl(ui.expandpath(source), opts.get(b'branch'))
1222 source, branches = parseurl(ui.expandpath(source), opts.get(b'branch'))
1223 other = peer(repo, opts, source)
1223 other = peer(repo, opts, source)
1224 ui.status(_(b'comparing with %s\n') % util.hidepassword(source))
1224 ui.status(_(b'comparing with %s\n') % util.hidepassword(source))
1225 revs, checkout = addbranchrevs(repo, other, branches, opts.get(b'rev'))
1225 revs, checkout = addbranchrevs(repo, other, branches, opts.get(b'rev'))
1226
1226
1227 if revs:
1227 if revs:
1228 revs = [other.lookup(rev) for rev in revs]
1228 revs = [other.lookup(rev) for rev in revs]
1229 other, chlist, cleanupfn = bundlerepo.getremotechanges(
1229 other, chlist, cleanupfn = bundlerepo.getremotechanges(
1230 ui, repo, other, revs, opts[b"bundle"], opts[b"force"]
1230 ui, repo, other, revs, opts[b"bundle"], opts[b"force"]
1231 )
1231 )
1232 try:
1232 try:
1233 if not chlist:
1233 if not chlist:
1234 ui.status(_(b"no changes found\n"))
1234 ui.status(_(b"no changes found\n"))
1235 return subreporecurse()
1235 return subreporecurse()
1236 ui.pager(b'incoming')
1236 ui.pager(b'incoming')
1237 displayer = logcmdutil.changesetdisplayer(
1237 displayer = logcmdutil.changesetdisplayer(
1238 ui, other, opts, buffered=buffered
1238 ui, other, opts, buffered=buffered
1239 )
1239 )
1240 displaychlist(other, chlist, displayer)
1240 displaychlist(other, chlist, displayer)
1241 displayer.close()
1241 displayer.close()
1242 finally:
1242 finally:
1243 cleanupfn()
1243 cleanupfn()
1244 subreporecurse()
1244 subreporecurse()
1245 return 0 # exit code is zero since we found incoming changes
1245 return 0 # exit code is zero since we found incoming changes
1246
1246
1247
1247
1248 def incoming(ui, repo, source, opts):
1248 def incoming(ui, repo, source, opts):
1249 def subreporecurse():
1249 def subreporecurse():
1250 ret = 1
1250 ret = 1
1251 if opts.get(b'subrepos'):
1251 if opts.get(b'subrepos'):
1252 ctx = repo[None]
1252 ctx = repo[None]
1253 for subpath in sorted(ctx.substate):
1253 for subpath in sorted(ctx.substate):
1254 sub = ctx.sub(subpath)
1254 sub = ctx.sub(subpath)
1255 ret = min(ret, sub.incoming(ui, source, opts))
1255 ret = min(ret, sub.incoming(ui, source, opts))
1256 return ret
1256 return ret
1257
1257
1258 def display(other, chlist, displayer):
1258 def display(other, chlist, displayer):
1259 limit = logcmdutil.getlimit(opts)
1259 limit = logcmdutil.getlimit(opts)
1260 if opts.get(b'newest_first'):
1260 if opts.get(b'newest_first'):
1261 chlist.reverse()
1261 chlist.reverse()
1262 count = 0
1262 count = 0
1263 for n in chlist:
1263 for n in chlist:
1264 if limit is not None and count >= limit:
1264 if limit is not None and count >= limit:
1265 break
1265 break
1266 parents = [p for p in other.changelog.parents(n) if p != nullid]
1266 parents = [p for p in other.changelog.parents(n) if p != nullid]
1267 if opts.get(b'no_merges') and len(parents) == 2:
1267 if opts.get(b'no_merges') and len(parents) == 2:
1268 continue
1268 continue
1269 count += 1
1269 count += 1
1270 displayer.show(other[n])
1270 displayer.show(other[n])
1271
1271
1272 return _incoming(display, subreporecurse, ui, repo, source, opts)
1272 return _incoming(display, subreporecurse, ui, repo, source, opts)
1273
1273
1274
1274
1275 def _outgoing(ui, repo, dest, opts):
1275 def _outgoing(ui, repo, dest, opts):
1276 path = ui.paths.getpath(dest, default=(b'default-push', b'default'))
1276 path = ui.paths.getpath(dest, default=(b'default-push', b'default'))
1277 if not path:
1277 if not path:
1278 raise error.Abort(
1278 raise error.Abort(
1279 _(b'default repository not configured!'),
1279 _(b'default repository not configured!'),
1280 hint=_(b"see 'hg help config.paths'"),
1280 hint=_(b"see 'hg help config.paths'"),
1281 )
1281 )
1282 dest = path.pushloc or path.loc
1282 dest = path.pushloc or path.loc
1283 branches = path.branch, opts.get(b'branch') or []
1283 branches = path.branch, opts.get(b'branch') or []
1284
1284
1285 ui.status(_(b'comparing with %s\n') % util.hidepassword(dest))
1285 ui.status(_(b'comparing with %s\n') % util.hidepassword(dest))
1286 revs, checkout = addbranchrevs(repo, repo, branches, opts.get(b'rev'))
1286 revs, checkout = addbranchrevs(repo, repo, branches, opts.get(b'rev'))
1287 if revs:
1287 if revs:
1288 revs = [repo[rev].node() for rev in scmutil.revrange(repo, revs)]
1288 revs = [repo[rev].node() for rev in scmutil.revrange(repo, revs)]
1289
1289
1290 other = peer(repo, opts, dest)
1290 other = peer(repo, opts, dest)
1291 outgoing = discovery.findcommonoutgoing(
1291 outgoing = discovery.findcommonoutgoing(
1292 repo, other, revs, force=opts.get(b'force')
1292 repo, other, revs, force=opts.get(b'force')
1293 )
1293 )
1294 o = outgoing.missing
1294 o = outgoing.missing
1295 if not o:
1295 if not o:
1296 scmutil.nochangesfound(repo.ui, repo, outgoing.excluded)
1296 scmutil.nochangesfound(repo.ui, repo, outgoing.excluded)
1297 return o, other
1297 return o, other
1298
1298
1299
1299
1300 def outgoing(ui, repo, dest, opts):
1300 def outgoing(ui, repo, dest, opts):
1301 def recurse():
1301 def recurse():
1302 ret = 1
1302 ret = 1
1303 if opts.get(b'subrepos'):
1303 if opts.get(b'subrepos'):
1304 ctx = repo[None]
1304 ctx = repo[None]
1305 for subpath in sorted(ctx.substate):
1305 for subpath in sorted(ctx.substate):
1306 sub = ctx.sub(subpath)
1306 sub = ctx.sub(subpath)
1307 ret = min(ret, sub.outgoing(ui, dest, opts))
1307 ret = min(ret, sub.outgoing(ui, dest, opts))
1308 return ret
1308 return ret
1309
1309
1310 limit = logcmdutil.getlimit(opts)
1310 limit = logcmdutil.getlimit(opts)
1311 o, other = _outgoing(ui, repo, dest, opts)
1311 o, other = _outgoing(ui, repo, dest, opts)
1312 if not o:
1312 if not o:
1313 cmdutil.outgoinghooks(ui, repo, other, opts, o)
1313 cmdutil.outgoinghooks(ui, repo, other, opts, o)
1314 return recurse()
1314 return recurse()
1315
1315
1316 if opts.get(b'newest_first'):
1316 if opts.get(b'newest_first'):
1317 o.reverse()
1317 o.reverse()
1318 ui.pager(b'outgoing')
1318 ui.pager(b'outgoing')
1319 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
1319 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
1320 count = 0
1320 count = 0
1321 for n in o:
1321 for n in o:
1322 if limit is not None and count >= limit:
1322 if limit is not None and count >= limit:
1323 break
1323 break
1324 parents = [p for p in repo.changelog.parents(n) if p != nullid]
1324 parents = [p for p in repo.changelog.parents(n) if p != nullid]
1325 if opts.get(b'no_merges') and len(parents) == 2:
1325 if opts.get(b'no_merges') and len(parents) == 2:
1326 continue
1326 continue
1327 count += 1
1327 count += 1
1328 displayer.show(repo[n])
1328 displayer.show(repo[n])
1329 displayer.close()
1329 displayer.close()
1330 cmdutil.outgoinghooks(ui, repo, other, opts, o)
1330 cmdutil.outgoinghooks(ui, repo, other, opts, o)
1331 recurse()
1331 recurse()
1332 return 0 # exit code is zero since we found outgoing changes
1332 return 0 # exit code is zero since we found outgoing changes
1333
1333
1334
1334
1335 def verify(repo, level=None):
1335 def verify(repo, level=None):
1336 """verify the consistency of a repository"""
1336 """verify the consistency of a repository"""
1337 ret = verifymod.verify(repo, level=level)
1337 ret = verifymod.verify(repo, level=level)
1338
1338
1339 # Broken subrepo references in hidden csets don't seem worth worrying about,
1339 # Broken subrepo references in hidden csets don't seem worth worrying about,
1340 # since they can't be pushed/pulled, and --hidden can be used if they are a
1340 # since they can't be pushed/pulled, and --hidden can be used if they are a
1341 # concern.
1341 # concern.
1342
1342
1343 # pathto() is needed for -R case
1343 # pathto() is needed for -R case
1344 revs = repo.revs(
1344 revs = repo.revs(
1345 b"filelog(%s)", util.pathto(repo.root, repo.getcwd(), b'.hgsubstate')
1345 b"filelog(%s)", util.pathto(repo.root, repo.getcwd(), b'.hgsubstate')
1346 )
1346 )
1347
1347
1348 if revs:
1348 if revs:
1349 repo.ui.status(_(b'checking subrepo links\n'))
1349 repo.ui.status(_(b'checking subrepo links\n'))
1350 for rev in revs:
1350 for rev in revs:
1351 ctx = repo[rev]
1351 ctx = repo[rev]
1352 try:
1352 try:
1353 for subpath in ctx.substate:
1353 for subpath in ctx.substate:
1354 try:
1354 try:
1355 ret = (
1355 ret = (
1356 ctx.sub(subpath, allowcreate=False).verify() or ret
1356 ctx.sub(subpath, allowcreate=False).verify() or ret
1357 )
1357 )
1358 except error.RepoError as e:
1358 except error.RepoError as e:
1359 repo.ui.warn(b'%d: %s\n' % (rev, e))
1359 repo.ui.warn(b'%d: %s\n' % (rev, e))
1360 except Exception:
1360 except Exception:
1361 repo.ui.warn(
1361 repo.ui.warn(
1362 _(b'.hgsubstate is corrupt in revision %s\n')
1362 _(b'.hgsubstate is corrupt in revision %s\n')
1363 % node.short(ctx.node())
1363 % node.short(ctx.node())
1364 )
1364 )
1365
1365
1366 return ret
1366 return ret
1367
1367
1368
1368
1369 def remoteui(src, opts):
1369 def remoteui(src, opts):
1370 """build a remote ui from ui or repo and opts"""
1370 """build a remote ui from ui or repo and opts"""
1371 if util.safehasattr(src, b'baseui'): # looks like a repository
1371 if util.safehasattr(src, b'baseui'): # looks like a repository
1372 dst = src.baseui.copy() # drop repo-specific config
1372 dst = src.baseui.copy() # drop repo-specific config
1373 src = src.ui # copy target options from repo
1373 src = src.ui # copy target options from repo
1374 else: # assume it's a global ui object
1374 else: # assume it's a global ui object
1375 dst = src.copy() # keep all global options
1375 dst = src.copy() # keep all global options
1376
1376
1377 # copy ssh-specific options
1377 # copy ssh-specific options
1378 for o in b'ssh', b'remotecmd':
1378 for o in b'ssh', b'remotecmd':
1379 v = opts.get(o) or src.config(b'ui', o)
1379 v = opts.get(o) or src.config(b'ui', o)
1380 if v:
1380 if v:
1381 dst.setconfig(b"ui", o, v, b'copied')
1381 dst.setconfig(b"ui", o, v, b'copied')
1382
1382
1383 # copy bundle-specific options
1383 # copy bundle-specific options
1384 r = src.config(b'bundle', b'mainreporoot')
1384 r = src.config(b'bundle', b'mainreporoot')
1385 if r:
1385 if r:
1386 dst.setconfig(b'bundle', b'mainreporoot', r, b'copied')
1386 dst.setconfig(b'bundle', b'mainreporoot', r, b'copied')
1387
1387
1388 # copy selected local settings to the remote ui
1388 # copy selected local settings to the remote ui
1389 for sect in (b'auth', b'hostfingerprints', b'hostsecurity', b'http_proxy'):
1389 for sect in (b'auth', b'hostfingerprints', b'hostsecurity', b'http_proxy'):
1390 for key, val in src.configitems(sect):
1390 for key, val in src.configitems(sect):
1391 dst.setconfig(sect, key, val, b'copied')
1391 dst.setconfig(sect, key, val, b'copied')
1392 v = src.config(b'web', b'cacerts')
1392 v = src.config(b'web', b'cacerts')
1393 if v:
1393 if v:
1394 dst.setconfig(b'web', b'cacerts', util.expandpath(v), b'copied')
1394 dst.setconfig(b'web', b'cacerts', util.expandpath(v), b'copied')
1395
1395
1396 return dst
1396 return dst
1397
1397
1398
1398
1399 # Files of interest
1399 # Files of interest
1400 # Used to check if the repository has changed looking at mtime and size of
1400 # Used to check if the repository has changed looking at mtime and size of
1401 # these files.
1401 # these files.
1402 foi = [
1402 foi = [
1403 (b'spath', b'00changelog.i'),
1403 (b'spath', b'00changelog.i'),
1404 (b'spath', b'phaseroots'), # ! phase can change content at the same size
1404 (b'spath', b'phaseroots'), # ! phase can change content at the same size
1405 (b'spath', b'obsstore'),
1405 (b'spath', b'obsstore'),
1406 (b'path', b'bookmarks'), # ! bookmark can change content at the same size
1406 (b'path', b'bookmarks'), # ! bookmark can change content at the same size
1407 ]
1407 ]
1408
1408
1409
1409
1410 class cachedlocalrepo(object):
1410 class cachedlocalrepo(object):
1411 """Holds a localrepository that can be cached and reused."""
1411 """Holds a localrepository that can be cached and reused."""
1412
1412
1413 def __init__(self, repo):
1413 def __init__(self, repo):
1414 """Create a new cached repo from an existing repo.
1414 """Create a new cached repo from an existing repo.
1415
1415
1416 We assume the passed in repo was recently created. If the
1416 We assume the passed in repo was recently created. If the
1417 repo has changed between when it was created and when it was
1417 repo has changed between when it was created and when it was
1418 turned into a cache, it may not refresh properly.
1418 turned into a cache, it may not refresh properly.
1419 """
1419 """
1420 assert isinstance(repo, localrepo.localrepository)
1420 assert isinstance(repo, localrepo.localrepository)
1421 self._repo = repo
1421 self._repo = repo
1422 self._state, self.mtime = self._repostate()
1422 self._state, self.mtime = self._repostate()
1423 self._filtername = repo.filtername
1423 self._filtername = repo.filtername
1424
1424
1425 def fetch(self):
1425 def fetch(self):
1426 """Refresh (if necessary) and return a repository.
1426 """Refresh (if necessary) and return a repository.
1427
1427
1428 If the cached instance is out of date, it will be recreated
1428 If the cached instance is out of date, it will be recreated
1429 automatically and returned.
1429 automatically and returned.
1430
1430
1431 Returns a tuple of the repo and a boolean indicating whether a new
1431 Returns a tuple of the repo and a boolean indicating whether a new
1432 repo instance was created.
1432 repo instance was created.
1433 """
1433 """
1434 # We compare the mtimes and sizes of some well-known files to
1434 # We compare the mtimes and sizes of some well-known files to
1435 # determine if the repo changed. This is not precise, as mtimes
1435 # determine if the repo changed. This is not precise, as mtimes
1436 # are susceptible to clock skew and imprecise filesystems and
1436 # are susceptible to clock skew and imprecise filesystems and
1437 # file content can change while maintaining the same size.
1437 # file content can change while maintaining the same size.
1438
1438
1439 state, mtime = self._repostate()
1439 state, mtime = self._repostate()
1440 if state == self._state:
1440 if state == self._state:
1441 return self._repo, False
1441 return self._repo, False
1442
1442
1443 repo = repository(self._repo.baseui, self._repo.url())
1443 repo = repository(self._repo.baseui, self._repo.url())
1444 if self._filtername:
1444 if self._filtername:
1445 self._repo = repo.filtered(self._filtername)
1445 self._repo = repo.filtered(self._filtername)
1446 else:
1446 else:
1447 self._repo = repo.unfiltered()
1447 self._repo = repo.unfiltered()
1448 self._state = state
1448 self._state = state
1449 self.mtime = mtime
1449 self.mtime = mtime
1450
1450
1451 return self._repo, True
1451 return self._repo, True
1452
1452
1453 def _repostate(self):
1453 def _repostate(self):
1454 state = []
1454 state = []
1455 maxmtime = -1
1455 maxmtime = -1
1456 for attr, fname in foi:
1456 for attr, fname in foi:
1457 prefix = getattr(self._repo, attr)
1457 prefix = getattr(self._repo, attr)
1458 p = os.path.join(prefix, fname)
1458 p = os.path.join(prefix, fname)
1459 try:
1459 try:
1460 st = os.stat(p)
1460 st = os.stat(p)
1461 except OSError:
1461 except OSError:
1462 st = os.stat(prefix)
1462 st = os.stat(prefix)
1463 state.append((st[stat.ST_MTIME], st.st_size))
1463 state.append((st[stat.ST_MTIME], st.st_size))
1464 maxmtime = max(maxmtime, st[stat.ST_MTIME])
1464 maxmtime = max(maxmtime, st[stat.ST_MTIME])
1465
1465
1466 return tuple(state), maxmtime
1466 return tuple(state), maxmtime
1467
1467
1468 def copy(self):
1468 def copy(self):
1469 """Obtain a copy of this class instance.
1469 """Obtain a copy of this class instance.
1470
1470
1471 A new localrepository instance is obtained. The new instance should be
1471 A new localrepository instance is obtained. The new instance should be
1472 completely independent of the original.
1472 completely independent of the original.
1473 """
1473 """
1474 repo = repository(self._repo.baseui, self._repo.origroot)
1474 repo = repository(self._repo.baseui, self._repo.origroot)
1475 if self._filtername:
1475 if self._filtername:
1476 repo = repo.filtered(self._filtername)
1476 repo = repo.filtered(self._filtername)
1477 else:
1477 else:
1478 repo = repo.unfiltered()
1478 repo = repo.unfiltered()
1479 c = cachedlocalrepo(repo)
1479 c = cachedlocalrepo(repo)
1480 c._state = self._state
1480 c._state = self._state
1481 c.mtime = self.mtime
1481 c.mtime = self.mtime
1482 return c
1482 return c
@@ -1,933 +1,933 b''
1 Setting up test
1 Setting up test
2
2
3 $ hg init test
3 $ hg init test
4 $ cd test
4 $ cd test
5 $ echo 0 > afile
5 $ echo 0 > afile
6 $ hg add afile
6 $ hg add afile
7 $ hg commit -m "0.0"
7 $ hg commit -m "0.0"
8 $ echo 1 >> afile
8 $ echo 1 >> afile
9 $ hg commit -m "0.1"
9 $ hg commit -m "0.1"
10 $ echo 2 >> afile
10 $ echo 2 >> afile
11 $ hg commit -m "0.2"
11 $ hg commit -m "0.2"
12 $ echo 3 >> afile
12 $ echo 3 >> afile
13 $ hg commit -m "0.3"
13 $ hg commit -m "0.3"
14 $ hg update -C 0
14 $ hg update -C 0
15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 $ echo 1 >> afile
16 $ echo 1 >> afile
17 $ hg commit -m "1.1"
17 $ hg commit -m "1.1"
18 created new head
18 created new head
19 $ echo 2 >> afile
19 $ echo 2 >> afile
20 $ hg commit -m "1.2"
20 $ hg commit -m "1.2"
21 $ echo "a line" > fred
21 $ echo "a line" > fred
22 $ echo 3 >> afile
22 $ echo 3 >> afile
23 $ hg add fred
23 $ hg add fred
24 $ hg commit -m "1.3"
24 $ hg commit -m "1.3"
25 $ hg mv afile adifferentfile
25 $ hg mv afile adifferentfile
26 $ hg commit -m "1.3m"
26 $ hg commit -m "1.3m"
27 $ hg update -C 3
27 $ hg update -C 3
28 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
28 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
29 $ hg mv afile anotherfile
29 $ hg mv afile anotherfile
30 $ hg commit -m "0.3m"
30 $ hg commit -m "0.3m"
31 $ hg verify
31 $ hg verify
32 checking changesets
32 checking changesets
33 checking manifests
33 checking manifests
34 crosschecking files in changesets and manifests
34 crosschecking files in changesets and manifests
35 checking files
35 checking files
36 checked 9 changesets with 7 changes to 4 files
36 checked 9 changesets with 7 changes to 4 files
37 $ cd ..
37 $ cd ..
38 $ hg init empty
38 $ hg init empty
39
39
40 Bundle and phase
40 Bundle and phase
41
41
42 $ hg -R test phase --force --secret 0
42 $ hg -R test phase --force --secret 0
43 $ hg -R test bundle phase.hg empty
43 $ hg -R test bundle phase.hg empty
44 searching for changes
44 searching for changes
45 no changes found (ignored 9 secret changesets)
45 no changes found (ignored 9 secret changesets)
46 [1]
46 [1]
47 $ hg -R test phase --draft -r 'head()'
47 $ hg -R test phase --draft -r 'head()'
48
48
49 Bundle --all
49 Bundle --all
50
50
51 $ hg -R test bundle --all all.hg
51 $ hg -R test bundle --all all.hg
52 9 changesets found
52 9 changesets found
53
53
54 Bundle test to full.hg
54 Bundle test to full.hg
55
55
56 $ hg -R test bundle full.hg empty
56 $ hg -R test bundle full.hg empty
57 searching for changes
57 searching for changes
58 9 changesets found
58 9 changesets found
59
59
60 Unbundle full.hg in test
60 Unbundle full.hg in test
61
61
62 $ hg -R test unbundle full.hg
62 $ hg -R test unbundle full.hg
63 adding changesets
63 adding changesets
64 adding manifests
64 adding manifests
65 adding file changes
65 adding file changes
66 added 0 changesets with 0 changes to 4 files
66 added 0 changesets with 0 changes to 4 files
67 (run 'hg update' to get a working copy)
67 (run 'hg update' to get a working copy)
68
68
69 Verify empty
69 Verify empty
70
70
71 $ hg -R empty heads
71 $ hg -R empty heads
72 [1]
72 [1]
73 $ hg -R empty verify
73 $ hg -R empty verify
74 checking changesets
74 checking changesets
75 checking manifests
75 checking manifests
76 crosschecking files in changesets and manifests
76 crosschecking files in changesets and manifests
77 checking files
77 checking files
78 checked 0 changesets with 0 changes to 0 files
78 checked 0 changesets with 0 changes to 0 files
79
79
80 #if repobundlerepo
80 #if repobundlerepo
81
81
82 Pull full.hg into test (using --cwd)
82 Pull full.hg into test (using --cwd)
83
83
84 $ hg --cwd test pull ../full.hg
84 $ hg --cwd test pull ../full.hg
85 pulling from ../full.hg
85 pulling from ../full.hg
86 searching for changes
86 searching for changes
87 no changes found
87 no changes found
88
88
89 Verify that there are no leaked temporary files after pull (issue2797)
89 Verify that there are no leaked temporary files after pull (issue2797)
90
90
91 $ ls test/.hg | grep .hg10un
91 $ ls test/.hg | grep .hg10un
92 [1]
92 [1]
93
93
94 Pull full.hg into empty (using --cwd)
94 Pull full.hg into empty (using --cwd)
95
95
96 $ hg --cwd empty pull ../full.hg
96 $ hg --cwd empty pull ../full.hg
97 pulling from ../full.hg
97 pulling from ../full.hg
98 requesting all changes
98 requesting all changes
99 adding changesets
99 adding changesets
100 adding manifests
100 adding manifests
101 adding file changes
101 adding file changes
102 added 9 changesets with 7 changes to 4 files (+1 heads)
102 added 9 changesets with 7 changes to 4 files (+1 heads)
103 new changesets f9ee2f85a263:aa35859c02ea (9 drafts)
103 new changesets f9ee2f85a263:aa35859c02ea (9 drafts)
104 (run 'hg heads' to see heads, 'hg merge' to merge)
104 (run 'hg heads' to see heads, 'hg merge' to merge)
105
105
106 Rollback empty
106 Rollback empty
107
107
108 $ hg -R empty rollback
108 $ hg -R empty rollback
109 repository tip rolled back to revision -1 (undo pull)
109 repository tip rolled back to revision -1 (undo pull)
110
110
111 Pull full.hg into empty again (using --cwd)
111 Pull full.hg into empty again (using --cwd)
112
112
113 $ hg --cwd empty pull ../full.hg
113 $ hg --cwd empty pull ../full.hg
114 pulling from ../full.hg
114 pulling from ../full.hg
115 requesting all changes
115 requesting all changes
116 adding changesets
116 adding changesets
117 adding manifests
117 adding manifests
118 adding file changes
118 adding file changes
119 added 9 changesets with 7 changes to 4 files (+1 heads)
119 added 9 changesets with 7 changes to 4 files (+1 heads)
120 new changesets f9ee2f85a263:aa35859c02ea (9 drafts)
120 new changesets f9ee2f85a263:aa35859c02ea (9 drafts)
121 (run 'hg heads' to see heads, 'hg merge' to merge)
121 (run 'hg heads' to see heads, 'hg merge' to merge)
122
122
123 Pull full.hg into test (using -R)
123 Pull full.hg into test (using -R)
124
124
125 $ hg -R test pull full.hg
125 $ hg -R test pull full.hg
126 pulling from full.hg
126 pulling from full.hg
127 searching for changes
127 searching for changes
128 no changes found
128 no changes found
129
129
130 Pull full.hg into empty (using -R)
130 Pull full.hg into empty (using -R)
131
131
132 $ hg -R empty pull full.hg
132 $ hg -R empty pull full.hg
133 pulling from full.hg
133 pulling from full.hg
134 searching for changes
134 searching for changes
135 no changes found
135 no changes found
136
136
137 Rollback empty
137 Rollback empty
138
138
139 $ hg -R empty rollback
139 $ hg -R empty rollback
140 repository tip rolled back to revision -1 (undo pull)
140 repository tip rolled back to revision -1 (undo pull)
141
141
142 Pull full.hg into empty again (using -R)
142 Pull full.hg into empty again (using -R)
143
143
144 $ hg -R empty pull full.hg
144 $ hg -R empty pull full.hg
145 pulling from full.hg
145 pulling from full.hg
146 requesting all changes
146 requesting all changes
147 adding changesets
147 adding changesets
148 adding manifests
148 adding manifests
149 adding file changes
149 adding file changes
150 added 9 changesets with 7 changes to 4 files (+1 heads)
150 added 9 changesets with 7 changes to 4 files (+1 heads)
151 new changesets f9ee2f85a263:aa35859c02ea (9 drafts)
151 new changesets f9ee2f85a263:aa35859c02ea (9 drafts)
152 (run 'hg heads' to see heads, 'hg merge' to merge)
152 (run 'hg heads' to see heads, 'hg merge' to merge)
153
153
154 Log -R full.hg in fresh empty
154 Log -R full.hg in fresh empty
155
155
156 $ rm -r empty
156 $ rm -r empty
157 $ hg init empty
157 $ hg init empty
158 $ cd empty
158 $ cd empty
159 $ hg -R bundle://../full.hg log
159 $ hg -R bundle://../full.hg log
160 changeset: 8:aa35859c02ea
160 changeset: 8:aa35859c02ea
161 tag: tip
161 tag: tip
162 parent: 3:eebf5a27f8ca
162 parent: 3:eebf5a27f8ca
163 user: test
163 user: test
164 date: Thu Jan 01 00:00:00 1970 +0000
164 date: Thu Jan 01 00:00:00 1970 +0000
165 summary: 0.3m
165 summary: 0.3m
166
166
167 changeset: 7:a6a34bfa0076
167 changeset: 7:a6a34bfa0076
168 user: test
168 user: test
169 date: Thu Jan 01 00:00:00 1970 +0000
169 date: Thu Jan 01 00:00:00 1970 +0000
170 summary: 1.3m
170 summary: 1.3m
171
171
172 changeset: 6:7373c1169842
172 changeset: 6:7373c1169842
173 user: test
173 user: test
174 date: Thu Jan 01 00:00:00 1970 +0000
174 date: Thu Jan 01 00:00:00 1970 +0000
175 summary: 1.3
175 summary: 1.3
176
176
177 changeset: 5:1bb50a9436a7
177 changeset: 5:1bb50a9436a7
178 user: test
178 user: test
179 date: Thu Jan 01 00:00:00 1970 +0000
179 date: Thu Jan 01 00:00:00 1970 +0000
180 summary: 1.2
180 summary: 1.2
181
181
182 changeset: 4:095197eb4973
182 changeset: 4:095197eb4973
183 parent: 0:f9ee2f85a263
183 parent: 0:f9ee2f85a263
184 user: test
184 user: test
185 date: Thu Jan 01 00:00:00 1970 +0000
185 date: Thu Jan 01 00:00:00 1970 +0000
186 summary: 1.1
186 summary: 1.1
187
187
188 changeset: 3:eebf5a27f8ca
188 changeset: 3:eebf5a27f8ca
189 user: test
189 user: test
190 date: Thu Jan 01 00:00:00 1970 +0000
190 date: Thu Jan 01 00:00:00 1970 +0000
191 summary: 0.3
191 summary: 0.3
192
192
193 changeset: 2:e38ba6f5b7e0
193 changeset: 2:e38ba6f5b7e0
194 user: test
194 user: test
195 date: Thu Jan 01 00:00:00 1970 +0000
195 date: Thu Jan 01 00:00:00 1970 +0000
196 summary: 0.2
196 summary: 0.2
197
197
198 changeset: 1:34c2bf6b0626
198 changeset: 1:34c2bf6b0626
199 user: test
199 user: test
200 date: Thu Jan 01 00:00:00 1970 +0000
200 date: Thu Jan 01 00:00:00 1970 +0000
201 summary: 0.1
201 summary: 0.1
202
202
203 changeset: 0:f9ee2f85a263
203 changeset: 0:f9ee2f85a263
204 user: test
204 user: test
205 date: Thu Jan 01 00:00:00 1970 +0000
205 date: Thu Jan 01 00:00:00 1970 +0000
206 summary: 0.0
206 summary: 0.0
207
207
208 Make sure bundlerepo doesn't leak tempfiles (issue2491)
208 Make sure bundlerepo doesn't leak tempfiles (issue2491)
209
209
210 $ ls .hg
210 $ ls .hg
211 00changelog.i
211 00changelog.i
212 cache
212 cache
213 requires
213 requires
214 store
214 store
215 wcache
215 wcache
216
216
217 Pull ../full.hg into empty (with hook)
217 Pull ../full.hg into empty (with hook)
218
218
219 $ cat >> .hg/hgrc <<EOF
219 $ cat >> .hg/hgrc <<EOF
220 > [hooks]
220 > [hooks]
221 > changegroup = sh -c "printenv.py --line changegroup"
221 > changegroup = sh -c "printenv.py --line changegroup"
222 > EOF
222 > EOF
223
223
224 doesn't work (yet ?)
224 doesn't work (yet ?)
225 NOTE: msys is mangling the URL below
225 NOTE: msys is mangling the URL below
226
226
227 hg -R bundle://../full.hg verify
227 hg -R bundle://../full.hg verify
228
228
229 $ hg pull bundle://../full.hg
229 $ hg pull bundle://../full.hg
230 pulling from bundle:../full.hg
230 pulling from bundle:../full.hg
231 requesting all changes
231 requesting all changes
232 adding changesets
232 adding changesets
233 adding manifests
233 adding manifests
234 adding file changes
234 adding file changes
235 added 9 changesets with 7 changes to 4 files (+1 heads)
235 added 9 changesets with 7 changes to 4 files (+1 heads)
236 new changesets f9ee2f85a263:aa35859c02ea (9 drafts)
236 new changesets f9ee2f85a263:aa35859c02ea (9 drafts)
237 changegroup hook: HG_HOOKNAME=changegroup
237 changegroup hook: HG_HOOKNAME=changegroup
238 HG_HOOKTYPE=changegroup
238 HG_HOOKTYPE=changegroup
239 HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735
239 HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735
240 HG_NODE_LAST=aa35859c02ea8bd48da5da68cd2740ac71afcbaf
240 HG_NODE_LAST=aa35859c02ea8bd48da5da68cd2740ac71afcbaf
241 HG_SOURCE=pull
241 HG_SOURCE=pull
242 HG_TXNID=TXN:$ID$
242 HG_TXNID=TXN:$ID$
243 HG_TXNNAME=pull
243 HG_TXNNAME=pull
244 bundle:../full.hg (no-msys !)
244 bundle:../full.hg (no-msys !)
245 bundle;../full.hg (msys !)
245 bundle;../full.hg (msys !)
246 HG_URL=bundle:../full.hg (no-msys !)
246 HG_URL=bundle:../full.hg (no-msys !)
247 HG_URL=bundle;../full.hg (msys !)
247 HG_URL=bundle;../full.hg (msys !)
248
248
249 (run 'hg heads' to see heads, 'hg merge' to merge)
249 (run 'hg heads' to see heads, 'hg merge' to merge)
250
250
251 Rollback empty
251 Rollback empty
252
252
253 $ hg rollback
253 $ hg rollback
254 repository tip rolled back to revision -1 (undo pull)
254 repository tip rolled back to revision -1 (undo pull)
255 $ cd ..
255 $ cd ..
256
256
257 Log -R bundle:empty+full.hg
257 Log -R bundle:empty+full.hg
258
258
259 $ hg -R bundle:empty+full.hg log --template="{rev} "; echo ""
259 $ hg -R bundle:empty+full.hg log --template="{rev} "; echo ""
260 8 7 6 5 4 3 2 1 0
260 8 7 6 5 4 3 2 1 0
261
261
262 Pull full.hg into empty again (using -R; with hook)
262 Pull full.hg into empty again (using -R; with hook)
263
263
264 $ hg -R empty pull full.hg
264 $ hg -R empty pull full.hg
265 pulling from full.hg
265 pulling from full.hg
266 requesting all changes
266 requesting all changes
267 adding changesets
267 adding changesets
268 adding manifests
268 adding manifests
269 adding file changes
269 adding file changes
270 added 9 changesets with 7 changes to 4 files (+1 heads)
270 added 9 changesets with 7 changes to 4 files (+1 heads)
271 new changesets f9ee2f85a263:aa35859c02ea (9 drafts)
271 new changesets f9ee2f85a263:aa35859c02ea (9 drafts)
272 changegroup hook: HG_HOOKNAME=changegroup
272 changegroup hook: HG_HOOKNAME=changegroup
273 HG_HOOKTYPE=changegroup
273 HG_HOOKTYPE=changegroup
274 HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735
274 HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735
275 HG_NODE_LAST=aa35859c02ea8bd48da5da68cd2740ac71afcbaf
275 HG_NODE_LAST=aa35859c02ea8bd48da5da68cd2740ac71afcbaf
276 HG_SOURCE=pull
276 HG_SOURCE=pull
277 HG_TXNID=TXN:$ID$
277 HG_TXNID=TXN:$ID$
278 HG_TXNNAME=pull
278 HG_TXNNAME=pull
279 bundle:empty+full.hg
279 bundle:empty+full.hg
280 HG_URL=bundle:empty+full.hg
280 HG_URL=bundle:empty+full.hg
281
281
282 (run 'hg heads' to see heads, 'hg merge' to merge)
282 (run 'hg heads' to see heads, 'hg merge' to merge)
283
283
284 #endif
284 #endif
285
285
286 Cannot produce streaming clone bundles with "hg bundle"
286 Cannot produce streaming clone bundles with "hg bundle"
287
287
288 $ hg -R test bundle -t packed1 packed.hg
288 $ hg -R test bundle -t packed1 packed.hg
289 abort: packed bundles cannot be produced by "hg bundle"
289 abort: packed bundles cannot be produced by "hg bundle"
290 (use 'hg debugcreatestreamclonebundle')
290 (use 'hg debugcreatestreamclonebundle')
291 [10]
291 [10]
292
292
293 packed1 is produced properly
293 packed1 is produced properly
294
294
295 #if reporevlogstore
295 #if reporevlogstore
296
296
297 $ hg -R test debugcreatestreamclonebundle packed.hg
297 $ hg -R test debugcreatestreamclonebundle packed.hg
298 writing 2664 bytes for 6 files
298 writing 2664 bytes for 6 files
299 bundle requirements: generaldelta, revlogv1, sparserevlog
299 bundle requirements: generaldelta, revlogv1, sparserevlog
300
300
301 $ f -B 64 --size --sha1 --hexdump packed.hg
301 $ f -B 64 --size --sha1 --hexdump packed.hg
302 packed.hg: size=2840, sha1=12bf3eee3eb8a04c503ce2d29b48f0135c7edff5
302 packed.hg: size=2840, sha1=12bf3eee3eb8a04c503ce2d29b48f0135c7edff5
303 0000: 48 47 53 31 55 4e 00 00 00 00 00 00 00 06 00 00 |HGS1UN..........|
303 0000: 48 47 53 31 55 4e 00 00 00 00 00 00 00 06 00 00 |HGS1UN..........|
304 0010: 00 00 00 00 0a 68 00 23 67 65 6e 65 72 61 6c 64 |.....h.#generald|
304 0010: 00 00 00 00 0a 68 00 23 67 65 6e 65 72 61 6c 64 |.....h.#generald|
305 0020: 65 6c 74 61 2c 72 65 76 6c 6f 67 76 31 2c 73 70 |elta,revlogv1,sp|
305 0020: 65 6c 74 61 2c 72 65 76 6c 6f 67 76 31 2c 73 70 |elta,revlogv1,sp|
306 0030: 61 72 73 65 72 65 76 6c 6f 67 00 64 61 74 61 2f |arserevlog.data/|
306 0030: 61 72 73 65 72 65 76 6c 6f 67 00 64 61 74 61 2f |arserevlog.data/|
307
307
308 $ hg debugbundle --spec packed.hg
308 $ hg debugbundle --spec packed.hg
309 none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog
309 none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog
310
310
311 generaldelta requirement is not listed in stream clone bundles unless used
311 generaldelta requirement is not listed in stream clone bundles unless used
312
312
313 $ hg --config format.usegeneraldelta=false init testnongd
313 $ hg --config format.usegeneraldelta=false init testnongd
314 $ cd testnongd
314 $ cd testnongd
315 $ touch foo
315 $ touch foo
316 $ hg -q commit -A -m initial
316 $ hg -q commit -A -m initial
317 $ cd ..
317 $ cd ..
318 $ hg -R testnongd debugcreatestreamclonebundle packednongd.hg
318 $ hg -R testnongd debugcreatestreamclonebundle packednongd.hg
319 writing 301 bytes for 3 files
319 writing 301 bytes for 3 files
320 bundle requirements: revlogv1
320 bundle requirements: revlogv1
321
321
322 $ f -B 64 --size --sha1 --hexdump packednongd.hg
322 $ f -B 64 --size --sha1 --hexdump packednongd.hg
323 packednongd.hg: size=383, sha1=1d9c230238edd5d38907100b729ba72b1831fe6f
323 packednongd.hg: size=383, sha1=1d9c230238edd5d38907100b729ba72b1831fe6f
324 0000: 48 47 53 31 55 4e 00 00 00 00 00 00 00 03 00 00 |HGS1UN..........|
324 0000: 48 47 53 31 55 4e 00 00 00 00 00 00 00 03 00 00 |HGS1UN..........|
325 0010: 00 00 00 00 01 2d 00 09 72 65 76 6c 6f 67 76 31 |.....-..revlogv1|
325 0010: 00 00 00 00 01 2d 00 09 72 65 76 6c 6f 67 76 31 |.....-..revlogv1|
326 0020: 00 64 61 74 61 2f 66 6f 6f 2e 69 00 36 34 0a 00 |.data/foo.i.64..|
326 0020: 00 64 61 74 61 2f 66 6f 6f 2e 69 00 36 34 0a 00 |.data/foo.i.64..|
327 0030: 01 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
327 0030: 01 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
328
328
329 $ hg debugbundle --spec packednongd.hg
329 $ hg debugbundle --spec packednongd.hg
330 none-packed1;requirements%3Drevlogv1
330 none-packed1;requirements%3Drevlogv1
331
331
332 Warning emitted when packed bundles contain secret changesets
332 Warning emitted when packed bundles contain secret changesets
333
333
334 $ hg init testsecret
334 $ hg init testsecret
335 $ cd testsecret
335 $ cd testsecret
336 $ touch foo
336 $ touch foo
337 $ hg -q commit -A -m initial
337 $ hg -q commit -A -m initial
338 $ hg phase --force --secret -r .
338 $ hg phase --force --secret -r .
339 $ cd ..
339 $ cd ..
340
340
341 $ hg -R testsecret debugcreatestreamclonebundle packedsecret.hg
341 $ hg -R testsecret debugcreatestreamclonebundle packedsecret.hg
342 (warning: stream clone bundle will contain secret revisions)
342 (warning: stream clone bundle will contain secret revisions)
343 writing 301 bytes for 3 files
343 writing 301 bytes for 3 files
344 bundle requirements: generaldelta, revlogv1, sparserevlog
344 bundle requirements: generaldelta, revlogv1, sparserevlog
345
345
346 Unpacking packed1 bundles with "hg unbundle" isn't allowed
346 Unpacking packed1 bundles with "hg unbundle" isn't allowed
347
347
348 $ hg init packed
348 $ hg init packed
349 $ hg -R packed unbundle packed.hg
349 $ hg -R packed unbundle packed.hg
350 abort: packed bundles cannot be applied with "hg unbundle"
350 abort: packed bundles cannot be applied with "hg unbundle"
351 (use "hg debugapplystreamclonebundle")
351 (use "hg debugapplystreamclonebundle")
352 [10]
352 [10]
353
353
354 packed1 can be consumed from debug command
354 packed1 can be consumed from debug command
355
355
356 (this also confirms that streamclone-ed changes are visible via
356 (this also confirms that streamclone-ed changes are visible via
357 @filecache properties to in-process procedures before closing
357 @filecache properties to in-process procedures before closing
358 transaction)
358 transaction)
359
359
360 $ cat > $TESTTMP/showtip.py <<EOF
360 $ cat > $TESTTMP/showtip.py <<EOF
361 > from __future__ import absolute_import
361 > from __future__ import absolute_import
362 >
362 >
363 > def showtip(ui, repo, hooktype, **kwargs):
363 > def showtip(ui, repo, hooktype, **kwargs):
364 > ui.warn(b'%s: %s\n' % (hooktype, repo[b'tip'].hex()[:12]))
364 > ui.warn(b'%s: %s\n' % (hooktype, repo[b'tip'].hex()[:12]))
365 >
365 >
366 > def reposetup(ui, repo):
366 > def reposetup(ui, repo):
367 > # this confirms (and ensures) that (empty) 00changelog.i
367 > # this confirms (and ensures) that (empty) 00changelog.i
368 > # before streamclone is already cached as repo.changelog
368 > # before streamclone is already cached as repo.changelog
369 > ui.setconfig(b'hooks', b'pretxnopen.showtip', showtip)
369 > ui.setconfig(b'hooks', b'pretxnopen.showtip', showtip)
370 >
370 >
371 > # this confirms that streamclone-ed changes are visible to
371 > # this confirms that streamclone-ed changes are visible to
372 > # in-process procedures before closing transaction
372 > # in-process procedures before closing transaction
373 > ui.setconfig(b'hooks', b'pretxnclose.showtip', showtip)
373 > ui.setconfig(b'hooks', b'pretxnclose.showtip', showtip)
374 >
374 >
375 > # this confirms that streamclone-ed changes are still visible
375 > # this confirms that streamclone-ed changes are still visible
376 > # after closing transaction
376 > # after closing transaction
377 > ui.setconfig(b'hooks', b'txnclose.showtip', showtip)
377 > ui.setconfig(b'hooks', b'txnclose.showtip', showtip)
378 > EOF
378 > EOF
379 $ cat >> $HGRCPATH <<EOF
379 $ cat >> $HGRCPATH <<EOF
380 > [extensions]
380 > [extensions]
381 > showtip = $TESTTMP/showtip.py
381 > showtip = $TESTTMP/showtip.py
382 > EOF
382 > EOF
383
383
384 $ hg -R packed debugapplystreamclonebundle packed.hg
384 $ hg -R packed debugapplystreamclonebundle packed.hg
385 6 files to transfer, 2.60 KB of data
385 6 files to transfer, 2.60 KB of data
386 pretxnopen: 000000000000
386 pretxnopen: 000000000000
387 pretxnclose: aa35859c02ea
387 pretxnclose: aa35859c02ea
388 transferred 2.60 KB in *.* seconds (* */sec) (glob)
388 transferred 2.60 KB in *.* seconds (* */sec) (glob)
389 txnclose: aa35859c02ea
389 txnclose: aa35859c02ea
390
390
391 (for safety, confirm visibility of streamclone-ed changes by another
391 (for safety, confirm visibility of streamclone-ed changes by another
392 process, too)
392 process, too)
393
393
394 $ hg -R packed tip -T "{node|short}\n"
394 $ hg -R packed tip -T "{node|short}\n"
395 aa35859c02ea
395 aa35859c02ea
396
396
397 $ cat >> $HGRCPATH <<EOF
397 $ cat >> $HGRCPATH <<EOF
398 > [extensions]
398 > [extensions]
399 > showtip = !
399 > showtip = !
400 > EOF
400 > EOF
401
401
402 Does not work on non-empty repo
402 Does not work on non-empty repo
403
403
404 $ hg -R packed debugapplystreamclonebundle packed.hg
404 $ hg -R packed debugapplystreamclonebundle packed.hg
405 abort: cannot apply stream clone bundle on non-empty repo
405 abort: cannot apply stream clone bundle on non-empty repo
406 [255]
406 [255]
407
407
408 #endif
408 #endif
409
409
410 Create partial clones
410 Create partial clones
411
411
412 $ rm -r empty
412 $ rm -r empty
413 $ hg init empty
413 $ hg init empty
414 $ hg clone -r 3 test partial
414 $ hg clone -r 3 test partial
415 adding changesets
415 adding changesets
416 adding manifests
416 adding manifests
417 adding file changes
417 adding file changes
418 added 4 changesets with 4 changes to 1 files
418 added 4 changesets with 4 changes to 1 files
419 new changesets f9ee2f85a263:eebf5a27f8ca
419 new changesets f9ee2f85a263:eebf5a27f8ca
420 updating to branch default
420 updating to branch default
421 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
421 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
422 $ hg clone partial partial2
422 $ hg clone partial partial2
423 updating to branch default
423 updating to branch default
424 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
424 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
425 $ cd partial
425 $ cd partial
426
426
427 #if repobundlerepo
427 #if repobundlerepo
428
428
429 Log -R full.hg in partial
429 Log -R full.hg in partial
430
430
431 $ hg -R bundle://../full.hg log -T phases
431 $ hg -R bundle://../full.hg log -T phases
432 changeset: 8:aa35859c02ea
432 changeset: 8:aa35859c02ea
433 tag: tip
433 tag: tip
434 phase: draft
434 phase: draft
435 parent: 3:eebf5a27f8ca
435 parent: 3:eebf5a27f8ca
436 user: test
436 user: test
437 date: Thu Jan 01 00:00:00 1970 +0000
437 date: Thu Jan 01 00:00:00 1970 +0000
438 summary: 0.3m
438 summary: 0.3m
439
439
440 changeset: 7:a6a34bfa0076
440 changeset: 7:a6a34bfa0076
441 phase: draft
441 phase: draft
442 user: test
442 user: test
443 date: Thu Jan 01 00:00:00 1970 +0000
443 date: Thu Jan 01 00:00:00 1970 +0000
444 summary: 1.3m
444 summary: 1.3m
445
445
446 changeset: 6:7373c1169842
446 changeset: 6:7373c1169842
447 phase: draft
447 phase: draft
448 user: test
448 user: test
449 date: Thu Jan 01 00:00:00 1970 +0000
449 date: Thu Jan 01 00:00:00 1970 +0000
450 summary: 1.3
450 summary: 1.3
451
451
452 changeset: 5:1bb50a9436a7
452 changeset: 5:1bb50a9436a7
453 phase: draft
453 phase: draft
454 user: test
454 user: test
455 date: Thu Jan 01 00:00:00 1970 +0000
455 date: Thu Jan 01 00:00:00 1970 +0000
456 summary: 1.2
456 summary: 1.2
457
457
458 changeset: 4:095197eb4973
458 changeset: 4:095197eb4973
459 phase: draft
459 phase: draft
460 parent: 0:f9ee2f85a263
460 parent: 0:f9ee2f85a263
461 user: test
461 user: test
462 date: Thu Jan 01 00:00:00 1970 +0000
462 date: Thu Jan 01 00:00:00 1970 +0000
463 summary: 1.1
463 summary: 1.1
464
464
465 changeset: 3:eebf5a27f8ca
465 changeset: 3:eebf5a27f8ca
466 phase: public
466 phase: public
467 user: test
467 user: test
468 date: Thu Jan 01 00:00:00 1970 +0000
468 date: Thu Jan 01 00:00:00 1970 +0000
469 summary: 0.3
469 summary: 0.3
470
470
471 changeset: 2:e38ba6f5b7e0
471 changeset: 2:e38ba6f5b7e0
472 phase: public
472 phase: public
473 user: test
473 user: test
474 date: Thu Jan 01 00:00:00 1970 +0000
474 date: Thu Jan 01 00:00:00 1970 +0000
475 summary: 0.2
475 summary: 0.2
476
476
477 changeset: 1:34c2bf6b0626
477 changeset: 1:34c2bf6b0626
478 phase: public
478 phase: public
479 user: test
479 user: test
480 date: Thu Jan 01 00:00:00 1970 +0000
480 date: Thu Jan 01 00:00:00 1970 +0000
481 summary: 0.1
481 summary: 0.1
482
482
483 changeset: 0:f9ee2f85a263
483 changeset: 0:f9ee2f85a263
484 phase: public
484 phase: public
485 user: test
485 user: test
486 date: Thu Jan 01 00:00:00 1970 +0000
486 date: Thu Jan 01 00:00:00 1970 +0000
487 summary: 0.0
487 summary: 0.0
488
488
489
489
490 Incoming full.hg in partial
490 Incoming full.hg in partial
491
491
492 $ hg incoming bundle://../full.hg
492 $ hg incoming bundle://../full.hg
493 comparing with bundle:../full.hg
493 comparing with bundle:../full.hg
494 searching for changes
494 searching for changes
495 changeset: 4:095197eb4973
495 changeset: 4:095197eb4973
496 parent: 0:f9ee2f85a263
496 parent: 0:f9ee2f85a263
497 user: test
497 user: test
498 date: Thu Jan 01 00:00:00 1970 +0000
498 date: Thu Jan 01 00:00:00 1970 +0000
499 summary: 1.1
499 summary: 1.1
500
500
501 changeset: 5:1bb50a9436a7
501 changeset: 5:1bb50a9436a7
502 user: test
502 user: test
503 date: Thu Jan 01 00:00:00 1970 +0000
503 date: Thu Jan 01 00:00:00 1970 +0000
504 summary: 1.2
504 summary: 1.2
505
505
506 changeset: 6:7373c1169842
506 changeset: 6:7373c1169842
507 user: test
507 user: test
508 date: Thu Jan 01 00:00:00 1970 +0000
508 date: Thu Jan 01 00:00:00 1970 +0000
509 summary: 1.3
509 summary: 1.3
510
510
511 changeset: 7:a6a34bfa0076
511 changeset: 7:a6a34bfa0076
512 user: test
512 user: test
513 date: Thu Jan 01 00:00:00 1970 +0000
513 date: Thu Jan 01 00:00:00 1970 +0000
514 summary: 1.3m
514 summary: 1.3m
515
515
516 changeset: 8:aa35859c02ea
516 changeset: 8:aa35859c02ea
517 tag: tip
517 tag: tip
518 parent: 3:eebf5a27f8ca
518 parent: 3:eebf5a27f8ca
519 user: test
519 user: test
520 date: Thu Jan 01 00:00:00 1970 +0000
520 date: Thu Jan 01 00:00:00 1970 +0000
521 summary: 0.3m
521 summary: 0.3m
522
522
523
523
524 Outgoing -R full.hg vs partial2 in partial
524 Outgoing -R full.hg vs partial2 in partial
525
525
526 $ hg -R bundle://../full.hg outgoing ../partial2
526 $ hg -R bundle://../full.hg outgoing ../partial2
527 comparing with ../partial2
527 comparing with ../partial2
528 searching for changes
528 searching for changes
529 changeset: 4:095197eb4973
529 changeset: 4:095197eb4973
530 parent: 0:f9ee2f85a263
530 parent: 0:f9ee2f85a263
531 user: test
531 user: test
532 date: Thu Jan 01 00:00:00 1970 +0000
532 date: Thu Jan 01 00:00:00 1970 +0000
533 summary: 1.1
533 summary: 1.1
534
534
535 changeset: 5:1bb50a9436a7
535 changeset: 5:1bb50a9436a7
536 user: test
536 user: test
537 date: Thu Jan 01 00:00:00 1970 +0000
537 date: Thu Jan 01 00:00:00 1970 +0000
538 summary: 1.2
538 summary: 1.2
539
539
540 changeset: 6:7373c1169842
540 changeset: 6:7373c1169842
541 user: test
541 user: test
542 date: Thu Jan 01 00:00:00 1970 +0000
542 date: Thu Jan 01 00:00:00 1970 +0000
543 summary: 1.3
543 summary: 1.3
544
544
545 changeset: 7:a6a34bfa0076
545 changeset: 7:a6a34bfa0076
546 user: test
546 user: test
547 date: Thu Jan 01 00:00:00 1970 +0000
547 date: Thu Jan 01 00:00:00 1970 +0000
548 summary: 1.3m
548 summary: 1.3m
549
549
550 changeset: 8:aa35859c02ea
550 changeset: 8:aa35859c02ea
551 tag: tip
551 tag: tip
552 parent: 3:eebf5a27f8ca
552 parent: 3:eebf5a27f8ca
553 user: test
553 user: test
554 date: Thu Jan 01 00:00:00 1970 +0000
554 date: Thu Jan 01 00:00:00 1970 +0000
555 summary: 0.3m
555 summary: 0.3m
556
556
557
557
558 Outgoing -R does-not-exist.hg vs partial2 in partial
558 Outgoing -R does-not-exist.hg vs partial2 in partial
559
559
560 $ hg -R bundle://../does-not-exist.hg outgoing ../partial2
560 $ hg -R bundle://../does-not-exist.hg outgoing ../partial2
561 abort: *../does-not-exist.hg* (glob)
561 abort: *../does-not-exist.hg* (glob)
562 [255]
562 [255]
563
563
564 #endif
564 #endif
565
565
566 $ cd ..
566 $ cd ..
567
567
568 hide outer repo
568 hide outer repo
569 $ hg init
569 $ hg init
570
570
571 Direct clone from bundle (all-history)
571 Direct clone from bundle (all-history)
572
572
573 #if repobundlerepo
573 #if repobundlerepo
574
574
575 $ hg clone full.hg full-clone
575 $ hg clone full.hg full-clone
576 requesting all changes
576 requesting all changes
577 adding changesets
577 adding changesets
578 adding manifests
578 adding manifests
579 adding file changes
579 adding file changes
580 added 9 changesets with 7 changes to 4 files (+1 heads)
580 added 9 changesets with 7 changes to 4 files (+1 heads)
581 new changesets f9ee2f85a263:aa35859c02ea (9 drafts)
581 new changesets f9ee2f85a263:aa35859c02ea (9 drafts)
582 updating to branch default
582 updating to branch default
583 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
583 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
584 $ hg -R full-clone heads
584 $ hg -R full-clone heads
585 changeset: 8:aa35859c02ea
585 changeset: 8:aa35859c02ea
586 tag: tip
586 tag: tip
587 parent: 3:eebf5a27f8ca
587 parent: 3:eebf5a27f8ca
588 user: test
588 user: test
589 date: Thu Jan 01 00:00:00 1970 +0000
589 date: Thu Jan 01 00:00:00 1970 +0000
590 summary: 0.3m
590 summary: 0.3m
591
591
592 changeset: 7:a6a34bfa0076
592 changeset: 7:a6a34bfa0076
593 user: test
593 user: test
594 date: Thu Jan 01 00:00:00 1970 +0000
594 date: Thu Jan 01 00:00:00 1970 +0000
595 summary: 1.3m
595 summary: 1.3m
596
596
597 $ rm -r full-clone
597 $ rm -r full-clone
598
598
599 When cloning from a non-copiable repository into '', do not
599 When cloning from a non-copiable repository into '', do not
600 recurse infinitely (issue2528)
600 recurse infinitely (issue2528)
601
601
602 $ hg clone full.hg ''
602 $ hg clone full.hg ''
603 abort: empty destination path is not valid
603 abort: empty destination path is not valid
604 [255]
604 [10]
605
605
606 test for https://bz.mercurial-scm.org/216
606 test for https://bz.mercurial-scm.org/216
607
607
608 Unbundle incremental bundles into fresh empty in one go
608 Unbundle incremental bundles into fresh empty in one go
609
609
610 $ rm -r empty
610 $ rm -r empty
611 $ hg init empty
611 $ hg init empty
612 $ hg -R test bundle --base null -r 0 ../0.hg
612 $ hg -R test bundle --base null -r 0 ../0.hg
613 1 changesets found
613 1 changesets found
614 $ hg -R test bundle --base 0 -r 1 ../1.hg
614 $ hg -R test bundle --base 0 -r 1 ../1.hg
615 1 changesets found
615 1 changesets found
616 $ hg -R empty unbundle -u ../0.hg ../1.hg
616 $ hg -R empty unbundle -u ../0.hg ../1.hg
617 adding changesets
617 adding changesets
618 adding manifests
618 adding manifests
619 adding file changes
619 adding file changes
620 added 1 changesets with 1 changes to 1 files
620 added 1 changesets with 1 changes to 1 files
621 new changesets f9ee2f85a263 (1 drafts)
621 new changesets f9ee2f85a263 (1 drafts)
622 adding changesets
622 adding changesets
623 adding manifests
623 adding manifests
624 adding file changes
624 adding file changes
625 added 1 changesets with 1 changes to 1 files
625 added 1 changesets with 1 changes to 1 files
626 new changesets 34c2bf6b0626 (1 drafts)
626 new changesets 34c2bf6b0626 (1 drafts)
627 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
627 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
628
628
629 View full contents of the bundle
629 View full contents of the bundle
630 $ hg -R test bundle --base null -r 3 ../partial.hg
630 $ hg -R test bundle --base null -r 3 ../partial.hg
631 4 changesets found
631 4 changesets found
632 $ cd test
632 $ cd test
633 $ hg -R ../../partial.hg log -r "bundle()"
633 $ hg -R ../../partial.hg log -r "bundle()"
634 changeset: 0:f9ee2f85a263
634 changeset: 0:f9ee2f85a263
635 user: test
635 user: test
636 date: Thu Jan 01 00:00:00 1970 +0000
636 date: Thu Jan 01 00:00:00 1970 +0000
637 summary: 0.0
637 summary: 0.0
638
638
639 changeset: 1:34c2bf6b0626
639 changeset: 1:34c2bf6b0626
640 user: test
640 user: test
641 date: Thu Jan 01 00:00:00 1970 +0000
641 date: Thu Jan 01 00:00:00 1970 +0000
642 summary: 0.1
642 summary: 0.1
643
643
644 changeset: 2:e38ba6f5b7e0
644 changeset: 2:e38ba6f5b7e0
645 user: test
645 user: test
646 date: Thu Jan 01 00:00:00 1970 +0000
646 date: Thu Jan 01 00:00:00 1970 +0000
647 summary: 0.2
647 summary: 0.2
648
648
649 changeset: 3:eebf5a27f8ca
649 changeset: 3:eebf5a27f8ca
650 user: test
650 user: test
651 date: Thu Jan 01 00:00:00 1970 +0000
651 date: Thu Jan 01 00:00:00 1970 +0000
652 summary: 0.3
652 summary: 0.3
653
653
654 $ cd ..
654 $ cd ..
655
655
656 #endif
656 #endif
657
657
658 test for 540d1059c802
658 test for 540d1059c802
659
659
660 $ hg init orig
660 $ hg init orig
661 $ cd orig
661 $ cd orig
662 $ echo foo > foo
662 $ echo foo > foo
663 $ hg add foo
663 $ hg add foo
664 $ hg ci -m 'add foo'
664 $ hg ci -m 'add foo'
665
665
666 $ hg clone . ../copy
666 $ hg clone . ../copy
667 updating to branch default
667 updating to branch default
668 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
668 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
669 $ hg tag foo
669 $ hg tag foo
670
670
671 $ cd ../copy
671 $ cd ../copy
672 $ echo >> foo
672 $ echo >> foo
673 $ hg ci -m 'change foo'
673 $ hg ci -m 'change foo'
674 $ hg bundle ../bundle.hg ../orig
674 $ hg bundle ../bundle.hg ../orig
675 searching for changes
675 searching for changes
676 1 changesets found
676 1 changesets found
677
677
678 $ cd ..
678 $ cd ..
679
679
680 #if repobundlerepo
680 #if repobundlerepo
681 $ cd orig
681 $ cd orig
682 $ hg incoming ../bundle.hg
682 $ hg incoming ../bundle.hg
683 comparing with ../bundle.hg
683 comparing with ../bundle.hg
684 searching for changes
684 searching for changes
685 changeset: 2:ed1b79f46b9a
685 changeset: 2:ed1b79f46b9a
686 tag: tip
686 tag: tip
687 parent: 0:bbd179dfa0a7
687 parent: 0:bbd179dfa0a7
688 user: test
688 user: test
689 date: Thu Jan 01 00:00:00 1970 +0000
689 date: Thu Jan 01 00:00:00 1970 +0000
690 summary: change foo
690 summary: change foo
691
691
692 $ cd ..
692 $ cd ..
693
693
694 test bundle with # in the filename (issue2154):
694 test bundle with # in the filename (issue2154):
695
695
696 $ cp bundle.hg 'test#bundle.hg'
696 $ cp bundle.hg 'test#bundle.hg'
697 $ cd orig
697 $ cd orig
698 $ hg incoming '../test#bundle.hg'
698 $ hg incoming '../test#bundle.hg'
699 comparing with ../test
699 comparing with ../test
700 abort: unknown revision 'bundle.hg'!
700 abort: unknown revision 'bundle.hg'!
701 [255]
701 [255]
702
702
703 note that percent encoding is not handled:
703 note that percent encoding is not handled:
704
704
705 $ hg incoming ../test%23bundle.hg
705 $ hg incoming ../test%23bundle.hg
706 abort: repository ../test%23bundle.hg not found!
706 abort: repository ../test%23bundle.hg not found!
707 [255]
707 [255]
708 $ cd ..
708 $ cd ..
709
709
710 #endif
710 #endif
711
711
712 test to bundle revisions on the newly created branch (issue3828):
712 test to bundle revisions on the newly created branch (issue3828):
713
713
714 $ hg -q clone -U test test-clone
714 $ hg -q clone -U test test-clone
715 $ cd test
715 $ cd test
716
716
717 $ hg -q branch foo
717 $ hg -q branch foo
718 $ hg commit -m "create foo branch"
718 $ hg commit -m "create foo branch"
719 $ hg -q outgoing ../test-clone
719 $ hg -q outgoing ../test-clone
720 9:b4f5acb1ee27
720 9:b4f5acb1ee27
721 $ hg -q bundle --branch foo foo.hg ../test-clone
721 $ hg -q bundle --branch foo foo.hg ../test-clone
722 #if repobundlerepo
722 #if repobundlerepo
723 $ hg -R foo.hg -q log -r "bundle()"
723 $ hg -R foo.hg -q log -r "bundle()"
724 9:b4f5acb1ee27
724 9:b4f5acb1ee27
725 #endif
725 #endif
726
726
727 $ cd ..
727 $ cd ..
728
728
729 test for https://bz.mercurial-scm.org/1144
729 test for https://bz.mercurial-scm.org/1144
730
730
731 test that verify bundle does not traceback
731 test that verify bundle does not traceback
732
732
733 partial history bundle, fails w/ unknown parent
733 partial history bundle, fails w/ unknown parent
734
734
735 $ hg -R bundle.hg verify
735 $ hg -R bundle.hg verify
736 abort: 00changelog.i@bbd179dfa0a7: unknown parent!
736 abort: 00changelog.i@bbd179dfa0a7: unknown parent!
737 [255]
737 [255]
738
738
739 full history bundle, refuses to verify non-local repo
739 full history bundle, refuses to verify non-local repo
740
740
741 #if repobundlerepo
741 #if repobundlerepo
742 $ hg -R all.hg verify
742 $ hg -R all.hg verify
743 abort: cannot verify bundle or remote repos
743 abort: cannot verify bundle or remote repos
744 [255]
744 [255]
745 #endif
745 #endif
746
746
747 but, regular verify must continue to work
747 but, regular verify must continue to work
748
748
749 $ hg -R orig verify
749 $ hg -R orig verify
750 checking changesets
750 checking changesets
751 checking manifests
751 checking manifests
752 crosschecking files in changesets and manifests
752 crosschecking files in changesets and manifests
753 checking files
753 checking files
754 checked 2 changesets with 2 changes to 2 files
754 checked 2 changesets with 2 changes to 2 files
755
755
756 #if repobundlerepo
756 #if repobundlerepo
757 diff against bundle
757 diff against bundle
758
758
759 $ hg init b
759 $ hg init b
760 $ cd b
760 $ cd b
761 $ hg -R ../all.hg diff -r tip
761 $ hg -R ../all.hg diff -r tip
762 diff -r aa35859c02ea anotherfile
762 diff -r aa35859c02ea anotherfile
763 --- a/anotherfile Thu Jan 01 00:00:00 1970 +0000
763 --- a/anotherfile Thu Jan 01 00:00:00 1970 +0000
764 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
764 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
765 @@ -1,4 +0,0 @@
765 @@ -1,4 +0,0 @@
766 -0
766 -0
767 -1
767 -1
768 -2
768 -2
769 -3
769 -3
770 $ cd ..
770 $ cd ..
771 #endif
771 #endif
772
772
773 bundle single branch
773 bundle single branch
774
774
775 $ hg init branchy
775 $ hg init branchy
776 $ cd branchy
776 $ cd branchy
777 $ echo a >a
777 $ echo a >a
778 $ echo x >x
778 $ echo x >x
779 $ hg ci -Ama
779 $ hg ci -Ama
780 adding a
780 adding a
781 adding x
781 adding x
782 $ echo c >c
782 $ echo c >c
783 $ echo xx >x
783 $ echo xx >x
784 $ hg ci -Amc
784 $ hg ci -Amc
785 adding c
785 adding c
786 $ echo c1 >c1
786 $ echo c1 >c1
787 $ hg ci -Amc1
787 $ hg ci -Amc1
788 adding c1
788 adding c1
789 $ hg up 0
789 $ hg up 0
790 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
790 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
791 $ echo b >b
791 $ echo b >b
792 $ hg ci -Amb
792 $ hg ci -Amb
793 adding b
793 adding b
794 created new head
794 created new head
795 $ echo b1 >b1
795 $ echo b1 >b1
796 $ echo xx >x
796 $ echo xx >x
797 $ hg ci -Amb1
797 $ hg ci -Amb1
798 adding b1
798 adding b1
799 $ hg clone -q -r2 . part
799 $ hg clone -q -r2 . part
800
800
801 == bundling via incoming
801 == bundling via incoming
802
802
803 $ hg in -R part --bundle incoming.hg --template "{node}\n" .
803 $ hg in -R part --bundle incoming.hg --template "{node}\n" .
804 comparing with .
804 comparing with .
805 searching for changes
805 searching for changes
806 1a38c1b849e8b70c756d2d80b0b9a3ac0b7ea11a
806 1a38c1b849e8b70c756d2d80b0b9a3ac0b7ea11a
807 057f4db07f61970e1c11e83be79e9d08adc4dc31
807 057f4db07f61970e1c11e83be79e9d08adc4dc31
808
808
809 == bundling
809 == bundling
810
810
811 $ hg bundle bundle.hg part --debug --config progress.debug=true
811 $ hg bundle bundle.hg part --debug --config progress.debug=true
812 query 1; heads
812 query 1; heads
813 searching for changes
813 searching for changes
814 all remote heads known locally
814 all remote heads known locally
815 2 changesets found
815 2 changesets found
816 list of changesets:
816 list of changesets:
817 1a38c1b849e8b70c756d2d80b0b9a3ac0b7ea11a
817 1a38c1b849e8b70c756d2d80b0b9a3ac0b7ea11a
818 057f4db07f61970e1c11e83be79e9d08adc4dc31
818 057f4db07f61970e1c11e83be79e9d08adc4dc31
819 bundle2-output-bundle: "HG20", (1 params) 2 parts total
819 bundle2-output-bundle: "HG20", (1 params) 2 parts total
820 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
820 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
821 changesets: 1/2 chunks (50.00%)
821 changesets: 1/2 chunks (50.00%)
822 changesets: 2/2 chunks (100.00%)
822 changesets: 2/2 chunks (100.00%)
823 manifests: 1/2 chunks (50.00%)
823 manifests: 1/2 chunks (50.00%)
824 manifests: 2/2 chunks (100.00%)
824 manifests: 2/2 chunks (100.00%)
825 files: b 1/3 files (33.33%)
825 files: b 1/3 files (33.33%)
826 files: b1 2/3 files (66.67%)
826 files: b1 2/3 files (66.67%)
827 files: x 3/3 files (100.00%)
827 files: x 3/3 files (100.00%)
828 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
828 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
829
829
830 #if repobundlerepo
830 #if repobundlerepo
831 == Test for issue3441
831 == Test for issue3441
832
832
833 $ hg clone -q -r0 . part2
833 $ hg clone -q -r0 . part2
834 $ hg -q -R part2 pull bundle.hg
834 $ hg -q -R part2 pull bundle.hg
835 $ hg -R part2 verify
835 $ hg -R part2 verify
836 checking changesets
836 checking changesets
837 checking manifests
837 checking manifests
838 crosschecking files in changesets and manifests
838 crosschecking files in changesets and manifests
839 checking files
839 checking files
840 checked 3 changesets with 5 changes to 4 files
840 checked 3 changesets with 5 changes to 4 files
841 #endif
841 #endif
842
842
843 == Test bundling no commits
843 == Test bundling no commits
844
844
845 $ hg bundle -r 'public()' no-output.hg
845 $ hg bundle -r 'public()' no-output.hg
846 abort: no commits to bundle
846 abort: no commits to bundle
847 [10]
847 [10]
848
848
849 $ cd ..
849 $ cd ..
850
850
851 When user merges to the revision existing only in the bundle,
851 When user merges to the revision existing only in the bundle,
852 it should show warning that second parent of the working
852 it should show warning that second parent of the working
853 directory does not exist
853 directory does not exist
854
854
855 $ hg init update2bundled
855 $ hg init update2bundled
856 $ cd update2bundled
856 $ cd update2bundled
857 $ cat <<EOF >> .hg/hgrc
857 $ cat <<EOF >> .hg/hgrc
858 > [extensions]
858 > [extensions]
859 > strip =
859 > strip =
860 > EOF
860 > EOF
861 $ echo "aaa" >> a
861 $ echo "aaa" >> a
862 $ hg commit -A -m 0
862 $ hg commit -A -m 0
863 adding a
863 adding a
864 $ echo "bbb" >> b
864 $ echo "bbb" >> b
865 $ hg commit -A -m 1
865 $ hg commit -A -m 1
866 adding b
866 adding b
867 $ echo "ccc" >> c
867 $ echo "ccc" >> c
868 $ hg commit -A -m 2
868 $ hg commit -A -m 2
869 adding c
869 adding c
870 $ hg update -r 1
870 $ hg update -r 1
871 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
871 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
872 $ echo "ddd" >> d
872 $ echo "ddd" >> d
873 $ hg commit -A -m 3
873 $ hg commit -A -m 3
874 adding d
874 adding d
875 created new head
875 created new head
876 $ hg update -r 2
876 $ hg update -r 2
877 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
877 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
878 $ hg log -G
878 $ hg log -G
879 o changeset: 3:8bd3e1f196af
879 o changeset: 3:8bd3e1f196af
880 | tag: tip
880 | tag: tip
881 | parent: 1:a01eca7af26d
881 | parent: 1:a01eca7af26d
882 | user: test
882 | user: test
883 | date: Thu Jan 01 00:00:00 1970 +0000
883 | date: Thu Jan 01 00:00:00 1970 +0000
884 | summary: 3
884 | summary: 3
885 |
885 |
886 | @ changeset: 2:4652c276ac4f
886 | @ changeset: 2:4652c276ac4f
887 |/ user: test
887 |/ user: test
888 | date: Thu Jan 01 00:00:00 1970 +0000
888 | date: Thu Jan 01 00:00:00 1970 +0000
889 | summary: 2
889 | summary: 2
890 |
890 |
891 o changeset: 1:a01eca7af26d
891 o changeset: 1:a01eca7af26d
892 | user: test
892 | user: test
893 | date: Thu Jan 01 00:00:00 1970 +0000
893 | date: Thu Jan 01 00:00:00 1970 +0000
894 | summary: 1
894 | summary: 1
895 |
895 |
896 o changeset: 0:4fe08cd4693e
896 o changeset: 0:4fe08cd4693e
897 user: test
897 user: test
898 date: Thu Jan 01 00:00:00 1970 +0000
898 date: Thu Jan 01 00:00:00 1970 +0000
899 summary: 0
899 summary: 0
900
900
901
901
902 #if repobundlerepo
902 #if repobundlerepo
903 $ hg bundle --base 1 -r 3 ../update2bundled.hg
903 $ hg bundle --base 1 -r 3 ../update2bundled.hg
904 1 changesets found
904 1 changesets found
905 $ hg strip -r 3
905 $ hg strip -r 3
906 saved backup bundle to $TESTTMP/update2bundled/.hg/strip-backup/8bd3e1f196af-017e56d8-backup.hg
906 saved backup bundle to $TESTTMP/update2bundled/.hg/strip-backup/8bd3e1f196af-017e56d8-backup.hg
907 $ hg merge -R ../update2bundled.hg -r 3
907 $ hg merge -R ../update2bundled.hg -r 3
908 setting parent to node 8bd3e1f196af289b2b121be08031e76d7ae92098 that only exists in the bundle
908 setting parent to node 8bd3e1f196af289b2b121be08031e76d7ae92098 that only exists in the bundle
909 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
909 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
910 (branch merge, don't forget to commit)
910 (branch merge, don't forget to commit)
911
911
912 When user updates to the revision existing only in the bundle,
912 When user updates to the revision existing only in the bundle,
913 it should show warning
913 it should show warning
914
914
915 $ hg update -R ../update2bundled.hg --clean -r 3
915 $ hg update -R ../update2bundled.hg --clean -r 3
916 setting parent to node 8bd3e1f196af289b2b121be08031e76d7ae92098 that only exists in the bundle
916 setting parent to node 8bd3e1f196af289b2b121be08031e76d7ae92098 that only exists in the bundle
917 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
917 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
918
918
919 When user updates to the revision existing in the local repository
919 When user updates to the revision existing in the local repository
920 the warning shouldn't be emitted
920 the warning shouldn't be emitted
921
921
922 $ hg update -R ../update2bundled.hg -r 0
922 $ hg update -R ../update2bundled.hg -r 0
923 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
923 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
924 #endif
924 #endif
925
925
926 Test the option that create slim bundle
926 Test the option that create slim bundle
927
927
928 $ hg bundle -a --config devel.bundle.delta=p1 ./slim.hg
928 $ hg bundle -a --config devel.bundle.delta=p1 ./slim.hg
929 3 changesets found
929 3 changesets found
930
930
931 Test the option that create and no-delta's bundle
931 Test the option that create and no-delta's bundle
932 $ hg bundle -a --config devel.bundle.delta=full ./full.hg
932 $ hg bundle -a --config devel.bundle.delta=full ./full.hg
933 3 changesets found
933 3 changesets found
@@ -1,1309 +1,1309 b''
1 #testcases sshv1 sshv2
1 #testcases sshv1 sshv2
2
2
3 #if sshv2
3 #if sshv2
4 $ cat >> $HGRCPATH << EOF
4 $ cat >> $HGRCPATH << EOF
5 > [experimental]
5 > [experimental]
6 > sshpeer.advertise-v2 = true
6 > sshpeer.advertise-v2 = true
7 > sshserver.support-v2 = true
7 > sshserver.support-v2 = true
8 > EOF
8 > EOF
9 #endif
9 #endif
10
10
11 Prepare repo a:
11 Prepare repo a:
12
12
13 $ hg init a
13 $ hg init a
14 $ cd a
14 $ cd a
15 $ echo a > a
15 $ echo a > a
16 $ hg add a
16 $ hg add a
17 $ hg commit -m test
17 $ hg commit -m test
18 $ echo first line > b
18 $ echo first line > b
19 $ hg add b
19 $ hg add b
20
20
21 Create a non-inlined filelog:
21 Create a non-inlined filelog:
22
22
23 $ "$PYTHON" -c 'open("data1", "wb").write(b"".join(b"%d\n" % x for x in range(10000)))'
23 $ "$PYTHON" -c 'open("data1", "wb").write(b"".join(b"%d\n" % x for x in range(10000)))'
24 $ for j in 0 1 2 3 4 5 6 7 8 9; do
24 $ for j in 0 1 2 3 4 5 6 7 8 9; do
25 > cat data1 >> b
25 > cat data1 >> b
26 > hg commit -m test
26 > hg commit -m test
27 > done
27 > done
28
28
29 List files in store/data (should show a 'b.d'):
29 List files in store/data (should show a 'b.d'):
30
30
31 #if reporevlogstore
31 #if reporevlogstore
32 $ for i in .hg/store/data/*; do
32 $ for i in .hg/store/data/*; do
33 > echo $i
33 > echo $i
34 > done
34 > done
35 .hg/store/data/a.i
35 .hg/store/data/a.i
36 .hg/store/data/b.d
36 .hg/store/data/b.d
37 .hg/store/data/b.i
37 .hg/store/data/b.i
38 #endif
38 #endif
39
39
40 Trigger branchcache creation:
40 Trigger branchcache creation:
41
41
42 $ hg branches
42 $ hg branches
43 default 10:a7949464abda
43 default 10:a7949464abda
44 $ ls .hg/cache
44 $ ls .hg/cache
45 branch2-served
45 branch2-served
46 rbc-names-v1
46 rbc-names-v1
47 rbc-revs-v1
47 rbc-revs-v1
48
48
49 Default operation:
49 Default operation:
50
50
51 $ hg clone . ../b
51 $ hg clone . ../b
52 updating to branch default
52 updating to branch default
53 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 $ cd ../b
54 $ cd ../b
55
55
56 Ensure branchcache got copied over:
56 Ensure branchcache got copied over:
57
57
58 $ ls .hg/cache
58 $ ls .hg/cache
59 branch2-served
59 branch2-served
60 rbc-names-v1
60 rbc-names-v1
61 rbc-revs-v1
61 rbc-revs-v1
62
62
63 $ cat a
63 $ cat a
64 a
64 a
65 $ hg verify
65 $ hg verify
66 checking changesets
66 checking changesets
67 checking manifests
67 checking manifests
68 crosschecking files in changesets and manifests
68 crosschecking files in changesets and manifests
69 checking files
69 checking files
70 checked 11 changesets with 11 changes to 2 files
70 checked 11 changesets with 11 changes to 2 files
71
71
72 Invalid dest '' must abort:
72 Invalid dest '' must abort:
73
73
74 $ hg clone . ''
74 $ hg clone . ''
75 abort: empty destination path is not valid
75 abort: empty destination path is not valid
76 [255]
76 [10]
77
77
78 No update, with debug option:
78 No update, with debug option:
79
79
80 #if hardlink
80 #if hardlink
81 $ hg --debug clone -U . ../c --config progress.debug=true
81 $ hg --debug clone -U . ../c --config progress.debug=true
82 linking: 1 files
82 linking: 1 files
83 linking: 2 files
83 linking: 2 files
84 linking: 3 files
84 linking: 3 files
85 linking: 4 files
85 linking: 4 files
86 linking: 5 files
86 linking: 5 files
87 linking: 6 files
87 linking: 6 files
88 linking: 7 files
88 linking: 7 files
89 linking: 8 files
89 linking: 8 files
90 linked 8 files (reporevlogstore !)
90 linked 8 files (reporevlogstore !)
91 linking: 9 files (reposimplestore !)
91 linking: 9 files (reposimplestore !)
92 linking: 10 files (reposimplestore !)
92 linking: 10 files (reposimplestore !)
93 linking: 11 files (reposimplestore !)
93 linking: 11 files (reposimplestore !)
94 linking: 12 files (reposimplestore !)
94 linking: 12 files (reposimplestore !)
95 linking: 13 files (reposimplestore !)
95 linking: 13 files (reposimplestore !)
96 linking: 14 files (reposimplestore !)
96 linking: 14 files (reposimplestore !)
97 linking: 15 files (reposimplestore !)
97 linking: 15 files (reposimplestore !)
98 linking: 16 files (reposimplestore !)
98 linking: 16 files (reposimplestore !)
99 linking: 17 files (reposimplestore !)
99 linking: 17 files (reposimplestore !)
100 linking: 18 files (reposimplestore !)
100 linking: 18 files (reposimplestore !)
101 linked 18 files (reposimplestore !)
101 linked 18 files (reposimplestore !)
102 #else
102 #else
103 $ hg --debug clone -U . ../c --config progress.debug=true
103 $ hg --debug clone -U . ../c --config progress.debug=true
104 linking: 1 files
104 linking: 1 files
105 copying: 2 files
105 copying: 2 files
106 copying: 3 files
106 copying: 3 files
107 copying: 4 files
107 copying: 4 files
108 copying: 5 files
108 copying: 5 files
109 copying: 6 files
109 copying: 6 files
110 copying: 7 files
110 copying: 7 files
111 copying: 8 files
111 copying: 8 files
112 copied 8 files (reporevlogstore !)
112 copied 8 files (reporevlogstore !)
113 copying: 9 files (reposimplestore !)
113 copying: 9 files (reposimplestore !)
114 copying: 10 files (reposimplestore !)
114 copying: 10 files (reposimplestore !)
115 copying: 11 files (reposimplestore !)
115 copying: 11 files (reposimplestore !)
116 copying: 12 files (reposimplestore !)
116 copying: 12 files (reposimplestore !)
117 copying: 13 files (reposimplestore !)
117 copying: 13 files (reposimplestore !)
118 copying: 14 files (reposimplestore !)
118 copying: 14 files (reposimplestore !)
119 copying: 15 files (reposimplestore !)
119 copying: 15 files (reposimplestore !)
120 copying: 16 files (reposimplestore !)
120 copying: 16 files (reposimplestore !)
121 copying: 17 files (reposimplestore !)
121 copying: 17 files (reposimplestore !)
122 copying: 18 files (reposimplestore !)
122 copying: 18 files (reposimplestore !)
123 copied 18 files (reposimplestore !)
123 copied 18 files (reposimplestore !)
124 #endif
124 #endif
125 $ cd ../c
125 $ cd ../c
126
126
127 Ensure branchcache got copied over:
127 Ensure branchcache got copied over:
128
128
129 $ ls .hg/cache
129 $ ls .hg/cache
130 branch2-served
130 branch2-served
131 rbc-names-v1
131 rbc-names-v1
132 rbc-revs-v1
132 rbc-revs-v1
133
133
134 $ cat a 2>/dev/null || echo "a not present"
134 $ cat a 2>/dev/null || echo "a not present"
135 a not present
135 a not present
136 $ hg verify
136 $ hg verify
137 checking changesets
137 checking changesets
138 checking manifests
138 checking manifests
139 crosschecking files in changesets and manifests
139 crosschecking files in changesets and manifests
140 checking files
140 checking files
141 checked 11 changesets with 11 changes to 2 files
141 checked 11 changesets with 11 changes to 2 files
142
142
143 Default destination:
143 Default destination:
144
144
145 $ mkdir ../d
145 $ mkdir ../d
146 $ cd ../d
146 $ cd ../d
147 $ hg clone ../a
147 $ hg clone ../a
148 destination directory: a
148 destination directory: a
149 updating to branch default
149 updating to branch default
150 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
151 $ cd a
151 $ cd a
152 $ hg cat a
152 $ hg cat a
153 a
153 a
154 $ cd ../..
154 $ cd ../..
155
155
156 Check that we drop the 'file:' from the path before writing the .hgrc:
156 Check that we drop the 'file:' from the path before writing the .hgrc:
157
157
158 $ hg clone file:a e
158 $ hg clone file:a e
159 updating to branch default
159 updating to branch default
160 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
160 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
161 $ grep 'file:' e/.hg/hgrc
161 $ grep 'file:' e/.hg/hgrc
162 [1]
162 [1]
163
163
164 Check that path aliases are expanded:
164 Check that path aliases are expanded:
165
165
166 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
166 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
167 $ hg -R f showconfig paths.default
167 $ hg -R f showconfig paths.default
168 $TESTTMP/a#0
168 $TESTTMP/a#0
169
169
170 Use --pull:
170 Use --pull:
171
171
172 $ hg clone --pull a g
172 $ hg clone --pull a g
173 requesting all changes
173 requesting all changes
174 adding changesets
174 adding changesets
175 adding manifests
175 adding manifests
176 adding file changes
176 adding file changes
177 added 11 changesets with 11 changes to 2 files
177 added 11 changesets with 11 changes to 2 files
178 new changesets acb14030fe0a:a7949464abda
178 new changesets acb14030fe0a:a7949464abda
179 updating to branch default
179 updating to branch default
180 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
180 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
181 $ hg -R g verify
181 $ hg -R g verify
182 checking changesets
182 checking changesets
183 checking manifests
183 checking manifests
184 crosschecking files in changesets and manifests
184 crosschecking files in changesets and manifests
185 checking files
185 checking files
186 checked 11 changesets with 11 changes to 2 files
186 checked 11 changesets with 11 changes to 2 files
187
187
188 Invalid dest '' with --pull must abort (issue2528):
188 Invalid dest '' with --pull must abort (issue2528):
189
189
190 $ hg clone --pull a ''
190 $ hg clone --pull a ''
191 abort: empty destination path is not valid
191 abort: empty destination path is not valid
192 [255]
192 [10]
193
193
194 Clone to '.':
194 Clone to '.':
195
195
196 $ mkdir h
196 $ mkdir h
197 $ cd h
197 $ cd h
198 $ hg clone ../a .
198 $ hg clone ../a .
199 updating to branch default
199 updating to branch default
200 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
200 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
201 $ cd ..
201 $ cd ..
202
202
203
203
204 *** Tests for option -u ***
204 *** Tests for option -u ***
205
205
206 Adding some more history to repo a:
206 Adding some more history to repo a:
207
207
208 $ cd a
208 $ cd a
209 $ hg tag ref1
209 $ hg tag ref1
210 $ echo the quick brown fox >a
210 $ echo the quick brown fox >a
211 $ hg ci -m "hacked default"
211 $ hg ci -m "hacked default"
212 $ hg up ref1
212 $ hg up ref1
213 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
213 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
214 $ hg branch stable
214 $ hg branch stable
215 marked working directory as branch stable
215 marked working directory as branch stable
216 (branches are permanent and global, did you want a bookmark?)
216 (branches are permanent and global, did you want a bookmark?)
217 $ echo some text >a
217 $ echo some text >a
218 $ hg ci -m "starting branch stable"
218 $ hg ci -m "starting branch stable"
219 $ hg tag ref2
219 $ hg tag ref2
220 $ echo some more text >a
220 $ echo some more text >a
221 $ hg ci -m "another change for branch stable"
221 $ hg ci -m "another change for branch stable"
222 $ hg up ref2
222 $ hg up ref2
223 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
223 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
224 $ hg parents
224 $ hg parents
225 changeset: 13:e8ece76546a6
225 changeset: 13:e8ece76546a6
226 branch: stable
226 branch: stable
227 tag: ref2
227 tag: ref2
228 parent: 10:a7949464abda
228 parent: 10:a7949464abda
229 user: test
229 user: test
230 date: Thu Jan 01 00:00:00 1970 +0000
230 date: Thu Jan 01 00:00:00 1970 +0000
231 summary: starting branch stable
231 summary: starting branch stable
232
232
233
233
234 Repo a has two heads:
234 Repo a has two heads:
235
235
236 $ hg heads
236 $ hg heads
237 changeset: 15:0aae7cf88f0d
237 changeset: 15:0aae7cf88f0d
238 branch: stable
238 branch: stable
239 tag: tip
239 tag: tip
240 user: test
240 user: test
241 date: Thu Jan 01 00:00:00 1970 +0000
241 date: Thu Jan 01 00:00:00 1970 +0000
242 summary: another change for branch stable
242 summary: another change for branch stable
243
243
244 changeset: 12:f21241060d6a
244 changeset: 12:f21241060d6a
245 user: test
245 user: test
246 date: Thu Jan 01 00:00:00 1970 +0000
246 date: Thu Jan 01 00:00:00 1970 +0000
247 summary: hacked default
247 summary: hacked default
248
248
249
249
250 $ cd ..
250 $ cd ..
251
251
252
252
253 Testing --noupdate with --updaterev (must abort):
253 Testing --noupdate with --updaterev (must abort):
254
254
255 $ hg clone --noupdate --updaterev 1 a ua
255 $ hg clone --noupdate --updaterev 1 a ua
256 abort: cannot specify both --noupdate and --updaterev
256 abort: cannot specify both --noupdate and --updaterev
257 [10]
257 [10]
258
258
259
259
260 Testing clone -u:
260 Testing clone -u:
261
261
262 $ hg clone -u . a ua
262 $ hg clone -u . a ua
263 updating to branch stable
263 updating to branch stable
264 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
264 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
265
265
266 Repo ua has both heads:
266 Repo ua has both heads:
267
267
268 $ hg -R ua heads
268 $ hg -R ua heads
269 changeset: 15:0aae7cf88f0d
269 changeset: 15:0aae7cf88f0d
270 branch: stable
270 branch: stable
271 tag: tip
271 tag: tip
272 user: test
272 user: test
273 date: Thu Jan 01 00:00:00 1970 +0000
273 date: Thu Jan 01 00:00:00 1970 +0000
274 summary: another change for branch stable
274 summary: another change for branch stable
275
275
276 changeset: 12:f21241060d6a
276 changeset: 12:f21241060d6a
277 user: test
277 user: test
278 date: Thu Jan 01 00:00:00 1970 +0000
278 date: Thu Jan 01 00:00:00 1970 +0000
279 summary: hacked default
279 summary: hacked default
280
280
281
281
282 Same revision checked out in repo a and ua:
282 Same revision checked out in repo a and ua:
283
283
284 $ hg -R a parents --template "{node|short}\n"
284 $ hg -R a parents --template "{node|short}\n"
285 e8ece76546a6
285 e8ece76546a6
286 $ hg -R ua parents --template "{node|short}\n"
286 $ hg -R ua parents --template "{node|short}\n"
287 e8ece76546a6
287 e8ece76546a6
288
288
289 $ rm -r ua
289 $ rm -r ua
290
290
291
291
292 Testing clone --pull -u:
292 Testing clone --pull -u:
293
293
294 $ hg clone --pull -u . a ua
294 $ hg clone --pull -u . a ua
295 requesting all changes
295 requesting all changes
296 adding changesets
296 adding changesets
297 adding manifests
297 adding manifests
298 adding file changes
298 adding file changes
299 added 16 changesets with 16 changes to 3 files (+1 heads)
299 added 16 changesets with 16 changes to 3 files (+1 heads)
300 new changesets acb14030fe0a:0aae7cf88f0d
300 new changesets acb14030fe0a:0aae7cf88f0d
301 updating to branch stable
301 updating to branch stable
302 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
302 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
303
303
304 Repo ua has both heads:
304 Repo ua has both heads:
305
305
306 $ hg -R ua heads
306 $ hg -R ua heads
307 changeset: 15:0aae7cf88f0d
307 changeset: 15:0aae7cf88f0d
308 branch: stable
308 branch: stable
309 tag: tip
309 tag: tip
310 user: test
310 user: test
311 date: Thu Jan 01 00:00:00 1970 +0000
311 date: Thu Jan 01 00:00:00 1970 +0000
312 summary: another change for branch stable
312 summary: another change for branch stable
313
313
314 changeset: 12:f21241060d6a
314 changeset: 12:f21241060d6a
315 user: test
315 user: test
316 date: Thu Jan 01 00:00:00 1970 +0000
316 date: Thu Jan 01 00:00:00 1970 +0000
317 summary: hacked default
317 summary: hacked default
318
318
319
319
320 Same revision checked out in repo a and ua:
320 Same revision checked out in repo a and ua:
321
321
322 $ hg -R a parents --template "{node|short}\n"
322 $ hg -R a parents --template "{node|short}\n"
323 e8ece76546a6
323 e8ece76546a6
324 $ hg -R ua parents --template "{node|short}\n"
324 $ hg -R ua parents --template "{node|short}\n"
325 e8ece76546a6
325 e8ece76546a6
326
326
327 $ rm -r ua
327 $ rm -r ua
328
328
329
329
330 Testing clone -u <branch>:
330 Testing clone -u <branch>:
331
331
332 $ hg clone -u stable a ua
332 $ hg clone -u stable a ua
333 updating to branch stable
333 updating to branch stable
334 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
334 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
335
335
336 Repo ua has both heads:
336 Repo ua has both heads:
337
337
338 $ hg -R ua heads
338 $ hg -R ua heads
339 changeset: 15:0aae7cf88f0d
339 changeset: 15:0aae7cf88f0d
340 branch: stable
340 branch: stable
341 tag: tip
341 tag: tip
342 user: test
342 user: test
343 date: Thu Jan 01 00:00:00 1970 +0000
343 date: Thu Jan 01 00:00:00 1970 +0000
344 summary: another change for branch stable
344 summary: another change for branch stable
345
345
346 changeset: 12:f21241060d6a
346 changeset: 12:f21241060d6a
347 user: test
347 user: test
348 date: Thu Jan 01 00:00:00 1970 +0000
348 date: Thu Jan 01 00:00:00 1970 +0000
349 summary: hacked default
349 summary: hacked default
350
350
351
351
352 Branch 'stable' is checked out:
352 Branch 'stable' is checked out:
353
353
354 $ hg -R ua parents
354 $ hg -R ua parents
355 changeset: 15:0aae7cf88f0d
355 changeset: 15:0aae7cf88f0d
356 branch: stable
356 branch: stable
357 tag: tip
357 tag: tip
358 user: test
358 user: test
359 date: Thu Jan 01 00:00:00 1970 +0000
359 date: Thu Jan 01 00:00:00 1970 +0000
360 summary: another change for branch stable
360 summary: another change for branch stable
361
361
362
362
363 $ rm -r ua
363 $ rm -r ua
364
364
365
365
366 Testing default checkout:
366 Testing default checkout:
367
367
368 $ hg clone a ua
368 $ hg clone a ua
369 updating to branch default
369 updating to branch default
370 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
371
371
372 Repo ua has both heads:
372 Repo ua has both heads:
373
373
374 $ hg -R ua heads
374 $ hg -R ua heads
375 changeset: 15:0aae7cf88f0d
375 changeset: 15:0aae7cf88f0d
376 branch: stable
376 branch: stable
377 tag: tip
377 tag: tip
378 user: test
378 user: test
379 date: Thu Jan 01 00:00:00 1970 +0000
379 date: Thu Jan 01 00:00:00 1970 +0000
380 summary: another change for branch stable
380 summary: another change for branch stable
381
381
382 changeset: 12:f21241060d6a
382 changeset: 12:f21241060d6a
383 user: test
383 user: test
384 date: Thu Jan 01 00:00:00 1970 +0000
384 date: Thu Jan 01 00:00:00 1970 +0000
385 summary: hacked default
385 summary: hacked default
386
386
387
387
388 Branch 'default' is checked out:
388 Branch 'default' is checked out:
389
389
390 $ hg -R ua parents
390 $ hg -R ua parents
391 changeset: 12:f21241060d6a
391 changeset: 12:f21241060d6a
392 user: test
392 user: test
393 date: Thu Jan 01 00:00:00 1970 +0000
393 date: Thu Jan 01 00:00:00 1970 +0000
394 summary: hacked default
394 summary: hacked default
395
395
396 Test clone with a branch named "@" (issue3677)
396 Test clone with a branch named "@" (issue3677)
397
397
398 $ hg -R ua branch @
398 $ hg -R ua branch @
399 marked working directory as branch @
399 marked working directory as branch @
400 $ hg -R ua commit -m 'created branch @'
400 $ hg -R ua commit -m 'created branch @'
401 $ hg clone ua atbranch
401 $ hg clone ua atbranch
402 updating to branch default
402 updating to branch default
403 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
403 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
404 $ hg -R atbranch heads
404 $ hg -R atbranch heads
405 changeset: 16:798b6d97153e
405 changeset: 16:798b6d97153e
406 branch: @
406 branch: @
407 tag: tip
407 tag: tip
408 parent: 12:f21241060d6a
408 parent: 12:f21241060d6a
409 user: test
409 user: test
410 date: Thu Jan 01 00:00:00 1970 +0000
410 date: Thu Jan 01 00:00:00 1970 +0000
411 summary: created branch @
411 summary: created branch @
412
412
413 changeset: 15:0aae7cf88f0d
413 changeset: 15:0aae7cf88f0d
414 branch: stable
414 branch: stable
415 user: test
415 user: test
416 date: Thu Jan 01 00:00:00 1970 +0000
416 date: Thu Jan 01 00:00:00 1970 +0000
417 summary: another change for branch stable
417 summary: another change for branch stable
418
418
419 changeset: 12:f21241060d6a
419 changeset: 12:f21241060d6a
420 user: test
420 user: test
421 date: Thu Jan 01 00:00:00 1970 +0000
421 date: Thu Jan 01 00:00:00 1970 +0000
422 summary: hacked default
422 summary: hacked default
423
423
424 $ hg -R atbranch parents
424 $ hg -R atbranch parents
425 changeset: 12:f21241060d6a
425 changeset: 12:f21241060d6a
426 user: test
426 user: test
427 date: Thu Jan 01 00:00:00 1970 +0000
427 date: Thu Jan 01 00:00:00 1970 +0000
428 summary: hacked default
428 summary: hacked default
429
429
430
430
431 $ rm -r ua atbranch
431 $ rm -r ua atbranch
432
432
433
433
434 Testing #<branch>:
434 Testing #<branch>:
435
435
436 $ hg clone -u . a#stable ua
436 $ hg clone -u . a#stable ua
437 adding changesets
437 adding changesets
438 adding manifests
438 adding manifests
439 adding file changes
439 adding file changes
440 added 14 changesets with 14 changes to 3 files
440 added 14 changesets with 14 changes to 3 files
441 new changesets acb14030fe0a:0aae7cf88f0d
441 new changesets acb14030fe0a:0aae7cf88f0d
442 updating to branch stable
442 updating to branch stable
443 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
443 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
444
444
445 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
445 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
446
446
447 $ hg -R ua heads
447 $ hg -R ua heads
448 changeset: 13:0aae7cf88f0d
448 changeset: 13:0aae7cf88f0d
449 branch: stable
449 branch: stable
450 tag: tip
450 tag: tip
451 user: test
451 user: test
452 date: Thu Jan 01 00:00:00 1970 +0000
452 date: Thu Jan 01 00:00:00 1970 +0000
453 summary: another change for branch stable
453 summary: another change for branch stable
454
454
455 changeset: 10:a7949464abda
455 changeset: 10:a7949464abda
456 user: test
456 user: test
457 date: Thu Jan 01 00:00:00 1970 +0000
457 date: Thu Jan 01 00:00:00 1970 +0000
458 summary: test
458 summary: test
459
459
460
460
461 Same revision checked out in repo a and ua:
461 Same revision checked out in repo a and ua:
462
462
463 $ hg -R a parents --template "{node|short}\n"
463 $ hg -R a parents --template "{node|short}\n"
464 e8ece76546a6
464 e8ece76546a6
465 $ hg -R ua parents --template "{node|short}\n"
465 $ hg -R ua parents --template "{node|short}\n"
466 e8ece76546a6
466 e8ece76546a6
467
467
468 $ rm -r ua
468 $ rm -r ua
469
469
470
470
471 Testing -u -r <branch>:
471 Testing -u -r <branch>:
472
472
473 $ hg clone -u . -r stable a ua
473 $ hg clone -u . -r stable a ua
474 adding changesets
474 adding changesets
475 adding manifests
475 adding manifests
476 adding file changes
476 adding file changes
477 added 14 changesets with 14 changes to 3 files
477 added 14 changesets with 14 changes to 3 files
478 new changesets acb14030fe0a:0aae7cf88f0d
478 new changesets acb14030fe0a:0aae7cf88f0d
479 updating to branch stable
479 updating to branch stable
480 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
480 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
481
481
482 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
482 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
483
483
484 $ hg -R ua heads
484 $ hg -R ua heads
485 changeset: 13:0aae7cf88f0d
485 changeset: 13:0aae7cf88f0d
486 branch: stable
486 branch: stable
487 tag: tip
487 tag: tip
488 user: test
488 user: test
489 date: Thu Jan 01 00:00:00 1970 +0000
489 date: Thu Jan 01 00:00:00 1970 +0000
490 summary: another change for branch stable
490 summary: another change for branch stable
491
491
492 changeset: 10:a7949464abda
492 changeset: 10:a7949464abda
493 user: test
493 user: test
494 date: Thu Jan 01 00:00:00 1970 +0000
494 date: Thu Jan 01 00:00:00 1970 +0000
495 summary: test
495 summary: test
496
496
497
497
498 Same revision checked out in repo a and ua:
498 Same revision checked out in repo a and ua:
499
499
500 $ hg -R a parents --template "{node|short}\n"
500 $ hg -R a parents --template "{node|short}\n"
501 e8ece76546a6
501 e8ece76546a6
502 $ hg -R ua parents --template "{node|short}\n"
502 $ hg -R ua parents --template "{node|short}\n"
503 e8ece76546a6
503 e8ece76546a6
504
504
505 $ rm -r ua
505 $ rm -r ua
506
506
507
507
508 Testing -r <branch>:
508 Testing -r <branch>:
509
509
510 $ hg clone -r stable a ua
510 $ hg clone -r stable a ua
511 adding changesets
511 adding changesets
512 adding manifests
512 adding manifests
513 adding file changes
513 adding file changes
514 added 14 changesets with 14 changes to 3 files
514 added 14 changesets with 14 changes to 3 files
515 new changesets acb14030fe0a:0aae7cf88f0d
515 new changesets acb14030fe0a:0aae7cf88f0d
516 updating to branch stable
516 updating to branch stable
517 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
517 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
518
518
519 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
519 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
520
520
521 $ hg -R ua heads
521 $ hg -R ua heads
522 changeset: 13:0aae7cf88f0d
522 changeset: 13:0aae7cf88f0d
523 branch: stable
523 branch: stable
524 tag: tip
524 tag: tip
525 user: test
525 user: test
526 date: Thu Jan 01 00:00:00 1970 +0000
526 date: Thu Jan 01 00:00:00 1970 +0000
527 summary: another change for branch stable
527 summary: another change for branch stable
528
528
529 changeset: 10:a7949464abda
529 changeset: 10:a7949464abda
530 user: test
530 user: test
531 date: Thu Jan 01 00:00:00 1970 +0000
531 date: Thu Jan 01 00:00:00 1970 +0000
532 summary: test
532 summary: test
533
533
534
534
535 Branch 'stable' is checked out:
535 Branch 'stable' is checked out:
536
536
537 $ hg -R ua parents
537 $ hg -R ua parents
538 changeset: 13:0aae7cf88f0d
538 changeset: 13:0aae7cf88f0d
539 branch: stable
539 branch: stable
540 tag: tip
540 tag: tip
541 user: test
541 user: test
542 date: Thu Jan 01 00:00:00 1970 +0000
542 date: Thu Jan 01 00:00:00 1970 +0000
543 summary: another change for branch stable
543 summary: another change for branch stable
544
544
545
545
546 $ rm -r ua
546 $ rm -r ua
547
547
548
548
549 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
549 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
550 iterable in addbranchrevs()
550 iterable in addbranchrevs()
551
551
552 $ cat <<EOF > simpleclone.py
552 $ cat <<EOF > simpleclone.py
553 > from mercurial import hg, ui as uimod
553 > from mercurial import hg, ui as uimod
554 > myui = uimod.ui.load()
554 > myui = uimod.ui.load()
555 > repo = hg.repository(myui, b'a')
555 > repo = hg.repository(myui, b'a')
556 > hg.clone(myui, {}, repo, dest=b"ua")
556 > hg.clone(myui, {}, repo, dest=b"ua")
557 > EOF
557 > EOF
558
558
559 $ "$PYTHON" simpleclone.py
559 $ "$PYTHON" simpleclone.py
560 updating to branch default
560 updating to branch default
561 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
561 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
562
562
563 $ rm -r ua
563 $ rm -r ua
564
564
565 $ cat <<EOF > branchclone.py
565 $ cat <<EOF > branchclone.py
566 > from mercurial import extensions, hg, ui as uimod
566 > from mercurial import extensions, hg, ui as uimod
567 > myui = uimod.ui.load()
567 > myui = uimod.ui.load()
568 > extensions.loadall(myui)
568 > extensions.loadall(myui)
569 > extensions.populateui(myui)
569 > extensions.populateui(myui)
570 > repo = hg.repository(myui, b'a')
570 > repo = hg.repository(myui, b'a')
571 > hg.clone(myui, {}, repo, dest=b"ua", branch=[b"stable"])
571 > hg.clone(myui, {}, repo, dest=b"ua", branch=[b"stable"])
572 > EOF
572 > EOF
573
573
574 $ "$PYTHON" branchclone.py
574 $ "$PYTHON" branchclone.py
575 adding changesets
575 adding changesets
576 adding manifests
576 adding manifests
577 adding file changes
577 adding file changes
578 added 14 changesets with 14 changes to 3 files
578 added 14 changesets with 14 changes to 3 files
579 new changesets acb14030fe0a:0aae7cf88f0d
579 new changesets acb14030fe0a:0aae7cf88f0d
580 updating to branch stable
580 updating to branch stable
581 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
581 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
582 $ rm -r ua
582 $ rm -r ua
583
583
584
584
585 Test clone with special '@' bookmark:
585 Test clone with special '@' bookmark:
586 $ cd a
586 $ cd a
587 $ hg bookmark -r a7949464abda @ # branch point of stable from default
587 $ hg bookmark -r a7949464abda @ # branch point of stable from default
588 $ hg clone . ../i
588 $ hg clone . ../i
589 updating to bookmark @
589 updating to bookmark @
590 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
590 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
591 $ hg id -i ../i
591 $ hg id -i ../i
592 a7949464abda
592 a7949464abda
593 $ rm -r ../i
593 $ rm -r ../i
594
594
595 $ hg bookmark -f -r stable @
595 $ hg bookmark -f -r stable @
596 $ hg bookmarks
596 $ hg bookmarks
597 @ 15:0aae7cf88f0d
597 @ 15:0aae7cf88f0d
598 $ hg clone . ../i
598 $ hg clone . ../i
599 updating to bookmark @ on branch stable
599 updating to bookmark @ on branch stable
600 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
600 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
601 $ hg id -i ../i
601 $ hg id -i ../i
602 0aae7cf88f0d
602 0aae7cf88f0d
603 $ cd "$TESTTMP"
603 $ cd "$TESTTMP"
604
604
605
605
606 Testing failures:
606 Testing failures:
607
607
608 $ mkdir fail
608 $ mkdir fail
609 $ cd fail
609 $ cd fail
610
610
611 No local source
611 No local source
612
612
613 $ hg clone a b
613 $ hg clone a b
614 abort: repository a not found!
614 abort: repository a not found!
615 [255]
615 [255]
616
616
617 Invalid URL
617 Invalid URL
618
618
619 $ hg clone http://invalid:url/a b
619 $ hg clone http://invalid:url/a b
620 abort: error: nonnumeric port: 'url'
620 abort: error: nonnumeric port: 'url'
621 [100]
621 [100]
622
622
623 No remote source
623 No remote source
624
624
625 #if windows
625 #if windows
626 $ hg clone http://$LOCALIP:3121/a b
626 $ hg clone http://$LOCALIP:3121/a b
627 abort: error: * (glob)
627 abort: error: * (glob)
628 [255]
628 [255]
629 #else
629 #else
630 $ hg clone http://$LOCALIP:3121/a b
630 $ hg clone http://$LOCALIP:3121/a b
631 abort: error: *refused* (glob)
631 abort: error: *refused* (glob)
632 [100]
632 [100]
633 #endif
633 #endif
634 $ rm -rf b # work around bug with http clone
634 $ rm -rf b # work around bug with http clone
635
635
636
636
637 #if unix-permissions no-root
637 #if unix-permissions no-root
638
638
639 Inaccessible source
639 Inaccessible source
640
640
641 $ mkdir a
641 $ mkdir a
642 $ chmod 000 a
642 $ chmod 000 a
643 $ hg clone a b
643 $ hg clone a b
644 abort: Permission denied: *$TESTTMP/fail/a/.hg* (glob)
644 abort: Permission denied: *$TESTTMP/fail/a/.hg* (glob)
645 [255]
645 [255]
646
646
647 Inaccessible destination
647 Inaccessible destination
648
648
649 $ hg init b
649 $ hg init b
650 $ cd b
650 $ cd b
651 $ hg clone . ../a
651 $ hg clone . ../a
652 abort: Permission denied: *../a* (glob)
652 abort: Permission denied: *../a* (glob)
653 [255]
653 [255]
654 $ cd ..
654 $ cd ..
655 $ chmod 700 a
655 $ chmod 700 a
656 $ rm -r a b
656 $ rm -r a b
657
657
658 #endif
658 #endif
659
659
660
660
661 #if fifo
661 #if fifo
662
662
663 Source of wrong type
663 Source of wrong type
664
664
665 $ mkfifo a
665 $ mkfifo a
666 $ hg clone a b
666 $ hg clone a b
667 abort: $ENOTDIR$: *$TESTTMP/fail/a/.hg* (glob)
667 abort: $ENOTDIR$: *$TESTTMP/fail/a/.hg* (glob)
668 [255]
668 [255]
669 $ rm a
669 $ rm a
670
670
671 #endif
671 #endif
672
672
673 Default destination, same directory
673 Default destination, same directory
674
674
675 $ hg init q
675 $ hg init q
676 $ hg clone q
676 $ hg clone q
677 destination directory: q
677 destination directory: q
678 abort: destination 'q' is not empty
678 abort: destination 'q' is not empty
679 [255]
679 [10]
680
680
681 destination directory not empty
681 destination directory not empty
682
682
683 $ mkdir a
683 $ mkdir a
684 $ echo stuff > a/a
684 $ echo stuff > a/a
685 $ hg clone q a
685 $ hg clone q a
686 abort: destination 'a' is not empty
686 abort: destination 'a' is not empty
687 [255]
687 [10]
688
688
689
689
690 #if unix-permissions no-root
690 #if unix-permissions no-root
691
691
692 leave existing directory in place after clone failure
692 leave existing directory in place after clone failure
693
693
694 $ hg init c
694 $ hg init c
695 $ cd c
695 $ cd c
696 $ echo c > c
696 $ echo c > c
697 $ hg commit -A -m test
697 $ hg commit -A -m test
698 adding c
698 adding c
699 $ chmod -rx .hg/store/data
699 $ chmod -rx .hg/store/data
700 $ cd ..
700 $ cd ..
701 $ mkdir d
701 $ mkdir d
702 $ hg clone c d 2> err
702 $ hg clone c d 2> err
703 [255]
703 [255]
704 $ test -d d
704 $ test -d d
705 $ test -d d/.hg
705 $ test -d d/.hg
706 [1]
706 [1]
707
707
708 re-enable perm to allow deletion
708 re-enable perm to allow deletion
709
709
710 $ chmod +rx c/.hg/store/data
710 $ chmod +rx c/.hg/store/data
711
711
712 #endif
712 #endif
713
713
714 $ cd ..
714 $ cd ..
715
715
716 Test clone from the repository in (emulated) revlog format 0 (issue4203):
716 Test clone from the repository in (emulated) revlog format 0 (issue4203):
717
717
718 $ mkdir issue4203
718 $ mkdir issue4203
719 $ mkdir -p src/.hg
719 $ mkdir -p src/.hg
720 $ echo foo > src/foo
720 $ echo foo > src/foo
721 $ hg -R src add src/foo
721 $ hg -R src add src/foo
722 $ hg -R src commit -m '#0'
722 $ hg -R src commit -m '#0'
723 $ hg -R src log -q
723 $ hg -R src log -q
724 0:e1bab28bca43
724 0:e1bab28bca43
725 $ hg -R src debugrevlog -c | egrep 'format|flags'
725 $ hg -R src debugrevlog -c | egrep 'format|flags'
726 format : 0
726 format : 0
727 flags : (none)
727 flags : (none)
728 $ hg root -R src -T json | sed 's|\\\\|\\|g'
728 $ hg root -R src -T json | sed 's|\\\\|\\|g'
729 [
729 [
730 {
730 {
731 "hgpath": "$TESTTMP/src/.hg",
731 "hgpath": "$TESTTMP/src/.hg",
732 "reporoot": "$TESTTMP/src",
732 "reporoot": "$TESTTMP/src",
733 "storepath": "$TESTTMP/src/.hg"
733 "storepath": "$TESTTMP/src/.hg"
734 }
734 }
735 ]
735 ]
736 $ hg clone -U -q src dst
736 $ hg clone -U -q src dst
737 $ hg -R dst log -q
737 $ hg -R dst log -q
738 0:e1bab28bca43
738 0:e1bab28bca43
739
739
740 Create repositories to test auto sharing functionality
740 Create repositories to test auto sharing functionality
741
741
742 $ cat >> $HGRCPATH << EOF
742 $ cat >> $HGRCPATH << EOF
743 > [extensions]
743 > [extensions]
744 > share=
744 > share=
745 > EOF
745 > EOF
746
746
747 $ hg init empty
747 $ hg init empty
748 $ hg init source1a
748 $ hg init source1a
749 $ cd source1a
749 $ cd source1a
750 $ echo initial1 > foo
750 $ echo initial1 > foo
751 $ hg -q commit -A -m initial
751 $ hg -q commit -A -m initial
752 $ echo second > foo
752 $ echo second > foo
753 $ hg commit -m second
753 $ hg commit -m second
754 $ cd ..
754 $ cd ..
755
755
756 $ hg init filteredrev0
756 $ hg init filteredrev0
757 $ cd filteredrev0
757 $ cd filteredrev0
758 $ cat >> .hg/hgrc << EOF
758 $ cat >> .hg/hgrc << EOF
759 > [experimental]
759 > [experimental]
760 > evolution.createmarkers=True
760 > evolution.createmarkers=True
761 > EOF
761 > EOF
762 $ echo initial1 > foo
762 $ echo initial1 > foo
763 $ hg -q commit -A -m initial0
763 $ hg -q commit -A -m initial0
764 $ hg -q up -r null
764 $ hg -q up -r null
765 $ echo initial2 > foo
765 $ echo initial2 > foo
766 $ hg -q commit -A -m initial1
766 $ hg -q commit -A -m initial1
767 $ hg debugobsolete c05d5c47a5cf81401869999f3d05f7d699d2b29a e082c1832e09a7d1e78b7fd49a592d372de854c8
767 $ hg debugobsolete c05d5c47a5cf81401869999f3d05f7d699d2b29a e082c1832e09a7d1e78b7fd49a592d372de854c8
768 1 new obsolescence markers
768 1 new obsolescence markers
769 obsoleted 1 changesets
769 obsoleted 1 changesets
770 $ cd ..
770 $ cd ..
771
771
772 $ hg -q clone --pull source1a source1b
772 $ hg -q clone --pull source1a source1b
773 $ cd source1a
773 $ cd source1a
774 $ hg bookmark bookA
774 $ hg bookmark bookA
775 $ echo 1a > foo
775 $ echo 1a > foo
776 $ hg commit -m 1a
776 $ hg commit -m 1a
777 $ cd ../source1b
777 $ cd ../source1b
778 $ hg -q up -r 0
778 $ hg -q up -r 0
779 $ echo head1 > foo
779 $ echo head1 > foo
780 $ hg commit -m head1
780 $ hg commit -m head1
781 created new head
781 created new head
782 $ hg bookmark head1
782 $ hg bookmark head1
783 $ hg -q up -r 0
783 $ hg -q up -r 0
784 $ echo head2 > foo
784 $ echo head2 > foo
785 $ hg commit -m head2
785 $ hg commit -m head2
786 created new head
786 created new head
787 $ hg bookmark head2
787 $ hg bookmark head2
788 $ hg -q up -r 0
788 $ hg -q up -r 0
789 $ hg branch branch1
789 $ hg branch branch1
790 marked working directory as branch branch1
790 marked working directory as branch branch1
791 (branches are permanent and global, did you want a bookmark?)
791 (branches are permanent and global, did you want a bookmark?)
792 $ echo branch1 > foo
792 $ echo branch1 > foo
793 $ hg commit -m branch1
793 $ hg commit -m branch1
794 $ hg -q up -r 0
794 $ hg -q up -r 0
795 $ hg branch branch2
795 $ hg branch branch2
796 marked working directory as branch branch2
796 marked working directory as branch branch2
797 $ echo branch2 > foo
797 $ echo branch2 > foo
798 $ hg commit -m branch2
798 $ hg commit -m branch2
799 $ cd ..
799 $ cd ..
800 $ hg init source2
800 $ hg init source2
801 $ cd source2
801 $ cd source2
802 $ echo initial2 > foo
802 $ echo initial2 > foo
803 $ hg -q commit -A -m initial2
803 $ hg -q commit -A -m initial2
804 $ echo second > foo
804 $ echo second > foo
805 $ hg commit -m second
805 $ hg commit -m second
806 $ cd ..
806 $ cd ..
807
807
808 Clone with auto share from an empty repo should not result in share
808 Clone with auto share from an empty repo should not result in share
809
809
810 $ mkdir share
810 $ mkdir share
811 $ hg --config share.pool=share clone empty share-empty
811 $ hg --config share.pool=share clone empty share-empty
812 (not using pooled storage: remote appears to be empty)
812 (not using pooled storage: remote appears to be empty)
813 updating to branch default
813 updating to branch default
814 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
814 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
815 $ ls share
815 $ ls share
816 $ test -d share-empty/.hg/store
816 $ test -d share-empty/.hg/store
817 $ test -f share-empty/.hg/sharedpath
817 $ test -f share-empty/.hg/sharedpath
818 [1]
818 [1]
819
819
820 Clone with auto share from a repo with filtered revision 0 should not result in share
820 Clone with auto share from a repo with filtered revision 0 should not result in share
821
821
822 $ hg --config share.pool=share clone filteredrev0 share-filtered
822 $ hg --config share.pool=share clone filteredrev0 share-filtered
823 (not using pooled storage: unable to resolve identity of remote)
823 (not using pooled storage: unable to resolve identity of remote)
824 requesting all changes
824 requesting all changes
825 adding changesets
825 adding changesets
826 adding manifests
826 adding manifests
827 adding file changes
827 adding file changes
828 added 1 changesets with 1 changes to 1 files
828 added 1 changesets with 1 changes to 1 files
829 new changesets e082c1832e09
829 new changesets e082c1832e09
830 updating to branch default
830 updating to branch default
831 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
831 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
832
832
833 Clone from repo with content should result in shared store being created
833 Clone from repo with content should result in shared store being created
834
834
835 $ hg --config share.pool=share clone source1a share-dest1a
835 $ hg --config share.pool=share clone source1a share-dest1a
836 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
836 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
837 requesting all changes
837 requesting all changes
838 adding changesets
838 adding changesets
839 adding manifests
839 adding manifests
840 adding file changes
840 adding file changes
841 added 3 changesets with 3 changes to 1 files
841 added 3 changesets with 3 changes to 1 files
842 new changesets b5f04eac9d8f:e5bfe23c0b47
842 new changesets b5f04eac9d8f:e5bfe23c0b47
843 searching for changes
843 searching for changes
844 no changes found
844 no changes found
845 adding remote bookmark bookA
845 adding remote bookmark bookA
846 updating working directory
846 updating working directory
847 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
847 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
848
848
849 The shared repo should have been created
849 The shared repo should have been created
850
850
851 $ ls share
851 $ ls share
852 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
852 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
853
853
854 The destination should point to it
854 The destination should point to it
855
855
856 $ cat share-dest1a/.hg/sharedpath; echo
856 $ cat share-dest1a/.hg/sharedpath; echo
857 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
857 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
858
858
859 The destination should have bookmarks
859 The destination should have bookmarks
860
860
861 $ hg -R share-dest1a bookmarks
861 $ hg -R share-dest1a bookmarks
862 bookA 2:e5bfe23c0b47
862 bookA 2:e5bfe23c0b47
863
863
864 The default path should be the remote, not the share
864 The default path should be the remote, not the share
865
865
866 $ hg -R share-dest1a config paths.default
866 $ hg -R share-dest1a config paths.default
867 $TESTTMP/source1a
867 $TESTTMP/source1a
868
868
869 Clone with existing share dir should result in pull + share
869 Clone with existing share dir should result in pull + share
870
870
871 $ hg --config share.pool=share clone source1b share-dest1b
871 $ hg --config share.pool=share clone source1b share-dest1b
872 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
872 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
873 searching for changes
873 searching for changes
874 adding changesets
874 adding changesets
875 adding manifests
875 adding manifests
876 adding file changes
876 adding file changes
877 adding remote bookmark head1
877 adding remote bookmark head1
878 adding remote bookmark head2
878 adding remote bookmark head2
879 added 4 changesets with 4 changes to 1 files (+4 heads)
879 added 4 changesets with 4 changes to 1 files (+4 heads)
880 new changesets 4a8dc1ab4c13:6bacf4683960
880 new changesets 4a8dc1ab4c13:6bacf4683960
881 updating working directory
881 updating working directory
882 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
882 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
883
883
884 $ ls share
884 $ ls share
885 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
885 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
886
886
887 $ cat share-dest1b/.hg/sharedpath; echo
887 $ cat share-dest1b/.hg/sharedpath; echo
888 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
888 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
889
889
890 We only get bookmarks from the remote, not everything in the share
890 We only get bookmarks from the remote, not everything in the share
891
891
892 $ hg -R share-dest1b bookmarks
892 $ hg -R share-dest1b bookmarks
893 head1 3:4a8dc1ab4c13
893 head1 3:4a8dc1ab4c13
894 head2 4:99f71071f117
894 head2 4:99f71071f117
895
895
896 Default path should be source, not share.
896 Default path should be source, not share.
897
897
898 $ hg -R share-dest1b config paths.default
898 $ hg -R share-dest1b config paths.default
899 $TESTTMP/source1b
899 $TESTTMP/source1b
900
900
901 Checked out revision should be head of default branch
901 Checked out revision should be head of default branch
902
902
903 $ hg -R share-dest1b log -r .
903 $ hg -R share-dest1b log -r .
904 changeset: 4:99f71071f117
904 changeset: 4:99f71071f117
905 bookmark: head2
905 bookmark: head2
906 parent: 0:b5f04eac9d8f
906 parent: 0:b5f04eac9d8f
907 user: test
907 user: test
908 date: Thu Jan 01 00:00:00 1970 +0000
908 date: Thu Jan 01 00:00:00 1970 +0000
909 summary: head2
909 summary: head2
910
910
911
911
912 Clone from unrelated repo should result in new share
912 Clone from unrelated repo should result in new share
913
913
914 $ hg --config share.pool=share clone source2 share-dest2
914 $ hg --config share.pool=share clone source2 share-dest2
915 (sharing from new pooled repository 22aeff664783fd44c6d9b435618173c118c3448e)
915 (sharing from new pooled repository 22aeff664783fd44c6d9b435618173c118c3448e)
916 requesting all changes
916 requesting all changes
917 adding changesets
917 adding changesets
918 adding manifests
918 adding manifests
919 adding file changes
919 adding file changes
920 added 2 changesets with 2 changes to 1 files
920 added 2 changesets with 2 changes to 1 files
921 new changesets 22aeff664783:63cf6c3dba4a
921 new changesets 22aeff664783:63cf6c3dba4a
922 searching for changes
922 searching for changes
923 no changes found
923 no changes found
924 updating working directory
924 updating working directory
925 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
925 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
926
926
927 $ ls share
927 $ ls share
928 22aeff664783fd44c6d9b435618173c118c3448e
928 22aeff664783fd44c6d9b435618173c118c3448e
929 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
929 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
930
930
931 remote naming mode works as advertised
931 remote naming mode works as advertised
932
932
933 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1a share-remote1a
933 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1a share-remote1a
934 (sharing from new pooled repository 195bb1fcdb595c14a6c13e0269129ed78f6debde)
934 (sharing from new pooled repository 195bb1fcdb595c14a6c13e0269129ed78f6debde)
935 requesting all changes
935 requesting all changes
936 adding changesets
936 adding changesets
937 adding manifests
937 adding manifests
938 adding file changes
938 adding file changes
939 added 3 changesets with 3 changes to 1 files
939 added 3 changesets with 3 changes to 1 files
940 new changesets b5f04eac9d8f:e5bfe23c0b47
940 new changesets b5f04eac9d8f:e5bfe23c0b47
941 searching for changes
941 searching for changes
942 no changes found
942 no changes found
943 adding remote bookmark bookA
943 adding remote bookmark bookA
944 updating working directory
944 updating working directory
945 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
945 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
946
946
947 $ ls shareremote
947 $ ls shareremote
948 195bb1fcdb595c14a6c13e0269129ed78f6debde
948 195bb1fcdb595c14a6c13e0269129ed78f6debde
949
949
950 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1b share-remote1b
950 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1b share-remote1b
951 (sharing from new pooled repository c0d4f83847ca2a873741feb7048a45085fd47c46)
951 (sharing from new pooled repository c0d4f83847ca2a873741feb7048a45085fd47c46)
952 requesting all changes
952 requesting all changes
953 adding changesets
953 adding changesets
954 adding manifests
954 adding manifests
955 adding file changes
955 adding file changes
956 added 6 changesets with 6 changes to 1 files (+4 heads)
956 added 6 changesets with 6 changes to 1 files (+4 heads)
957 new changesets b5f04eac9d8f:6bacf4683960
957 new changesets b5f04eac9d8f:6bacf4683960
958 searching for changes
958 searching for changes
959 no changes found
959 no changes found
960 adding remote bookmark head1
960 adding remote bookmark head1
961 adding remote bookmark head2
961 adding remote bookmark head2
962 updating working directory
962 updating working directory
963 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
963 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
964
964
965 $ ls shareremote
965 $ ls shareremote
966 195bb1fcdb595c14a6c13e0269129ed78f6debde
966 195bb1fcdb595c14a6c13e0269129ed78f6debde
967 c0d4f83847ca2a873741feb7048a45085fd47c46
967 c0d4f83847ca2a873741feb7048a45085fd47c46
968
968
969 request to clone a single revision is respected in sharing mode
969 request to clone a single revision is respected in sharing mode
970
970
971 $ hg --config share.pool=sharerevs clone -r 4a8dc1ab4c13 source1b share-1arev
971 $ hg --config share.pool=sharerevs clone -r 4a8dc1ab4c13 source1b share-1arev
972 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
972 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
973 adding changesets
973 adding changesets
974 adding manifests
974 adding manifests
975 adding file changes
975 adding file changes
976 added 2 changesets with 2 changes to 1 files
976 added 2 changesets with 2 changes to 1 files
977 new changesets b5f04eac9d8f:4a8dc1ab4c13
977 new changesets b5f04eac9d8f:4a8dc1ab4c13
978 no changes found
978 no changes found
979 adding remote bookmark head1
979 adding remote bookmark head1
980 updating working directory
980 updating working directory
981 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
981 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
982
982
983 $ hg -R share-1arev log -G
983 $ hg -R share-1arev log -G
984 @ changeset: 1:4a8dc1ab4c13
984 @ changeset: 1:4a8dc1ab4c13
985 | bookmark: head1
985 | bookmark: head1
986 | tag: tip
986 | tag: tip
987 | user: test
987 | user: test
988 | date: Thu Jan 01 00:00:00 1970 +0000
988 | date: Thu Jan 01 00:00:00 1970 +0000
989 | summary: head1
989 | summary: head1
990 |
990 |
991 o changeset: 0:b5f04eac9d8f
991 o changeset: 0:b5f04eac9d8f
992 user: test
992 user: test
993 date: Thu Jan 01 00:00:00 1970 +0000
993 date: Thu Jan 01 00:00:00 1970 +0000
994 summary: initial
994 summary: initial
995
995
996
996
997 making another clone should only pull down requested rev
997 making another clone should only pull down requested rev
998
998
999 $ hg --config share.pool=sharerevs clone -r 99f71071f117 source1b share-1brev
999 $ hg --config share.pool=sharerevs clone -r 99f71071f117 source1b share-1brev
1000 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1000 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1001 searching for changes
1001 searching for changes
1002 adding changesets
1002 adding changesets
1003 adding manifests
1003 adding manifests
1004 adding file changes
1004 adding file changes
1005 adding remote bookmark head1
1005 adding remote bookmark head1
1006 adding remote bookmark head2
1006 adding remote bookmark head2
1007 added 1 changesets with 1 changes to 1 files (+1 heads)
1007 added 1 changesets with 1 changes to 1 files (+1 heads)
1008 new changesets 99f71071f117
1008 new changesets 99f71071f117
1009 updating working directory
1009 updating working directory
1010 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1010 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1011
1011
1012 $ hg -R share-1brev log -G
1012 $ hg -R share-1brev log -G
1013 @ changeset: 2:99f71071f117
1013 @ changeset: 2:99f71071f117
1014 | bookmark: head2
1014 | bookmark: head2
1015 | tag: tip
1015 | tag: tip
1016 | parent: 0:b5f04eac9d8f
1016 | parent: 0:b5f04eac9d8f
1017 | user: test
1017 | user: test
1018 | date: Thu Jan 01 00:00:00 1970 +0000
1018 | date: Thu Jan 01 00:00:00 1970 +0000
1019 | summary: head2
1019 | summary: head2
1020 |
1020 |
1021 | o changeset: 1:4a8dc1ab4c13
1021 | o changeset: 1:4a8dc1ab4c13
1022 |/ bookmark: head1
1022 |/ bookmark: head1
1023 | user: test
1023 | user: test
1024 | date: Thu Jan 01 00:00:00 1970 +0000
1024 | date: Thu Jan 01 00:00:00 1970 +0000
1025 | summary: head1
1025 | summary: head1
1026 |
1026 |
1027 o changeset: 0:b5f04eac9d8f
1027 o changeset: 0:b5f04eac9d8f
1028 user: test
1028 user: test
1029 date: Thu Jan 01 00:00:00 1970 +0000
1029 date: Thu Jan 01 00:00:00 1970 +0000
1030 summary: initial
1030 summary: initial
1031
1031
1032
1032
1033 Request to clone a single branch is respected in sharing mode
1033 Request to clone a single branch is respected in sharing mode
1034
1034
1035 $ hg --config share.pool=sharebranch clone -b branch1 source1b share-1bbranch1
1035 $ hg --config share.pool=sharebranch clone -b branch1 source1b share-1bbranch1
1036 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1036 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1037 adding changesets
1037 adding changesets
1038 adding manifests
1038 adding manifests
1039 adding file changes
1039 adding file changes
1040 added 2 changesets with 2 changes to 1 files
1040 added 2 changesets with 2 changes to 1 files
1041 new changesets b5f04eac9d8f:5f92a6c1a1b1
1041 new changesets b5f04eac9d8f:5f92a6c1a1b1
1042 no changes found
1042 no changes found
1043 updating working directory
1043 updating working directory
1044 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1044 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1045
1045
1046 $ hg -R share-1bbranch1 log -G
1046 $ hg -R share-1bbranch1 log -G
1047 o changeset: 1:5f92a6c1a1b1
1047 o changeset: 1:5f92a6c1a1b1
1048 | branch: branch1
1048 | branch: branch1
1049 | tag: tip
1049 | tag: tip
1050 | user: test
1050 | user: test
1051 | date: Thu Jan 01 00:00:00 1970 +0000
1051 | date: Thu Jan 01 00:00:00 1970 +0000
1052 | summary: branch1
1052 | summary: branch1
1053 |
1053 |
1054 @ changeset: 0:b5f04eac9d8f
1054 @ changeset: 0:b5f04eac9d8f
1055 user: test
1055 user: test
1056 date: Thu Jan 01 00:00:00 1970 +0000
1056 date: Thu Jan 01 00:00:00 1970 +0000
1057 summary: initial
1057 summary: initial
1058
1058
1059
1059
1060 $ hg --config share.pool=sharebranch clone -b branch2 source1b share-1bbranch2
1060 $ hg --config share.pool=sharebranch clone -b branch2 source1b share-1bbranch2
1061 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1061 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1062 searching for changes
1062 searching for changes
1063 adding changesets
1063 adding changesets
1064 adding manifests
1064 adding manifests
1065 adding file changes
1065 adding file changes
1066 added 1 changesets with 1 changes to 1 files (+1 heads)
1066 added 1 changesets with 1 changes to 1 files (+1 heads)
1067 new changesets 6bacf4683960
1067 new changesets 6bacf4683960
1068 updating working directory
1068 updating working directory
1069 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1069 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1070
1070
1071 $ hg -R share-1bbranch2 log -G
1071 $ hg -R share-1bbranch2 log -G
1072 o changeset: 2:6bacf4683960
1072 o changeset: 2:6bacf4683960
1073 | branch: branch2
1073 | branch: branch2
1074 | tag: tip
1074 | tag: tip
1075 | parent: 0:b5f04eac9d8f
1075 | parent: 0:b5f04eac9d8f
1076 | user: test
1076 | user: test
1077 | date: Thu Jan 01 00:00:00 1970 +0000
1077 | date: Thu Jan 01 00:00:00 1970 +0000
1078 | summary: branch2
1078 | summary: branch2
1079 |
1079 |
1080 | o changeset: 1:5f92a6c1a1b1
1080 | o changeset: 1:5f92a6c1a1b1
1081 |/ branch: branch1
1081 |/ branch: branch1
1082 | user: test
1082 | user: test
1083 | date: Thu Jan 01 00:00:00 1970 +0000
1083 | date: Thu Jan 01 00:00:00 1970 +0000
1084 | summary: branch1
1084 | summary: branch1
1085 |
1085 |
1086 @ changeset: 0:b5f04eac9d8f
1086 @ changeset: 0:b5f04eac9d8f
1087 user: test
1087 user: test
1088 date: Thu Jan 01 00:00:00 1970 +0000
1088 date: Thu Jan 01 00:00:00 1970 +0000
1089 summary: initial
1089 summary: initial
1090
1090
1091
1091
1092 -U is respected in share clone mode
1092 -U is respected in share clone mode
1093
1093
1094 $ hg --config share.pool=share clone -U source1a share-1anowc
1094 $ hg --config share.pool=share clone -U source1a share-1anowc
1095 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1095 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1096 searching for changes
1096 searching for changes
1097 no changes found
1097 no changes found
1098 adding remote bookmark bookA
1098 adding remote bookmark bookA
1099
1099
1100 $ ls -A share-1anowc
1100 $ ls -A share-1anowc
1101 .hg
1101 .hg
1102
1102
1103 Test that auto sharing doesn't cause failure of "hg clone local remote"
1103 Test that auto sharing doesn't cause failure of "hg clone local remote"
1104
1104
1105 $ cd $TESTTMP
1105 $ cd $TESTTMP
1106 $ hg -R a id -r 0
1106 $ hg -R a id -r 0
1107 acb14030fe0a
1107 acb14030fe0a
1108 $ hg id -R remote -r 0
1108 $ hg id -R remote -r 0
1109 abort: repository remote not found!
1109 abort: repository remote not found!
1110 [255]
1110 [255]
1111 $ hg --config share.pool=share -q clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" a ssh://user@dummy/remote
1111 $ hg --config share.pool=share -q clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" a ssh://user@dummy/remote
1112 $ hg -R remote id -r 0
1112 $ hg -R remote id -r 0
1113 acb14030fe0a
1113 acb14030fe0a
1114
1114
1115 Cloning into pooled storage doesn't race (issue5104)
1115 Cloning into pooled storage doesn't race (issue5104)
1116
1116
1117 $ HGPOSTLOCKDELAY=2.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace1 > race1.log 2>&1 &
1117 $ HGPOSTLOCKDELAY=2.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace1 > race1.log 2>&1 &
1118 $ HGPRELOCKDELAY=1.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace2 > race2.log 2>&1
1118 $ HGPRELOCKDELAY=1.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace2 > race2.log 2>&1
1119 $ wait
1119 $ wait
1120
1120
1121 $ hg -R share-destrace1 log -r tip
1121 $ hg -R share-destrace1 log -r tip
1122 changeset: 2:e5bfe23c0b47
1122 changeset: 2:e5bfe23c0b47
1123 bookmark: bookA
1123 bookmark: bookA
1124 tag: tip
1124 tag: tip
1125 user: test
1125 user: test
1126 date: Thu Jan 01 00:00:00 1970 +0000
1126 date: Thu Jan 01 00:00:00 1970 +0000
1127 summary: 1a
1127 summary: 1a
1128
1128
1129
1129
1130 $ hg -R share-destrace2 log -r tip
1130 $ hg -R share-destrace2 log -r tip
1131 changeset: 2:e5bfe23c0b47
1131 changeset: 2:e5bfe23c0b47
1132 bookmark: bookA
1132 bookmark: bookA
1133 tag: tip
1133 tag: tip
1134 user: test
1134 user: test
1135 date: Thu Jan 01 00:00:00 1970 +0000
1135 date: Thu Jan 01 00:00:00 1970 +0000
1136 summary: 1a
1136 summary: 1a
1137
1137
1138 One repo should be new, the other should be shared from the pool. We
1138 One repo should be new, the other should be shared from the pool. We
1139 don't care which is which, so we just make sure we always print the
1139 don't care which is which, so we just make sure we always print the
1140 one containing "new pooled" first, then one one containing "existing
1140 one containing "new pooled" first, then one one containing "existing
1141 pooled".
1141 pooled".
1142
1142
1143 $ (grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1143 $ (grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1144 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1144 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1145 requesting all changes
1145 requesting all changes
1146 adding changesets
1146 adding changesets
1147 adding manifests
1147 adding manifests
1148 adding file changes
1148 adding file changes
1149 added 3 changesets with 3 changes to 1 files
1149 added 3 changesets with 3 changes to 1 files
1150 new changesets b5f04eac9d8f:e5bfe23c0b47
1150 new changesets b5f04eac9d8f:e5bfe23c0b47
1151 searching for changes
1151 searching for changes
1152 no changes found
1152 no changes found
1153 adding remote bookmark bookA
1153 adding remote bookmark bookA
1154 updating working directory
1154 updating working directory
1155 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1155 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1156
1156
1157 $ (grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1157 $ (grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1158 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1158 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1159 searching for changes
1159 searching for changes
1160 no changes found
1160 no changes found
1161 adding remote bookmark bookA
1161 adding remote bookmark bookA
1162 updating working directory
1162 updating working directory
1163 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1163 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1164
1164
1165 SEC: check for unsafe ssh url
1165 SEC: check for unsafe ssh url
1166
1166
1167 $ cat >> $HGRCPATH << EOF
1167 $ cat >> $HGRCPATH << EOF
1168 > [ui]
1168 > [ui]
1169 > ssh = sh -c "read l; read l; read l"
1169 > ssh = sh -c "read l; read l; read l"
1170 > EOF
1170 > EOF
1171
1171
1172 $ hg clone 'ssh://-oProxyCommand=touch${IFS}owned/path'
1172 $ hg clone 'ssh://-oProxyCommand=touch${IFS}owned/path'
1173 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1173 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1174 [255]
1174 [255]
1175 $ hg clone 'ssh://%2DoProxyCommand=touch${IFS}owned/path'
1175 $ hg clone 'ssh://%2DoProxyCommand=touch${IFS}owned/path'
1176 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1176 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1177 [255]
1177 [255]
1178 $ hg clone 'ssh://fakehost|touch%20owned/path'
1178 $ hg clone 'ssh://fakehost|touch%20owned/path'
1179 abort: no suitable response from remote hg!
1179 abort: no suitable response from remote hg!
1180 [255]
1180 [255]
1181 $ hg clone 'ssh://fakehost%7Ctouch%20owned/path'
1181 $ hg clone 'ssh://fakehost%7Ctouch%20owned/path'
1182 abort: no suitable response from remote hg!
1182 abort: no suitable response from remote hg!
1183 [255]
1183 [255]
1184
1184
1185 $ hg clone 'ssh://-oProxyCommand=touch owned%20foo@example.com/nonexistent/path'
1185 $ hg clone 'ssh://-oProxyCommand=touch owned%20foo@example.com/nonexistent/path'
1186 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned foo@example.com/nonexistent/path'
1186 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned foo@example.com/nonexistent/path'
1187 [255]
1187 [255]
1188
1188
1189 #if windows
1189 #if windows
1190 $ hg clone "ssh://%26touch%20owned%20/" --debug
1190 $ hg clone "ssh://%26touch%20owned%20/" --debug
1191 running sh -c "read l; read l; read l" "&touch owned " "hg -R . serve --stdio"
1191 running sh -c "read l; read l; read l" "&touch owned " "hg -R . serve --stdio"
1192 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
1192 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
1193 sending hello command
1193 sending hello command
1194 sending between command
1194 sending between command
1195 abort: no suitable response from remote hg!
1195 abort: no suitable response from remote hg!
1196 [255]
1196 [255]
1197 $ hg clone "ssh://example.com:%26touch%20owned%20/" --debug
1197 $ hg clone "ssh://example.com:%26touch%20owned%20/" --debug
1198 running sh -c "read l; read l; read l" -p "&touch owned " example.com "hg -R . serve --stdio"
1198 running sh -c "read l; read l; read l" -p "&touch owned " example.com "hg -R . serve --stdio"
1199 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
1199 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
1200 sending hello command
1200 sending hello command
1201 sending between command
1201 sending between command
1202 abort: no suitable response from remote hg!
1202 abort: no suitable response from remote hg!
1203 [255]
1203 [255]
1204 #else
1204 #else
1205 $ hg clone "ssh://%3btouch%20owned%20/" --debug
1205 $ hg clone "ssh://%3btouch%20owned%20/" --debug
1206 running sh -c "read l; read l; read l" ';touch owned ' 'hg -R . serve --stdio'
1206 running sh -c "read l; read l; read l" ';touch owned ' 'hg -R . serve --stdio'
1207 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
1207 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
1208 sending hello command
1208 sending hello command
1209 sending between command
1209 sending between command
1210 abort: no suitable response from remote hg!
1210 abort: no suitable response from remote hg!
1211 [255]
1211 [255]
1212 $ hg clone "ssh://example.com:%3btouch%20owned%20/" --debug
1212 $ hg clone "ssh://example.com:%3btouch%20owned%20/" --debug
1213 running sh -c "read l; read l; read l" -p ';touch owned ' example.com 'hg -R . serve --stdio'
1213 running sh -c "read l; read l; read l" -p ';touch owned ' example.com 'hg -R . serve --stdio'
1214 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
1214 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
1215 sending hello command
1215 sending hello command
1216 sending between command
1216 sending between command
1217 abort: no suitable response from remote hg!
1217 abort: no suitable response from remote hg!
1218 [255]
1218 [255]
1219 #endif
1219 #endif
1220
1220
1221 $ hg clone "ssh://v-alid.example.com/" --debug
1221 $ hg clone "ssh://v-alid.example.com/" --debug
1222 running sh -c "read l; read l; read l" v-alid\.example\.com ['"]hg -R \. serve --stdio['"] (re)
1222 running sh -c "read l; read l; read l" v-alid\.example\.com ['"]hg -R \. serve --stdio['"] (re)
1223 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
1223 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
1224 sending hello command
1224 sending hello command
1225 sending between command
1225 sending between command
1226 abort: no suitable response from remote hg!
1226 abort: no suitable response from remote hg!
1227 [255]
1227 [255]
1228
1228
1229 We should not have created a file named owned - if it exists, the
1229 We should not have created a file named owned - if it exists, the
1230 attack succeeded.
1230 attack succeeded.
1231 $ if test -f owned; then echo 'you got owned'; fi
1231 $ if test -f owned; then echo 'you got owned'; fi
1232
1232
1233 Cloning without fsmonitor enabled does not print a warning for small repos
1233 Cloning without fsmonitor enabled does not print a warning for small repos
1234
1234
1235 $ hg clone a fsmonitor-default
1235 $ hg clone a fsmonitor-default
1236 updating to bookmark @ on branch stable
1236 updating to bookmark @ on branch stable
1237 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1237 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1238
1238
1239 Lower the warning threshold to simulate a large repo
1239 Lower the warning threshold to simulate a large repo
1240
1240
1241 $ cat >> $HGRCPATH << EOF
1241 $ cat >> $HGRCPATH << EOF
1242 > [fsmonitor]
1242 > [fsmonitor]
1243 > warn_update_file_count = 2
1243 > warn_update_file_count = 2
1244 > warn_update_file_count_rust = 2
1244 > warn_update_file_count_rust = 2
1245 > EOF
1245 > EOF
1246
1246
1247 We should see a warning about no fsmonitor on supported platforms
1247 We should see a warning about no fsmonitor on supported platforms
1248
1248
1249 #if linuxormacos no-fsmonitor
1249 #if linuxormacos no-fsmonitor
1250 $ hg clone a nofsmonitor
1250 $ hg clone a nofsmonitor
1251 updating to bookmark @ on branch stable
1251 updating to bookmark @ on branch stable
1252 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
1252 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
1253 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1253 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1254 #else
1254 #else
1255 $ hg clone a nofsmonitor
1255 $ hg clone a nofsmonitor
1256 updating to bookmark @ on branch stable
1256 updating to bookmark @ on branch stable
1257 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1257 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1258 #endif
1258 #endif
1259
1259
1260 We should not see warning about fsmonitor when it is enabled
1260 We should not see warning about fsmonitor when it is enabled
1261
1261
1262 #if fsmonitor
1262 #if fsmonitor
1263 $ hg clone a fsmonitor-enabled
1263 $ hg clone a fsmonitor-enabled
1264 updating to bookmark @ on branch stable
1264 updating to bookmark @ on branch stable
1265 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1265 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1266 #endif
1266 #endif
1267
1267
1268 We can disable the fsmonitor warning
1268 We can disable the fsmonitor warning
1269
1269
1270 $ hg --config fsmonitor.warn_when_unused=false clone a fsmonitor-disable-warning
1270 $ hg --config fsmonitor.warn_when_unused=false clone a fsmonitor-disable-warning
1271 updating to bookmark @ on branch stable
1271 updating to bookmark @ on branch stable
1272 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1272 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1273
1273
1274 Loaded fsmonitor but disabled in config should still print warning
1274 Loaded fsmonitor but disabled in config should still print warning
1275
1275
1276 #if linuxormacos fsmonitor
1276 #if linuxormacos fsmonitor
1277 $ hg --config fsmonitor.mode=off clone a fsmonitor-mode-off
1277 $ hg --config fsmonitor.mode=off clone a fsmonitor-mode-off
1278 updating to bookmark @ on branch stable
1278 updating to bookmark @ on branch stable
1279 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (fsmonitor !)
1279 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (fsmonitor !)
1280 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1280 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1281 #endif
1281 #endif
1282
1282
1283 Warning not printed if working directory isn't empty
1283 Warning not printed if working directory isn't empty
1284
1284
1285 $ hg -q clone a fsmonitor-update
1285 $ hg -q clone a fsmonitor-update
1286 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (?)
1286 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (?)
1287 $ cd fsmonitor-update
1287 $ cd fsmonitor-update
1288 $ hg up acb14030fe0a
1288 $ hg up acb14030fe0a
1289 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1289 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1290 (leaving bookmark @)
1290 (leaving bookmark @)
1291 $ hg up cf0fe1914066
1291 $ hg up cf0fe1914066
1292 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1292 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1293
1293
1294 `hg update` from null revision also prints
1294 `hg update` from null revision also prints
1295
1295
1296 $ hg up null
1296 $ hg up null
1297 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1297 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1298
1298
1299 #if linuxormacos no-fsmonitor
1299 #if linuxormacos no-fsmonitor
1300 $ hg up cf0fe1914066
1300 $ hg up cf0fe1914066
1301 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
1301 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
1302 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1302 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1303 #else
1303 #else
1304 $ hg up cf0fe1914066
1304 $ hg up cf0fe1914066
1305 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1305 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1306 #endif
1306 #endif
1307
1307
1308 $ cd ..
1308 $ cd ..
1309
1309
@@ -1,222 +1,222 b''
1 #require serve
1 #require serve
2
2
3 creating 'remote
3 creating 'remote
4
4
5 $ hg init remote
5 $ hg init remote
6 $ cd remote
6 $ cd remote
7 $ hg unbundle "$TESTDIR/bundles/remote.hg"
7 $ hg unbundle "$TESTDIR/bundles/remote.hg"
8 adding changesets
8 adding changesets
9 adding manifests
9 adding manifests
10 adding file changes
10 adding file changes
11 added 9 changesets with 7 changes to 4 files (+1 heads)
11 added 9 changesets with 7 changes to 4 files (+1 heads)
12 new changesets bfaf4b5cbf01:916f1afdef90 (9 drafts)
12 new changesets bfaf4b5cbf01:916f1afdef90 (9 drafts)
13 (run 'hg heads' to see heads, 'hg merge' to merge)
13 (run 'hg heads' to see heads, 'hg merge' to merge)
14 $ hg up tip
14 $ hg up tip
15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16
16
17 Starting server
17 Starting server
18
18
19 $ hg serve -p $HGPORT -E ../error.log -d --pid-file=../hg1.pid
19 $ hg serve -p $HGPORT -E ../error.log -d --pid-file=../hg1.pid
20 $ cd ..
20 $ cd ..
21 $ cat hg1.pid >> $DAEMON_PIDS
21 $ cat hg1.pid >> $DAEMON_PIDS
22
22
23 clone remote via stream
23 clone remote via stream
24
24
25 $ for i in 0 1 2 3 4 5 6 7 8; do
25 $ for i in 0 1 2 3 4 5 6 7 8; do
26 > hg clone -r "$i" http://localhost:$HGPORT/ test-"$i"
26 > hg clone -r "$i" http://localhost:$HGPORT/ test-"$i"
27 > if cd test-"$i"; then
27 > if cd test-"$i"; then
28 > hg verify
28 > hg verify
29 > cd ..
29 > cd ..
30 > fi
30 > fi
31 > done
31 > done
32 adding changesets
32 adding changesets
33 adding manifests
33 adding manifests
34 adding file changes
34 adding file changes
35 added 1 changesets with 1 changes to 1 files
35 added 1 changesets with 1 changes to 1 files
36 new changesets bfaf4b5cbf01
36 new changesets bfaf4b5cbf01
37 updating to branch default
37 updating to branch default
38 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
39 checking changesets
39 checking changesets
40 checking manifests
40 checking manifests
41 crosschecking files in changesets and manifests
41 crosschecking files in changesets and manifests
42 checking files
42 checking files
43 checked 1 changesets with 1 changes to 1 files
43 checked 1 changesets with 1 changes to 1 files
44 adding changesets
44 adding changesets
45 adding manifests
45 adding manifests
46 adding file changes
46 adding file changes
47 added 2 changesets with 2 changes to 1 files
47 added 2 changesets with 2 changes to 1 files
48 new changesets bfaf4b5cbf01:21f32785131f
48 new changesets bfaf4b5cbf01:21f32785131f
49 updating to branch default
49 updating to branch default
50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 checking changesets
51 checking changesets
52 checking manifests
52 checking manifests
53 crosschecking files in changesets and manifests
53 crosschecking files in changesets and manifests
54 checking files
54 checking files
55 checked 2 changesets with 2 changes to 1 files
55 checked 2 changesets with 2 changes to 1 files
56 adding changesets
56 adding changesets
57 adding manifests
57 adding manifests
58 adding file changes
58 adding file changes
59 added 3 changesets with 3 changes to 1 files
59 added 3 changesets with 3 changes to 1 files
60 new changesets bfaf4b5cbf01:4ce51a113780
60 new changesets bfaf4b5cbf01:4ce51a113780
61 updating to branch default
61 updating to branch default
62 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 checking changesets
63 checking changesets
64 checking manifests
64 checking manifests
65 crosschecking files in changesets and manifests
65 crosschecking files in changesets and manifests
66 checking files
66 checking files
67 checked 3 changesets with 3 changes to 1 files
67 checked 3 changesets with 3 changes to 1 files
68 adding changesets
68 adding changesets
69 adding manifests
69 adding manifests
70 adding file changes
70 adding file changes
71 added 4 changesets with 4 changes to 1 files
71 added 4 changesets with 4 changes to 1 files
72 new changesets bfaf4b5cbf01:93ee6ab32777
72 new changesets bfaf4b5cbf01:93ee6ab32777
73 updating to branch default
73 updating to branch default
74 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
74 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 checking changesets
75 checking changesets
76 checking manifests
76 checking manifests
77 crosschecking files in changesets and manifests
77 crosschecking files in changesets and manifests
78 checking files
78 checking files
79 checked 4 changesets with 4 changes to 1 files
79 checked 4 changesets with 4 changes to 1 files
80 adding changesets
80 adding changesets
81 adding manifests
81 adding manifests
82 adding file changes
82 adding file changes
83 added 2 changesets with 2 changes to 1 files
83 added 2 changesets with 2 changes to 1 files
84 new changesets bfaf4b5cbf01:c70afb1ee985
84 new changesets bfaf4b5cbf01:c70afb1ee985
85 updating to branch default
85 updating to branch default
86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
87 checking changesets
87 checking changesets
88 checking manifests
88 checking manifests
89 crosschecking files in changesets and manifests
89 crosschecking files in changesets and manifests
90 checking files
90 checking files
91 checked 2 changesets with 2 changes to 1 files
91 checked 2 changesets with 2 changes to 1 files
92 adding changesets
92 adding changesets
93 adding manifests
93 adding manifests
94 adding file changes
94 adding file changes
95 added 3 changesets with 3 changes to 1 files
95 added 3 changesets with 3 changes to 1 files
96 new changesets bfaf4b5cbf01:f03ae5a9b979
96 new changesets bfaf4b5cbf01:f03ae5a9b979
97 updating to branch default
97 updating to branch default
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 checking changesets
99 checking changesets
100 checking manifests
100 checking manifests
101 crosschecking files in changesets and manifests
101 crosschecking files in changesets and manifests
102 checking files
102 checking files
103 checked 3 changesets with 3 changes to 1 files
103 checked 3 changesets with 3 changes to 1 files
104 adding changesets
104 adding changesets
105 adding manifests
105 adding manifests
106 adding file changes
106 adding file changes
107 added 4 changesets with 5 changes to 2 files
107 added 4 changesets with 5 changes to 2 files
108 new changesets bfaf4b5cbf01:095cb14b1b4d
108 new changesets bfaf4b5cbf01:095cb14b1b4d
109 updating to branch default
109 updating to branch default
110 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 checking changesets
111 checking changesets
112 checking manifests
112 checking manifests
113 crosschecking files in changesets and manifests
113 crosschecking files in changesets and manifests
114 checking files
114 checking files
115 checked 4 changesets with 5 changes to 2 files
115 checked 4 changesets with 5 changes to 2 files
116 adding changesets
116 adding changesets
117 adding manifests
117 adding manifests
118 adding file changes
118 adding file changes
119 added 5 changesets with 6 changes to 3 files
119 added 5 changesets with 6 changes to 3 files
120 new changesets bfaf4b5cbf01:faa2e4234c7a
120 new changesets bfaf4b5cbf01:faa2e4234c7a
121 updating to branch default
121 updating to branch default
122 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 checking changesets
123 checking changesets
124 checking manifests
124 checking manifests
125 crosschecking files in changesets and manifests
125 crosschecking files in changesets and manifests
126 checking files
126 checking files
127 checked 5 changesets with 6 changes to 3 files
127 checked 5 changesets with 6 changes to 3 files
128 adding changesets
128 adding changesets
129 adding manifests
129 adding manifests
130 adding file changes
130 adding file changes
131 added 5 changesets with 5 changes to 2 files
131 added 5 changesets with 5 changes to 2 files
132 new changesets bfaf4b5cbf01:916f1afdef90
132 new changesets bfaf4b5cbf01:916f1afdef90
133 updating to branch default
133 updating to branch default
134 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
134 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
135 checking changesets
135 checking changesets
136 checking manifests
136 checking manifests
137 crosschecking files in changesets and manifests
137 crosschecking files in changesets and manifests
138 checking files
138 checking files
139 checked 5 changesets with 5 changes to 2 files
139 checked 5 changesets with 5 changes to 2 files
140 $ cd test-8
140 $ cd test-8
141 $ hg pull ../test-7
141 $ hg pull ../test-7
142 pulling from ../test-7
142 pulling from ../test-7
143 searching for changes
143 searching for changes
144 adding changesets
144 adding changesets
145 adding manifests
145 adding manifests
146 adding file changes
146 adding file changes
147 added 4 changesets with 2 changes to 3 files (+1 heads)
147 added 4 changesets with 2 changes to 3 files (+1 heads)
148 new changesets c70afb1ee985:faa2e4234c7a
148 new changesets c70afb1ee985:faa2e4234c7a
149 (run 'hg heads' to see heads, 'hg merge' to merge)
149 (run 'hg heads' to see heads, 'hg merge' to merge)
150 $ hg verify
150 $ hg verify
151 checking changesets
151 checking changesets
152 checking manifests
152 checking manifests
153 crosschecking files in changesets and manifests
153 crosschecking files in changesets and manifests
154 checking files
154 checking files
155 checked 9 changesets with 7 changes to 4 files
155 checked 9 changesets with 7 changes to 4 files
156 $ cd ..
156 $ cd ..
157 $ cd test-1
157 $ cd test-1
158 $ hg pull -r 4 http://localhost:$HGPORT/
158 $ hg pull -r 4 http://localhost:$HGPORT/
159 pulling from http://localhost:$HGPORT/
159 pulling from http://localhost:$HGPORT/
160 searching for changes
160 searching for changes
161 adding changesets
161 adding changesets
162 adding manifests
162 adding manifests
163 adding file changes
163 adding file changes
164 added 1 changesets with 0 changes to 0 files (+1 heads)
164 added 1 changesets with 0 changes to 0 files (+1 heads)
165 new changesets c70afb1ee985
165 new changesets c70afb1ee985
166 (run 'hg heads' to see heads, 'hg merge' to merge)
166 (run 'hg heads' to see heads, 'hg merge' to merge)
167 $ hg verify
167 $ hg verify
168 checking changesets
168 checking changesets
169 checking manifests
169 checking manifests
170 crosschecking files in changesets and manifests
170 crosschecking files in changesets and manifests
171 checking files
171 checking files
172 checked 3 changesets with 2 changes to 1 files
172 checked 3 changesets with 2 changes to 1 files
173 $ hg pull http://localhost:$HGPORT/
173 $ hg pull http://localhost:$HGPORT/
174 pulling from http://localhost:$HGPORT/
174 pulling from http://localhost:$HGPORT/
175 searching for changes
175 searching for changes
176 adding changesets
176 adding changesets
177 adding manifests
177 adding manifests
178 adding file changes
178 adding file changes
179 added 6 changesets with 5 changes to 4 files
179 added 6 changesets with 5 changes to 4 files
180 new changesets 4ce51a113780:916f1afdef90
180 new changesets 4ce51a113780:916f1afdef90
181 (run 'hg update' to get a working copy)
181 (run 'hg update' to get a working copy)
182 $ cd ..
182 $ cd ..
183 $ cd test-2
183 $ cd test-2
184 $ hg pull -r 5 http://localhost:$HGPORT/
184 $ hg pull -r 5 http://localhost:$HGPORT/
185 pulling from http://localhost:$HGPORT/
185 pulling from http://localhost:$HGPORT/
186 searching for changes
186 searching for changes
187 adding changesets
187 adding changesets
188 adding manifests
188 adding manifests
189 adding file changes
189 adding file changes
190 added 2 changesets with 0 changes to 0 files (+1 heads)
190 added 2 changesets with 0 changes to 0 files (+1 heads)
191 new changesets c70afb1ee985:f03ae5a9b979
191 new changesets c70afb1ee985:f03ae5a9b979
192 (run 'hg heads' to see heads, 'hg merge' to merge)
192 (run 'hg heads' to see heads, 'hg merge' to merge)
193 $ hg verify
193 $ hg verify
194 checking changesets
194 checking changesets
195 checking manifests
195 checking manifests
196 crosschecking files in changesets and manifests
196 crosschecking files in changesets and manifests
197 checking files
197 checking files
198 checked 5 changesets with 3 changes to 1 files
198 checked 5 changesets with 3 changes to 1 files
199 $ hg pull http://localhost:$HGPORT/
199 $ hg pull http://localhost:$HGPORT/
200 pulling from http://localhost:$HGPORT/
200 pulling from http://localhost:$HGPORT/
201 searching for changes
201 searching for changes
202 adding changesets
202 adding changesets
203 adding manifests
203 adding manifests
204 adding file changes
204 adding file changes
205 added 4 changesets with 4 changes to 4 files
205 added 4 changesets with 4 changes to 4 files
206 new changesets 93ee6ab32777:916f1afdef90
206 new changesets 93ee6ab32777:916f1afdef90
207 (run 'hg update' to get a working copy)
207 (run 'hg update' to get a working copy)
208 $ hg verify
208 $ hg verify
209 checking changesets
209 checking changesets
210 checking manifests
210 checking manifests
211 crosschecking files in changesets and manifests
211 crosschecking files in changesets and manifests
212 checking files
212 checking files
213 checked 9 changesets with 7 changes to 4 files
213 checked 9 changesets with 7 changes to 4 files
214 $ cd ..
214 $ cd ..
215
215
216 no default destination if url has no path:
216 no default destination if url has no path:
217
217
218 $ hg clone http://localhost:$HGPORT/
218 $ hg clone http://localhost:$HGPORT/
219 abort: empty destination path is not valid
219 abort: empty destination path is not valid
220 [255]
220 [10]
221
221
222 $ cat error.log
222 $ cat error.log
@@ -1,608 +1,608 b''
1 This test is a duplicate of 'test-http.t' feel free to factor out
1 This test is a duplicate of 'test-http.t' feel free to factor out
2 parts that are not bundle1/bundle2 specific.
2 parts that are not bundle1/bundle2 specific.
3
3
4 #testcases sshv1 sshv2
4 #testcases sshv1 sshv2
5
5
6 #if sshv2
6 #if sshv2
7 $ cat >> $HGRCPATH << EOF
7 $ cat >> $HGRCPATH << EOF
8 > [experimental]
8 > [experimental]
9 > sshpeer.advertise-v2 = true
9 > sshpeer.advertise-v2 = true
10 > sshserver.support-v2 = true
10 > sshserver.support-v2 = true
11 > EOF
11 > EOF
12 #endif
12 #endif
13
13
14 $ cat << EOF >> $HGRCPATH
14 $ cat << EOF >> $HGRCPATH
15 > [devel]
15 > [devel]
16 > # This test is dedicated to interaction through old bundle
16 > # This test is dedicated to interaction through old bundle
17 > legacy.exchange = bundle1
17 > legacy.exchange = bundle1
18 > EOF
18 > EOF
19
19
20
20
21 This test tries to exercise the ssh functionality with a dummy script
21 This test tries to exercise the ssh functionality with a dummy script
22
22
23 creating 'remote' repo
23 creating 'remote' repo
24
24
25 $ hg init remote
25 $ hg init remote
26 $ cd remote
26 $ cd remote
27 $ echo this > foo
27 $ echo this > foo
28 $ echo this > fooO
28 $ echo this > fooO
29 $ hg ci -A -m "init" foo fooO
29 $ hg ci -A -m "init" foo fooO
30
30
31 insert a closed branch (issue4428)
31 insert a closed branch (issue4428)
32
32
33 $ hg up null
33 $ hg up null
34 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
34 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
35 $ hg branch closed
35 $ hg branch closed
36 marked working directory as branch closed
36 marked working directory as branch closed
37 (branches are permanent and global, did you want a bookmark?)
37 (branches are permanent and global, did you want a bookmark?)
38 $ hg ci -mc0
38 $ hg ci -mc0
39 $ hg ci --close-branch -mc1
39 $ hg ci --close-branch -mc1
40 $ hg up -q default
40 $ hg up -q default
41
41
42 configure for serving
42 configure for serving
43
43
44 $ cat <<EOF > .hg/hgrc
44 $ cat <<EOF > .hg/hgrc
45 > [server]
45 > [server]
46 > uncompressed = True
46 > uncompressed = True
47 >
47 >
48 > [hooks]
48 > [hooks]
49 > changegroup = sh -c "printenv.py --line changegroup-in-remote 0 ../dummylog"
49 > changegroup = sh -c "printenv.py --line changegroup-in-remote 0 ../dummylog"
50 > EOF
50 > EOF
51 $ cd $TESTTMP
51 $ cd $TESTTMP
52
52
53 repo not found error
53 repo not found error
54
54
55 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
55 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
56 remote: abort: repository nonexistent not found!
56 remote: abort: repository nonexistent not found!
57 abort: no suitable response from remote hg!
57 abort: no suitable response from remote hg!
58 [255]
58 [255]
59
59
60 non-existent absolute path
60 non-existent absolute path
61
61
62 #if no-msys
62 #if no-msys
63 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy//`pwd`/nonexistent local
63 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy//`pwd`/nonexistent local
64 remote: abort: repository /$TESTTMP/nonexistent not found!
64 remote: abort: repository /$TESTTMP/nonexistent not found!
65 abort: no suitable response from remote hg!
65 abort: no suitable response from remote hg!
66 [255]
66 [255]
67 #endif
67 #endif
68
68
69 clone remote via stream
69 clone remote via stream
70
70
71 #if no-reposimplestore
71 #if no-reposimplestore
72
72
73 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream
73 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream
74 streaming all changes
74 streaming all changes
75 4 files to transfer, 602 bytes of data
75 4 files to transfer, 602 bytes of data
76 transferred 602 bytes in * seconds (*) (glob)
76 transferred 602 bytes in * seconds (*) (glob)
77 searching for changes
77 searching for changes
78 no changes found
78 no changes found
79 updating to branch default
79 updating to branch default
80 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
81 $ cd local-stream
81 $ cd local-stream
82 $ hg verify
82 $ hg verify
83 checking changesets
83 checking changesets
84 checking manifests
84 checking manifests
85 crosschecking files in changesets and manifests
85 crosschecking files in changesets and manifests
86 checking files
86 checking files
87 checked 3 changesets with 2 changes to 2 files
87 checked 3 changesets with 2 changes to 2 files
88 $ hg branches
88 $ hg branches
89 default 0:1160648e36ce
89 default 0:1160648e36ce
90 $ cd $TESTTMP
90 $ cd $TESTTMP
91
91
92 clone bookmarks via stream
92 clone bookmarks via stream
93
93
94 $ hg -R local-stream book mybook
94 $ hg -R local-stream book mybook
95 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
95 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
96 streaming all changes
96 streaming all changes
97 4 files to transfer, 602 bytes of data
97 4 files to transfer, 602 bytes of data
98 transferred 602 bytes in * seconds (*) (glob)
98 transferred 602 bytes in * seconds (*) (glob)
99 searching for changes
99 searching for changes
100 no changes found
100 no changes found
101 updating to branch default
101 updating to branch default
102 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
102 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
103 $ cd stream2
103 $ cd stream2
104 $ hg book
104 $ hg book
105 mybook 0:1160648e36ce
105 mybook 0:1160648e36ce
106 $ cd $TESTTMP
106 $ cd $TESTTMP
107 $ rm -rf local-stream stream2
107 $ rm -rf local-stream stream2
108
108
109 #endif
109 #endif
110
110
111 clone remote via pull
111 clone remote via pull
112
112
113 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
113 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
114 requesting all changes
114 requesting all changes
115 adding changesets
115 adding changesets
116 adding manifests
116 adding manifests
117 adding file changes
117 adding file changes
118 added 3 changesets with 2 changes to 2 files
118 added 3 changesets with 2 changes to 2 files
119 new changesets 1160648e36ce:ad076bfb429d
119 new changesets 1160648e36ce:ad076bfb429d
120 updating to branch default
120 updating to branch default
121 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
121 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
122
122
123 verify
123 verify
124
124
125 $ cd local
125 $ cd local
126 $ hg verify
126 $ hg verify
127 checking changesets
127 checking changesets
128 checking manifests
128 checking manifests
129 crosschecking files in changesets and manifests
129 crosschecking files in changesets and manifests
130 checking files
130 checking files
131 checked 3 changesets with 2 changes to 2 files
131 checked 3 changesets with 2 changes to 2 files
132 $ cat >> .hg/hgrc <<EOF
132 $ cat >> .hg/hgrc <<EOF
133 > [hooks]
133 > [hooks]
134 > changegroup = sh -c "printenv.py --line changegroup-in-local 0 ../dummylog"
134 > changegroup = sh -c "printenv.py --line changegroup-in-local 0 ../dummylog"
135 > EOF
135 > EOF
136
136
137 empty default pull
137 empty default pull
138
138
139 $ hg paths
139 $ hg paths
140 default = ssh://user@dummy/remote
140 default = ssh://user@dummy/remote
141 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
141 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
142 pulling from ssh://user@dummy/remote
142 pulling from ssh://user@dummy/remote
143 searching for changes
143 searching for changes
144 no changes found
144 no changes found
145
145
146 pull from wrong ssh URL
146 pull from wrong ssh URL
147
147
148 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist
148 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist
149 pulling from ssh://user@dummy/doesnotexist
149 pulling from ssh://user@dummy/doesnotexist
150 remote: abort: repository doesnotexist not found!
150 remote: abort: repository doesnotexist not found!
151 abort: no suitable response from remote hg!
151 abort: no suitable response from remote hg!
152 [255]
152 [255]
153
153
154 local change
154 local change
155
155
156 $ echo bleah > foo
156 $ echo bleah > foo
157 $ hg ci -m "add"
157 $ hg ci -m "add"
158
158
159 updating rc
159 updating rc
160
160
161 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
161 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
162 $ echo "[ui]" >> .hg/hgrc
162 $ echo "[ui]" >> .hg/hgrc
163 $ echo "ssh = \"$PYTHON\" \"$TESTDIR/dummyssh\"" >> .hg/hgrc
163 $ echo "ssh = \"$PYTHON\" \"$TESTDIR/dummyssh\"" >> .hg/hgrc
164
164
165 find outgoing
165 find outgoing
166
166
167 $ hg out ssh://user@dummy/remote
167 $ hg out ssh://user@dummy/remote
168 comparing with ssh://user@dummy/remote
168 comparing with ssh://user@dummy/remote
169 searching for changes
169 searching for changes
170 changeset: 3:a28a9d1a809c
170 changeset: 3:a28a9d1a809c
171 tag: tip
171 tag: tip
172 parent: 0:1160648e36ce
172 parent: 0:1160648e36ce
173 user: test
173 user: test
174 date: Thu Jan 01 00:00:00 1970 +0000
174 date: Thu Jan 01 00:00:00 1970 +0000
175 summary: add
175 summary: add
176
176
177
177
178 find incoming on the remote side
178 find incoming on the remote side
179
179
180 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/local
180 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/local
181 comparing with ssh://user@dummy/local
181 comparing with ssh://user@dummy/local
182 searching for changes
182 searching for changes
183 changeset: 3:a28a9d1a809c
183 changeset: 3:a28a9d1a809c
184 tag: tip
184 tag: tip
185 parent: 0:1160648e36ce
185 parent: 0:1160648e36ce
186 user: test
186 user: test
187 date: Thu Jan 01 00:00:00 1970 +0000
187 date: Thu Jan 01 00:00:00 1970 +0000
188 summary: add
188 summary: add
189
189
190
190
191 find incoming on the remote side (using absolute path)
191 find incoming on the remote side (using absolute path)
192
192
193 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/`pwd`"
193 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/`pwd`"
194 comparing with ssh://user@dummy/$TESTTMP/local
194 comparing with ssh://user@dummy/$TESTTMP/local
195 searching for changes
195 searching for changes
196 changeset: 3:a28a9d1a809c
196 changeset: 3:a28a9d1a809c
197 tag: tip
197 tag: tip
198 parent: 0:1160648e36ce
198 parent: 0:1160648e36ce
199 user: test
199 user: test
200 date: Thu Jan 01 00:00:00 1970 +0000
200 date: Thu Jan 01 00:00:00 1970 +0000
201 summary: add
201 summary: add
202
202
203
203
204 push
204 push
205
205
206 $ hg push
206 $ hg push
207 pushing to ssh://user@dummy/remote
207 pushing to ssh://user@dummy/remote
208 searching for changes
208 searching for changes
209 remote: adding changesets
209 remote: adding changesets
210 remote: adding manifests
210 remote: adding manifests
211 remote: adding file changes
211 remote: adding file changes
212 remote: added 1 changesets with 1 changes to 1 files
212 remote: added 1 changesets with 1 changes to 1 files
213 $ cd $TESTTMP/remote
213 $ cd $TESTTMP/remote
214
214
215 check remote tip
215 check remote tip
216
216
217 $ hg tip
217 $ hg tip
218 changeset: 3:a28a9d1a809c
218 changeset: 3:a28a9d1a809c
219 tag: tip
219 tag: tip
220 parent: 0:1160648e36ce
220 parent: 0:1160648e36ce
221 user: test
221 user: test
222 date: Thu Jan 01 00:00:00 1970 +0000
222 date: Thu Jan 01 00:00:00 1970 +0000
223 summary: add
223 summary: add
224
224
225 $ hg verify
225 $ hg verify
226 checking changesets
226 checking changesets
227 checking manifests
227 checking manifests
228 crosschecking files in changesets and manifests
228 crosschecking files in changesets and manifests
229 checking files
229 checking files
230 checked 4 changesets with 3 changes to 2 files
230 checked 4 changesets with 3 changes to 2 files
231 $ hg cat -r tip foo
231 $ hg cat -r tip foo
232 bleah
232 bleah
233 $ echo z > z
233 $ echo z > z
234 $ hg ci -A -m z z
234 $ hg ci -A -m z z
235 created new head
235 created new head
236
236
237 test pushkeys and bookmarks
237 test pushkeys and bookmarks
238
238
239 $ cd $TESTTMP/local
239 $ cd $TESTTMP/local
240 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
240 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
241 bookmarks
241 bookmarks
242 namespaces
242 namespaces
243 phases
243 phases
244 $ hg book foo -r 0
244 $ hg book foo -r 0
245 $ hg out -B
245 $ hg out -B
246 comparing with ssh://user@dummy/remote
246 comparing with ssh://user@dummy/remote
247 searching for changed bookmarks
247 searching for changed bookmarks
248 foo 1160648e36ce
248 foo 1160648e36ce
249 $ hg push -B foo
249 $ hg push -B foo
250 pushing to ssh://user@dummy/remote
250 pushing to ssh://user@dummy/remote
251 searching for changes
251 searching for changes
252 no changes found
252 no changes found
253 exporting bookmark foo
253 exporting bookmark foo
254 [1]
254 [1]
255 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote bookmarks
255 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote bookmarks
256 foo 1160648e36cec0054048a7edc4110c6f84fde594
256 foo 1160648e36cec0054048a7edc4110c6f84fde594
257 $ hg book -f foo
257 $ hg book -f foo
258 $ hg push --traceback
258 $ hg push --traceback
259 pushing to ssh://user@dummy/remote
259 pushing to ssh://user@dummy/remote
260 searching for changes
260 searching for changes
261 no changes found
261 no changes found
262 updating bookmark foo
262 updating bookmark foo
263 [1]
263 [1]
264 $ hg book -d foo
264 $ hg book -d foo
265 $ hg in -B
265 $ hg in -B
266 comparing with ssh://user@dummy/remote
266 comparing with ssh://user@dummy/remote
267 searching for changed bookmarks
267 searching for changed bookmarks
268 foo a28a9d1a809c
268 foo a28a9d1a809c
269 $ hg book -f -r 0 foo
269 $ hg book -f -r 0 foo
270 $ hg pull -B foo
270 $ hg pull -B foo
271 pulling from ssh://user@dummy/remote
271 pulling from ssh://user@dummy/remote
272 no changes found
272 no changes found
273 updating bookmark foo
273 updating bookmark foo
274 $ hg book -d foo
274 $ hg book -d foo
275 $ hg push -B foo
275 $ hg push -B foo
276 pushing to ssh://user@dummy/remote
276 pushing to ssh://user@dummy/remote
277 searching for changes
277 searching for changes
278 no changes found
278 no changes found
279 deleting remote bookmark foo
279 deleting remote bookmark foo
280 [1]
280 [1]
281
281
282 a bad, evil hook that prints to stdout
282 a bad, evil hook that prints to stdout
283
283
284 $ cat <<EOF > $TESTTMP/badhook
284 $ cat <<EOF > $TESTTMP/badhook
285 > import sys
285 > import sys
286 > sys.stdout.write("KABOOM\n")
286 > sys.stdout.write("KABOOM\n")
287 > EOF
287 > EOF
288
288
289 $ echo '[hooks]' >> ../remote/.hg/hgrc
289 $ echo '[hooks]' >> ../remote/.hg/hgrc
290 $ echo "changegroup.stdout = \"$PYTHON\" $TESTTMP/badhook" >> ../remote/.hg/hgrc
290 $ echo "changegroup.stdout = \"$PYTHON\" $TESTTMP/badhook" >> ../remote/.hg/hgrc
291 $ echo r > r
291 $ echo r > r
292 $ hg ci -A -m z r
292 $ hg ci -A -m z r
293
293
294 push should succeed even though it has an unexpected response
294 push should succeed even though it has an unexpected response
295
295
296 $ hg push
296 $ hg push
297 pushing to ssh://user@dummy/remote
297 pushing to ssh://user@dummy/remote
298 searching for changes
298 searching for changes
299 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
299 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
300 remote: adding changesets
300 remote: adding changesets
301 remote: adding manifests
301 remote: adding manifests
302 remote: adding file changes
302 remote: adding file changes
303 remote: added 1 changesets with 1 changes to 1 files
303 remote: added 1 changesets with 1 changes to 1 files
304 remote: KABOOM
304 remote: KABOOM
305 $ hg -R ../remote heads
305 $ hg -R ../remote heads
306 changeset: 5:1383141674ec
306 changeset: 5:1383141674ec
307 tag: tip
307 tag: tip
308 parent: 3:a28a9d1a809c
308 parent: 3:a28a9d1a809c
309 user: test
309 user: test
310 date: Thu Jan 01 00:00:00 1970 +0000
310 date: Thu Jan 01 00:00:00 1970 +0000
311 summary: z
311 summary: z
312
312
313 changeset: 4:6c0482d977a3
313 changeset: 4:6c0482d977a3
314 parent: 0:1160648e36ce
314 parent: 0:1160648e36ce
315 user: test
315 user: test
316 date: Thu Jan 01 00:00:00 1970 +0000
316 date: Thu Jan 01 00:00:00 1970 +0000
317 summary: z
317 summary: z
318
318
319
319
320 clone bookmarks
320 clone bookmarks
321
321
322 $ hg -R ../remote bookmark test
322 $ hg -R ../remote bookmark test
323 $ hg -R ../remote bookmarks
323 $ hg -R ../remote bookmarks
324 * test 4:6c0482d977a3
324 * test 4:6c0482d977a3
325 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local-bookmarks
325 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local-bookmarks
326 requesting all changes
326 requesting all changes
327 adding changesets
327 adding changesets
328 adding manifests
328 adding manifests
329 adding file changes
329 adding file changes
330 added 6 changesets with 5 changes to 4 files (+1 heads)
330 added 6 changesets with 5 changes to 4 files (+1 heads)
331 new changesets 1160648e36ce:1383141674ec
331 new changesets 1160648e36ce:1383141674ec
332 updating to branch default
332 updating to branch default
333 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
333 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
334 $ hg -R local-bookmarks bookmarks
334 $ hg -R local-bookmarks bookmarks
335 test 4:6c0482d977a3
335 test 4:6c0482d977a3
336
336
337 passwords in ssh urls are not supported
337 passwords in ssh urls are not supported
338 (we use a glob here because different Python versions give different
338 (we use a glob here because different Python versions give different
339 results here)
339 results here)
340
340
341 $ hg push ssh://user:erroneouspwd@dummy/remote
341 $ hg push ssh://user:erroneouspwd@dummy/remote
342 pushing to ssh://user:*@dummy/remote (glob)
342 pushing to ssh://user:*@dummy/remote (glob)
343 abort: password in URL not supported!
343 abort: password in URL not supported!
344 [255]
344 [255]
345
345
346 $ cd $TESTTMP
346 $ cd $TESTTMP
347
347
348 hide outer repo
348 hide outer repo
349 $ hg init
349 $ hg init
350
350
351 Test remote paths with spaces (issue2983):
351 Test remote paths with spaces (issue2983):
352
352
353 $ hg init --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
353 $ hg init --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
354 $ touch "$TESTTMP/a repo/test"
354 $ touch "$TESTTMP/a repo/test"
355 $ hg -R 'a repo' commit -A -m "test"
355 $ hg -R 'a repo' commit -A -m "test"
356 adding test
356 adding test
357 $ hg -R 'a repo' tag tag
357 $ hg -R 'a repo' tag tag
358 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
358 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
359 73649e48688a
359 73649e48688a
360
360
361 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo#noNoNO"
361 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo#noNoNO"
362 abort: unknown revision 'noNoNO'!
362 abort: unknown revision 'noNoNO'!
363 [255]
363 [255]
364
364
365 Test (non-)escaping of remote paths with spaces when cloning (issue3145):
365 Test (non-)escaping of remote paths with spaces when cloning (issue3145):
366
366
367 $ hg clone --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
367 $ hg clone --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
368 destination directory: a repo
368 destination directory: a repo
369 abort: destination 'a repo' is not empty
369 abort: destination 'a repo' is not empty
370 [255]
370 [10]
371
371
372 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
372 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
373 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
373 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
374 parameters:
374 parameters:
375
375
376 $ cat > ssh.sh << EOF
376 $ cat > ssh.sh << EOF
377 > userhost="\$1"
377 > userhost="\$1"
378 > SSH_ORIGINAL_COMMAND="\$2"
378 > SSH_ORIGINAL_COMMAND="\$2"
379 > export SSH_ORIGINAL_COMMAND
379 > export SSH_ORIGINAL_COMMAND
380 > PYTHONPATH="$PYTHONPATH"
380 > PYTHONPATH="$PYTHONPATH"
381 > export PYTHONPATH
381 > export PYTHONPATH
382 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
382 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
383 > EOF
383 > EOF
384
384
385 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
385 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
386 73649e48688a
386 73649e48688a
387
387
388 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
388 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
389 remote: Illegal repository "$TESTTMP/a'repo"
389 remote: Illegal repository "$TESTTMP/a'repo"
390 abort: no suitable response from remote hg!
390 abort: no suitable response from remote hg!
391 [255]
391 [255]
392
392
393 $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
393 $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
394 remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
394 remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
395 abort: no suitable response from remote hg!
395 abort: no suitable response from remote hg!
396 [255]
396 [255]
397
397
398 $ SSH_ORIGINAL_COMMAND="'hg' serve -R 'a'repo' --stdio" "$PYTHON" "$TESTDIR/../contrib/hg-ssh"
398 $ SSH_ORIGINAL_COMMAND="'hg' serve -R 'a'repo' --stdio" "$PYTHON" "$TESTDIR/../contrib/hg-ssh"
399 Illegal command "'hg' serve -R 'a'repo' --stdio": No closing quotation
399 Illegal command "'hg' serve -R 'a'repo' --stdio": No closing quotation
400 [255]
400 [255]
401
401
402 Test hg-ssh in read-only mode:
402 Test hg-ssh in read-only mode:
403
403
404 $ cat > ssh.sh << EOF
404 $ cat > ssh.sh << EOF
405 > userhost="\$1"
405 > userhost="\$1"
406 > SSH_ORIGINAL_COMMAND="\$2"
406 > SSH_ORIGINAL_COMMAND="\$2"
407 > export SSH_ORIGINAL_COMMAND
407 > export SSH_ORIGINAL_COMMAND
408 > PYTHONPATH="$PYTHONPATH"
408 > PYTHONPATH="$PYTHONPATH"
409 > export PYTHONPATH
409 > export PYTHONPATH
410 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
410 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
411 > EOF
411 > EOF
412
412
413 $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
413 $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
414 requesting all changes
414 requesting all changes
415 adding changesets
415 adding changesets
416 adding manifests
416 adding manifests
417 adding file changes
417 adding file changes
418 added 6 changesets with 5 changes to 4 files (+1 heads)
418 added 6 changesets with 5 changes to 4 files (+1 heads)
419 new changesets 1160648e36ce:1383141674ec
419 new changesets 1160648e36ce:1383141674ec
420 updating to branch default
420 updating to branch default
421 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
421 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
422
422
423 $ cd read-only-local
423 $ cd read-only-local
424 $ echo "baz" > bar
424 $ echo "baz" > bar
425 $ hg ci -A -m "unpushable commit" bar
425 $ hg ci -A -m "unpushable commit" bar
426 $ hg push --ssh "sh ../ssh.sh"
426 $ hg push --ssh "sh ../ssh.sh"
427 pushing to ssh://user@dummy/*/remote (glob)
427 pushing to ssh://user@dummy/*/remote (glob)
428 searching for changes
428 searching for changes
429 remote: Permission denied
429 remote: Permission denied
430 remote: abort: pretxnopen.hg-ssh hook failed
430 remote: abort: pretxnopen.hg-ssh hook failed
431 remote: Permission denied
431 remote: Permission denied
432 remote: pushkey-abort: prepushkey.hg-ssh hook failed
432 remote: pushkey-abort: prepushkey.hg-ssh hook failed
433 updating 6c0482d977a3 to public failed!
433 updating 6c0482d977a3 to public failed!
434 [1]
434 [1]
435
435
436 $ cd $TESTTMP
436 $ cd $TESTTMP
437
437
438 stderr from remote commands should be printed before stdout from local code (issue4336)
438 stderr from remote commands should be printed before stdout from local code (issue4336)
439
439
440 $ hg clone remote stderr-ordering
440 $ hg clone remote stderr-ordering
441 updating to branch default
441 updating to branch default
442 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
442 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
443 $ cd stderr-ordering
443 $ cd stderr-ordering
444 $ cat >> localwrite.py << EOF
444 $ cat >> localwrite.py << EOF
445 > from mercurial import exchange, extensions
445 > from mercurial import exchange, extensions
446 >
446 >
447 > def wrappedpush(orig, repo, *args, **kwargs):
447 > def wrappedpush(orig, repo, *args, **kwargs):
448 > res = orig(repo, *args, **kwargs)
448 > res = orig(repo, *args, **kwargs)
449 > repo.ui.write(b'local stdout\n')
449 > repo.ui.write(b'local stdout\n')
450 > return res
450 > return res
451 >
451 >
452 > def extsetup(ui):
452 > def extsetup(ui):
453 > extensions.wrapfunction(exchange, b'push', wrappedpush)
453 > extensions.wrapfunction(exchange, b'push', wrappedpush)
454 > EOF
454 > EOF
455
455
456 $ cat >> .hg/hgrc << EOF
456 $ cat >> .hg/hgrc << EOF
457 > [paths]
457 > [paths]
458 > default-push = ssh://user@dummy/remote
458 > default-push = ssh://user@dummy/remote
459 > [ui]
459 > [ui]
460 > ssh = "$PYTHON" "$TESTDIR/dummyssh"
460 > ssh = "$PYTHON" "$TESTDIR/dummyssh"
461 > [extensions]
461 > [extensions]
462 > localwrite = localwrite.py
462 > localwrite = localwrite.py
463 > EOF
463 > EOF
464
464
465 $ echo localwrite > foo
465 $ echo localwrite > foo
466 $ hg commit -m 'testing localwrite'
466 $ hg commit -m 'testing localwrite'
467 $ hg push
467 $ hg push
468 pushing to ssh://user@dummy/remote
468 pushing to ssh://user@dummy/remote
469 searching for changes
469 searching for changes
470 remote: adding changesets
470 remote: adding changesets
471 remote: adding manifests
471 remote: adding manifests
472 remote: adding file changes
472 remote: adding file changes
473 remote: added 1 changesets with 1 changes to 1 files
473 remote: added 1 changesets with 1 changes to 1 files
474 remote: KABOOM
474 remote: KABOOM
475 local stdout
475 local stdout
476
476
477 debug output
477 debug output
478
478
479 $ hg pull --debug ssh://user@dummy/remote
479 $ hg pull --debug ssh://user@dummy/remote
480 pulling from ssh://user@dummy/remote
480 pulling from ssh://user@dummy/remote
481 running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
481 running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
482 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
482 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
483 sending hello command
483 sending hello command
484 sending between command
484 sending between command
485 remote: 463 (sshv1 !)
485 remote: 463 (sshv1 !)
486 protocol upgraded to exp-ssh-v2-0003 (sshv2 !)
486 protocol upgraded to exp-ssh-v2-0003 (sshv2 !)
487 remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
487 remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
488 remote: 1 (sshv1 !)
488 remote: 1 (sshv1 !)
489 sending protocaps command
489 sending protocaps command
490 preparing listkeys for "bookmarks"
490 preparing listkeys for "bookmarks"
491 sending listkeys command
491 sending listkeys command
492 received listkey for "bookmarks": 45 bytes
492 received listkey for "bookmarks": 45 bytes
493 query 1; heads
493 query 1; heads
494 sending batch command
494 sending batch command
495 searching for changes
495 searching for changes
496 all remote heads known locally
496 all remote heads known locally
497 no changes found
497 no changes found
498 preparing listkeys for "phases"
498 preparing listkeys for "phases"
499 sending listkeys command
499 sending listkeys command
500 received listkey for "phases": 15 bytes
500 received listkey for "phases": 15 bytes
501 checking for updated bookmarks
501 checking for updated bookmarks
502
502
503 $ cd $TESTTMP
503 $ cd $TESTTMP
504
504
505 $ cat dummylog
505 $ cat dummylog
506 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
506 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
507 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio (no-msys !)
507 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio (no-msys !)
508 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
508 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
509 Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio (no-reposimplestore !)
509 Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio (no-reposimplestore !)
510 Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
510 Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
511 Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
511 Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
512 Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio
512 Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio
513 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
513 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
514 Got arguments 1:user@dummy 2:hg -R local serve --stdio
514 Got arguments 1:user@dummy 2:hg -R local serve --stdio
515 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
515 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
516 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
516 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
517 changegroup-in-remote hook: HG_HOOKNAME=changegroup
517 changegroup-in-remote hook: HG_HOOKNAME=changegroup
518 HG_HOOKTYPE=changegroup
518 HG_HOOKTYPE=changegroup
519 HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60
519 HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60
520 HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60
520 HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60
521 HG_SOURCE=serve
521 HG_SOURCE=serve
522 HG_TXNID=TXN:$ID$
522 HG_TXNID=TXN:$ID$
523 HG_TXNNAME=serve
523 HG_TXNNAME=serve
524 remote:ssh:$LOCALIP
524 remote:ssh:$LOCALIP
525 HG_URL=remote:ssh:$LOCALIP
525 HG_URL=remote:ssh:$LOCALIP
526
526
527 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
527 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
528 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
528 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
529 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
529 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
530 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
530 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
531 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
531 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
532 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
532 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
533 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
533 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
534 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
534 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
535 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
535 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
536 changegroup-in-remote hook: HG_HOOKNAME=changegroup
536 changegroup-in-remote hook: HG_HOOKNAME=changegroup
537 HG_HOOKTYPE=changegroup
537 HG_HOOKTYPE=changegroup
538 HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6
538 HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6
539 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6
539 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6
540 HG_SOURCE=serve
540 HG_SOURCE=serve
541 HG_TXNID=TXN:$ID$
541 HG_TXNID=TXN:$ID$
542 HG_TXNNAME=serve
542 HG_TXNNAME=serve
543 remote:ssh:$LOCALIP
543 remote:ssh:$LOCALIP
544 HG_URL=remote:ssh:$LOCALIP
544 HG_URL=remote:ssh:$LOCALIP
545
545
546 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
546 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
547 Got arguments 1:user@dummy 2:hg init 'a repo'
547 Got arguments 1:user@dummy 2:hg init 'a repo'
548 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
548 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
549 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
549 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
550 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
550 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
551 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
551 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
552 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
552 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
553 changegroup-in-remote hook: HG_HOOKNAME=changegroup
553 changegroup-in-remote hook: HG_HOOKNAME=changegroup
554 HG_HOOKTYPE=changegroup
554 HG_HOOKTYPE=changegroup
555 HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8
555 HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8
556 HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8
556 HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8
557 HG_SOURCE=serve
557 HG_SOURCE=serve
558 HG_TXNID=TXN:$ID$
558 HG_TXNID=TXN:$ID$
559 HG_TXNNAME=serve
559 HG_TXNNAME=serve
560 remote:ssh:$LOCALIP
560 remote:ssh:$LOCALIP
561 HG_URL=remote:ssh:$LOCALIP
561 HG_URL=remote:ssh:$LOCALIP
562
562
563 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
563 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
564
564
565 remote hook failure is attributed to remote
565 remote hook failure is attributed to remote
566
566
567 $ cat > $TESTTMP/failhook << EOF
567 $ cat > $TESTTMP/failhook << EOF
568 > def hook(ui, repo, **kwargs):
568 > def hook(ui, repo, **kwargs):
569 > ui.write(b'hook failure!\n')
569 > ui.write(b'hook failure!\n')
570 > ui.flush()
570 > ui.flush()
571 > return 1
571 > return 1
572 > EOF
572 > EOF
573
573
574 $ echo "pretxnchangegroup.fail = python:$TESTTMP/failhook:hook" >> remote/.hg/hgrc
574 $ echo "pretxnchangegroup.fail = python:$TESTTMP/failhook:hook" >> remote/.hg/hgrc
575
575
576 $ hg -q --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" clone ssh://user@dummy/remote hookout
576 $ hg -q --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" clone ssh://user@dummy/remote hookout
577 $ cd hookout
577 $ cd hookout
578 $ touch hookfailure
578 $ touch hookfailure
579 $ hg -q commit -A -m 'remote hook failure'
579 $ hg -q commit -A -m 'remote hook failure'
580 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" push
580 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" push
581 pushing to ssh://user@dummy/remote
581 pushing to ssh://user@dummy/remote
582 searching for changes
582 searching for changes
583 remote: adding changesets
583 remote: adding changesets
584 remote: adding manifests
584 remote: adding manifests
585 remote: adding file changes
585 remote: adding file changes
586 remote: hook failure!
586 remote: hook failure!
587 remote: transaction abort!
587 remote: transaction abort!
588 remote: rollback completed
588 remote: rollback completed
589 remote: abort: pretxnchangegroup.fail hook failed
589 remote: abort: pretxnchangegroup.fail hook failed
590 [1]
590 [1]
591
591
592 abort during pull is properly reported as such
592 abort during pull is properly reported as such
593
593
594 $ echo morefoo >> ../remote/foo
594 $ echo morefoo >> ../remote/foo
595 $ hg -R ../remote commit --message "more foo to be pulled"
595 $ hg -R ../remote commit --message "more foo to be pulled"
596 $ cat >> ../remote/.hg/hgrc << EOF
596 $ cat >> ../remote/.hg/hgrc << EOF
597 > [extensions]
597 > [extensions]
598 > crash = ${TESTDIR}/crashgetbundler.py
598 > crash = ${TESTDIR}/crashgetbundler.py
599 > EOF
599 > EOF
600 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" pull
600 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" pull
601 pulling from ssh://user@dummy/remote
601 pulling from ssh://user@dummy/remote
602 searching for changes
602 searching for changes
603 adding changesets
603 adding changesets
604 remote: abort: this is an exercise
604 remote: abort: this is an exercise
605 transaction abort!
605 transaction abort!
606 rollback completed
606 rollback completed
607 abort: stream ended unexpectedly (got 0 bytes, expected 4)
607 abort: stream ended unexpectedly (got 0 bytes, expected 4)
608 [255]
608 [255]
@@ -1,706 +1,706 b''
1 #testcases sshv1 sshv2
1 #testcases sshv1 sshv2
2
2
3 #if sshv2
3 #if sshv2
4 $ cat >> $HGRCPATH << EOF
4 $ cat >> $HGRCPATH << EOF
5 > [experimental]
5 > [experimental]
6 > sshpeer.advertise-v2 = true
6 > sshpeer.advertise-v2 = true
7 > sshserver.support-v2 = true
7 > sshserver.support-v2 = true
8 > EOF
8 > EOF
9 #endif
9 #endif
10
10
11 This test tries to exercise the ssh functionality with a dummy script
11 This test tries to exercise the ssh functionality with a dummy script
12
12
13 creating 'remote' repo
13 creating 'remote' repo
14
14
15 $ hg init remote
15 $ hg init remote
16 $ cd remote
16 $ cd remote
17 $ echo this > foo
17 $ echo this > foo
18 $ echo this > fooO
18 $ echo this > fooO
19 $ hg ci -A -m "init" foo fooO
19 $ hg ci -A -m "init" foo fooO
20
20
21 insert a closed branch (issue4428)
21 insert a closed branch (issue4428)
22
22
23 $ hg up null
23 $ hg up null
24 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
24 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
25 $ hg branch closed
25 $ hg branch closed
26 marked working directory as branch closed
26 marked working directory as branch closed
27 (branches are permanent and global, did you want a bookmark?)
27 (branches are permanent and global, did you want a bookmark?)
28 $ hg ci -mc0
28 $ hg ci -mc0
29 $ hg ci --close-branch -mc1
29 $ hg ci --close-branch -mc1
30 $ hg up -q default
30 $ hg up -q default
31
31
32 configure for serving
32 configure for serving
33
33
34 $ cat <<EOF > .hg/hgrc
34 $ cat <<EOF > .hg/hgrc
35 > [server]
35 > [server]
36 > uncompressed = True
36 > uncompressed = True
37 >
37 >
38 > [hooks]
38 > [hooks]
39 > changegroup = sh -c "printenv.py --line changegroup-in-remote 0 ../dummylog"
39 > changegroup = sh -c "printenv.py --line changegroup-in-remote 0 ../dummylog"
40 > EOF
40 > EOF
41 $ cd $TESTTMP
41 $ cd $TESTTMP
42
42
43 repo not found error
43 repo not found error
44
44
45 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
45 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
46 remote: abort: repository nonexistent not found!
46 remote: abort: repository nonexistent not found!
47 abort: no suitable response from remote hg!
47 abort: no suitable response from remote hg!
48 [255]
48 [255]
49 $ hg clone -q -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
49 $ hg clone -q -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
50 remote: abort: repository nonexistent not found!
50 remote: abort: repository nonexistent not found!
51 abort: no suitable response from remote hg!
51 abort: no suitable response from remote hg!
52 [255]
52 [255]
53
53
54 non-existent absolute path
54 non-existent absolute path
55
55
56 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/`pwd`/nonexistent local
56 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/`pwd`/nonexistent local
57 remote: abort: repository $TESTTMP/nonexistent not found!
57 remote: abort: repository $TESTTMP/nonexistent not found!
58 abort: no suitable response from remote hg!
58 abort: no suitable response from remote hg!
59 [255]
59 [255]
60
60
61 clone remote via stream
61 clone remote via stream
62
62
63 #if no-reposimplestore
63 #if no-reposimplestore
64
64
65 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream
65 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream
66 streaming all changes
66 streaming all changes
67 8 files to transfer, 827 bytes of data
67 8 files to transfer, 827 bytes of data
68 transferred 827 bytes in * seconds (*) (glob)
68 transferred 827 bytes in * seconds (*) (glob)
69 updating to branch default
69 updating to branch default
70 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 $ cd local-stream
71 $ cd local-stream
72 $ hg verify
72 $ hg verify
73 checking changesets
73 checking changesets
74 checking manifests
74 checking manifests
75 crosschecking files in changesets and manifests
75 crosschecking files in changesets and manifests
76 checking files
76 checking files
77 checked 3 changesets with 2 changes to 2 files
77 checked 3 changesets with 2 changes to 2 files
78 $ hg branches
78 $ hg branches
79 default 0:1160648e36ce
79 default 0:1160648e36ce
80 $ cd $TESTTMP
80 $ cd $TESTTMP
81
81
82 clone bookmarks via stream
82 clone bookmarks via stream
83
83
84 $ hg -R local-stream book mybook
84 $ hg -R local-stream book mybook
85 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
85 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
86 streaming all changes
86 streaming all changes
87 9 files to transfer, 870 bytes of data
87 9 files to transfer, 870 bytes of data
88 transferred 870 bytes in * seconds (*) (glob)
88 transferred 870 bytes in * seconds (*) (glob)
89 updating to branch default
89 updating to branch default
90 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 $ cd stream2
91 $ cd stream2
92 $ hg book
92 $ hg book
93 mybook 0:1160648e36ce
93 mybook 0:1160648e36ce
94 $ cd $TESTTMP
94 $ cd $TESTTMP
95 $ rm -rf local-stream stream2
95 $ rm -rf local-stream stream2
96
96
97 #endif
97 #endif
98
98
99 clone remote via pull
99 clone remote via pull
100
100
101 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
101 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
102 requesting all changes
102 requesting all changes
103 adding changesets
103 adding changesets
104 adding manifests
104 adding manifests
105 adding file changes
105 adding file changes
106 added 3 changesets with 2 changes to 2 files
106 added 3 changesets with 2 changes to 2 files
107 new changesets 1160648e36ce:ad076bfb429d
107 new changesets 1160648e36ce:ad076bfb429d
108 updating to branch default
108 updating to branch default
109 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
110
110
111 verify
111 verify
112
112
113 $ cd local
113 $ cd local
114 $ hg verify
114 $ hg verify
115 checking changesets
115 checking changesets
116 checking manifests
116 checking manifests
117 crosschecking files in changesets and manifests
117 crosschecking files in changesets and manifests
118 checking files
118 checking files
119 checked 3 changesets with 2 changes to 2 files
119 checked 3 changesets with 2 changes to 2 files
120 $ cat >> .hg/hgrc <<EOF
120 $ cat >> .hg/hgrc <<EOF
121 > [hooks]
121 > [hooks]
122 > changegroup = sh -c "printenv.py changegroup-in-local 0 ../dummylog"
122 > changegroup = sh -c "printenv.py changegroup-in-local 0 ../dummylog"
123 > EOF
123 > EOF
124
124
125 empty default pull
125 empty default pull
126
126
127 $ hg paths
127 $ hg paths
128 default = ssh://user@dummy/remote
128 default = ssh://user@dummy/remote
129 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
129 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
130 pulling from ssh://user@dummy/remote
130 pulling from ssh://user@dummy/remote
131 searching for changes
131 searching for changes
132 no changes found
132 no changes found
133
133
134 pull from wrong ssh URL
134 pull from wrong ssh URL
135
135
136 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist
136 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist
137 pulling from ssh://user@dummy/doesnotexist
137 pulling from ssh://user@dummy/doesnotexist
138 remote: abort: repository doesnotexist not found!
138 remote: abort: repository doesnotexist not found!
139 abort: no suitable response from remote hg!
139 abort: no suitable response from remote hg!
140 [255]
140 [255]
141
141
142 local change
142 local change
143
143
144 $ echo bleah > foo
144 $ echo bleah > foo
145 $ hg ci -m "add"
145 $ hg ci -m "add"
146
146
147 updating rc
147 updating rc
148
148
149 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
149 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
150 $ echo "[ui]" >> .hg/hgrc
150 $ echo "[ui]" >> .hg/hgrc
151 $ echo "ssh = \"$PYTHON\" \"$TESTDIR/dummyssh\"" >> .hg/hgrc
151 $ echo "ssh = \"$PYTHON\" \"$TESTDIR/dummyssh\"" >> .hg/hgrc
152
152
153 find outgoing
153 find outgoing
154
154
155 $ hg out ssh://user@dummy/remote
155 $ hg out ssh://user@dummy/remote
156 comparing with ssh://user@dummy/remote
156 comparing with ssh://user@dummy/remote
157 searching for changes
157 searching for changes
158 changeset: 3:a28a9d1a809c
158 changeset: 3:a28a9d1a809c
159 tag: tip
159 tag: tip
160 parent: 0:1160648e36ce
160 parent: 0:1160648e36ce
161 user: test
161 user: test
162 date: Thu Jan 01 00:00:00 1970 +0000
162 date: Thu Jan 01 00:00:00 1970 +0000
163 summary: add
163 summary: add
164
164
165
165
166 find incoming on the remote side
166 find incoming on the remote side
167
167
168 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/local
168 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/local
169 comparing with ssh://user@dummy/local
169 comparing with ssh://user@dummy/local
170 searching for changes
170 searching for changes
171 changeset: 3:a28a9d1a809c
171 changeset: 3:a28a9d1a809c
172 tag: tip
172 tag: tip
173 parent: 0:1160648e36ce
173 parent: 0:1160648e36ce
174 user: test
174 user: test
175 date: Thu Jan 01 00:00:00 1970 +0000
175 date: Thu Jan 01 00:00:00 1970 +0000
176 summary: add
176 summary: add
177
177
178
178
179 find incoming on the remote side (using absolute path)
179 find incoming on the remote side (using absolute path)
180
180
181 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/`pwd`"
181 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/`pwd`"
182 comparing with ssh://user@dummy/$TESTTMP/local
182 comparing with ssh://user@dummy/$TESTTMP/local
183 searching for changes
183 searching for changes
184 changeset: 3:a28a9d1a809c
184 changeset: 3:a28a9d1a809c
185 tag: tip
185 tag: tip
186 parent: 0:1160648e36ce
186 parent: 0:1160648e36ce
187 user: test
187 user: test
188 date: Thu Jan 01 00:00:00 1970 +0000
188 date: Thu Jan 01 00:00:00 1970 +0000
189 summary: add
189 summary: add
190
190
191
191
192 push
192 push
193
193
194 $ hg push
194 $ hg push
195 pushing to ssh://user@dummy/remote
195 pushing to ssh://user@dummy/remote
196 searching for changes
196 searching for changes
197 remote: adding changesets
197 remote: adding changesets
198 remote: adding manifests
198 remote: adding manifests
199 remote: adding file changes
199 remote: adding file changes
200 remote: added 1 changesets with 1 changes to 1 files
200 remote: added 1 changesets with 1 changes to 1 files
201 $ cd $TESTTMP/remote
201 $ cd $TESTTMP/remote
202
202
203 check remote tip
203 check remote tip
204
204
205 $ hg tip
205 $ hg tip
206 changeset: 3:a28a9d1a809c
206 changeset: 3:a28a9d1a809c
207 tag: tip
207 tag: tip
208 parent: 0:1160648e36ce
208 parent: 0:1160648e36ce
209 user: test
209 user: test
210 date: Thu Jan 01 00:00:00 1970 +0000
210 date: Thu Jan 01 00:00:00 1970 +0000
211 summary: add
211 summary: add
212
212
213 $ hg verify
213 $ hg verify
214 checking changesets
214 checking changesets
215 checking manifests
215 checking manifests
216 crosschecking files in changesets and manifests
216 crosschecking files in changesets and manifests
217 checking files
217 checking files
218 checked 4 changesets with 3 changes to 2 files
218 checked 4 changesets with 3 changes to 2 files
219 $ hg cat -r tip foo
219 $ hg cat -r tip foo
220 bleah
220 bleah
221 $ echo z > z
221 $ echo z > z
222 $ hg ci -A -m z z
222 $ hg ci -A -m z z
223 created new head
223 created new head
224
224
225 test pushkeys and bookmarks
225 test pushkeys and bookmarks
226
226
227 $ cd $TESTTMP/local
227 $ cd $TESTTMP/local
228 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
228 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
229 bookmarks
229 bookmarks
230 namespaces
230 namespaces
231 phases
231 phases
232 $ hg book foo -r 0
232 $ hg book foo -r 0
233 $ hg out -B --config paths.default=bogus://invalid --config paths.default:pushurl=`hg paths default`
233 $ hg out -B --config paths.default=bogus://invalid --config paths.default:pushurl=`hg paths default`
234 comparing with ssh://user@dummy/remote
234 comparing with ssh://user@dummy/remote
235 searching for changed bookmarks
235 searching for changed bookmarks
236 foo 1160648e36ce
236 foo 1160648e36ce
237 $ hg push -B foo
237 $ hg push -B foo
238 pushing to ssh://user@dummy/remote
238 pushing to ssh://user@dummy/remote
239 searching for changes
239 searching for changes
240 no changes found
240 no changes found
241 exporting bookmark foo
241 exporting bookmark foo
242 [1]
242 [1]
243 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote bookmarks
243 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote bookmarks
244 foo 1160648e36cec0054048a7edc4110c6f84fde594
244 foo 1160648e36cec0054048a7edc4110c6f84fde594
245 $ hg book -f foo
245 $ hg book -f foo
246 $ hg push --traceback
246 $ hg push --traceback
247 pushing to ssh://user@dummy/remote
247 pushing to ssh://user@dummy/remote
248 searching for changes
248 searching for changes
249 no changes found
249 no changes found
250 updating bookmark foo
250 updating bookmark foo
251 [1]
251 [1]
252 $ hg book -d foo
252 $ hg book -d foo
253 $ hg in -B
253 $ hg in -B
254 comparing with ssh://user@dummy/remote
254 comparing with ssh://user@dummy/remote
255 searching for changed bookmarks
255 searching for changed bookmarks
256 foo a28a9d1a809c
256 foo a28a9d1a809c
257 $ hg book -f -r 0 foo
257 $ hg book -f -r 0 foo
258 $ hg pull -B foo
258 $ hg pull -B foo
259 pulling from ssh://user@dummy/remote
259 pulling from ssh://user@dummy/remote
260 no changes found
260 no changes found
261 updating bookmark foo
261 updating bookmark foo
262 $ hg book -d foo
262 $ hg book -d foo
263 $ hg push -B foo
263 $ hg push -B foo
264 pushing to ssh://user@dummy/remote
264 pushing to ssh://user@dummy/remote
265 searching for changes
265 searching for changes
266 no changes found
266 no changes found
267 deleting remote bookmark foo
267 deleting remote bookmark foo
268 [1]
268 [1]
269
269
270 a bad, evil hook that prints to stdout
270 a bad, evil hook that prints to stdout
271
271
272 $ cat <<EOF > $TESTTMP/badhook
272 $ cat <<EOF > $TESTTMP/badhook
273 > import sys
273 > import sys
274 > sys.stdout.write("KABOOM\n")
274 > sys.stdout.write("KABOOM\n")
275 > sys.stdout.flush()
275 > sys.stdout.flush()
276 > EOF
276 > EOF
277
277
278 $ cat <<EOF > $TESTTMP/badpyhook.py
278 $ cat <<EOF > $TESTTMP/badpyhook.py
279 > import sys
279 > import sys
280 > def hook(ui, repo, hooktype, **kwargs):
280 > def hook(ui, repo, hooktype, **kwargs):
281 > sys.stdout.write("KABOOM IN PROCESS\n")
281 > sys.stdout.write("KABOOM IN PROCESS\n")
282 > sys.stdout.flush()
282 > sys.stdout.flush()
283 > EOF
283 > EOF
284
284
285 $ cat <<EOF >> ../remote/.hg/hgrc
285 $ cat <<EOF >> ../remote/.hg/hgrc
286 > [hooks]
286 > [hooks]
287 > changegroup.stdout = "$PYTHON" $TESTTMP/badhook
287 > changegroup.stdout = "$PYTHON" $TESTTMP/badhook
288 > changegroup.pystdout = python:$TESTTMP/badpyhook.py:hook
288 > changegroup.pystdout = python:$TESTTMP/badpyhook.py:hook
289 > EOF
289 > EOF
290 $ echo r > r
290 $ echo r > r
291 $ hg ci -A -m z r
291 $ hg ci -A -m z r
292
292
293 push should succeed even though it has an unexpected response
293 push should succeed even though it has an unexpected response
294
294
295 $ hg push
295 $ hg push
296 pushing to ssh://user@dummy/remote
296 pushing to ssh://user@dummy/remote
297 searching for changes
297 searching for changes
298 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
298 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
299 remote: adding changesets
299 remote: adding changesets
300 remote: adding manifests
300 remote: adding manifests
301 remote: adding file changes
301 remote: adding file changes
302 remote: added 1 changesets with 1 changes to 1 files
302 remote: added 1 changesets with 1 changes to 1 files
303 remote: KABOOM
303 remote: KABOOM
304 remote: KABOOM IN PROCESS
304 remote: KABOOM IN PROCESS
305 $ hg -R ../remote heads
305 $ hg -R ../remote heads
306 changeset: 5:1383141674ec
306 changeset: 5:1383141674ec
307 tag: tip
307 tag: tip
308 parent: 3:a28a9d1a809c
308 parent: 3:a28a9d1a809c
309 user: test
309 user: test
310 date: Thu Jan 01 00:00:00 1970 +0000
310 date: Thu Jan 01 00:00:00 1970 +0000
311 summary: z
311 summary: z
312
312
313 changeset: 4:6c0482d977a3
313 changeset: 4:6c0482d977a3
314 parent: 0:1160648e36ce
314 parent: 0:1160648e36ce
315 user: test
315 user: test
316 date: Thu Jan 01 00:00:00 1970 +0000
316 date: Thu Jan 01 00:00:00 1970 +0000
317 summary: z
317 summary: z
318
318
319
319
320 #if chg
320 #if chg
321
321
322 try again with remote chg, which should succeed as well
322 try again with remote chg, which should succeed as well
323
323
324 $ hg rollback -R ../remote
324 $ hg rollback -R ../remote
325 repository tip rolled back to revision 4 (undo serve)
325 repository tip rolled back to revision 4 (undo serve)
326
326
327 $ hg push --config ui.remotecmd=chg
327 $ hg push --config ui.remotecmd=chg
328 pushing to ssh://user@dummy/remote
328 pushing to ssh://user@dummy/remote
329 searching for changes
329 searching for changes
330 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
330 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
331 remote: adding changesets
331 remote: adding changesets
332 remote: adding manifests
332 remote: adding manifests
333 remote: adding file changes
333 remote: adding file changes
334 remote: KABOOM
334 remote: KABOOM
335 remote: KABOOM IN PROCESS
335 remote: KABOOM IN PROCESS
336 remote: added 1 changesets with 1 changes to 1 files
336 remote: added 1 changesets with 1 changes to 1 files
337
337
338 #endif
338 #endif
339
339
340 clone bookmarks
340 clone bookmarks
341
341
342 $ hg -R ../remote bookmark test
342 $ hg -R ../remote bookmark test
343 $ hg -R ../remote bookmarks
343 $ hg -R ../remote bookmarks
344 * test 4:6c0482d977a3
344 * test 4:6c0482d977a3
345 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local-bookmarks
345 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local-bookmarks
346 requesting all changes
346 requesting all changes
347 adding changesets
347 adding changesets
348 adding manifests
348 adding manifests
349 adding file changes
349 adding file changes
350 added 6 changesets with 5 changes to 4 files (+1 heads)
350 added 6 changesets with 5 changes to 4 files (+1 heads)
351 new changesets 1160648e36ce:1383141674ec
351 new changesets 1160648e36ce:1383141674ec
352 updating to branch default
352 updating to branch default
353 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
353 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
354 $ hg -R local-bookmarks bookmarks
354 $ hg -R local-bookmarks bookmarks
355 test 4:6c0482d977a3
355 test 4:6c0482d977a3
356
356
357 passwords in ssh urls are not supported
357 passwords in ssh urls are not supported
358 (we use a glob here because different Python versions give different
358 (we use a glob here because different Python versions give different
359 results here)
359 results here)
360
360
361 $ hg push ssh://user:erroneouspwd@dummy/remote
361 $ hg push ssh://user:erroneouspwd@dummy/remote
362 pushing to ssh://user:*@dummy/remote (glob)
362 pushing to ssh://user:*@dummy/remote (glob)
363 abort: password in URL not supported!
363 abort: password in URL not supported!
364 [255]
364 [255]
365
365
366 $ cd $TESTTMP
366 $ cd $TESTTMP
367
367
368 hide outer repo
368 hide outer repo
369 $ hg init
369 $ hg init
370
370
371 Test remote paths with spaces (issue2983):
371 Test remote paths with spaces (issue2983):
372
372
373 $ hg init --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
373 $ hg init --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
374 $ touch "$TESTTMP/a repo/test"
374 $ touch "$TESTTMP/a repo/test"
375 $ hg -R 'a repo' commit -A -m "test"
375 $ hg -R 'a repo' commit -A -m "test"
376 adding test
376 adding test
377 $ hg -R 'a repo' tag tag
377 $ hg -R 'a repo' tag tag
378 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
378 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
379 73649e48688a
379 73649e48688a
380
380
381 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo#noNoNO"
381 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo#noNoNO"
382 abort: unknown revision 'noNoNO'!
382 abort: unknown revision 'noNoNO'!
383 [255]
383 [255]
384
384
385 Test (non-)escaping of remote paths with spaces when cloning (issue3145):
385 Test (non-)escaping of remote paths with spaces when cloning (issue3145):
386
386
387 $ hg clone --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
387 $ hg clone --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
388 destination directory: a repo
388 destination directory: a repo
389 abort: destination 'a repo' is not empty
389 abort: destination 'a repo' is not empty
390 [255]
390 [10]
391
391
392 Make sure hg is really paranoid in serve --stdio mode. It used to be
392 Make sure hg is really paranoid in serve --stdio mode. It used to be
393 possible to get a debugger REPL by specifying a repo named --debugger.
393 possible to get a debugger REPL by specifying a repo named --debugger.
394 $ hg -R --debugger serve --stdio
394 $ hg -R --debugger serve --stdio
395 abort: potentially unsafe serve --stdio invocation: ['-R', '--debugger', 'serve', '--stdio']
395 abort: potentially unsafe serve --stdio invocation: ['-R', '--debugger', 'serve', '--stdio']
396 [255]
396 [255]
397 $ hg -R --config=ui.debugger=yes serve --stdio
397 $ hg -R --config=ui.debugger=yes serve --stdio
398 abort: potentially unsafe serve --stdio invocation: ['-R', '--config=ui.debugger=yes', 'serve', '--stdio']
398 abort: potentially unsafe serve --stdio invocation: ['-R', '--config=ui.debugger=yes', 'serve', '--stdio']
399 [255]
399 [255]
400 Abbreviations of 'serve' also don't work, to avoid shenanigans.
400 Abbreviations of 'serve' also don't work, to avoid shenanigans.
401 $ hg -R narf serv --stdio
401 $ hg -R narf serv --stdio
402 abort: potentially unsafe serve --stdio invocation: ['-R', 'narf', 'serv', '--stdio']
402 abort: potentially unsafe serve --stdio invocation: ['-R', 'narf', 'serv', '--stdio']
403 [255]
403 [255]
404
404
405 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
405 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
406 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
406 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
407 parameters:
407 parameters:
408
408
409 $ cat > ssh.sh << EOF
409 $ cat > ssh.sh << EOF
410 > userhost="\$1"
410 > userhost="\$1"
411 > SSH_ORIGINAL_COMMAND="\$2"
411 > SSH_ORIGINAL_COMMAND="\$2"
412 > export SSH_ORIGINAL_COMMAND
412 > export SSH_ORIGINAL_COMMAND
413 > PYTHONPATH="$PYTHONPATH"
413 > PYTHONPATH="$PYTHONPATH"
414 > export PYTHONPATH
414 > export PYTHONPATH
415 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
415 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
416 > EOF
416 > EOF
417
417
418 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
418 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
419 73649e48688a
419 73649e48688a
420
420
421 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
421 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
422 remote: Illegal repository "$TESTTMP/a'repo"
422 remote: Illegal repository "$TESTTMP/a'repo"
423 abort: no suitable response from remote hg!
423 abort: no suitable response from remote hg!
424 [255]
424 [255]
425
425
426 $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
426 $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
427 remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
427 remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
428 abort: no suitable response from remote hg!
428 abort: no suitable response from remote hg!
429 [255]
429 [255]
430
430
431 $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" "$PYTHON" "$TESTDIR/../contrib/hg-ssh"
431 $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" "$PYTHON" "$TESTDIR/../contrib/hg-ssh"
432 Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
432 Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
433 [255]
433 [255]
434
434
435 Test hg-ssh in read-only mode:
435 Test hg-ssh in read-only mode:
436
436
437 $ cat > ssh.sh << EOF
437 $ cat > ssh.sh << EOF
438 > userhost="\$1"
438 > userhost="\$1"
439 > SSH_ORIGINAL_COMMAND="\$2"
439 > SSH_ORIGINAL_COMMAND="\$2"
440 > export SSH_ORIGINAL_COMMAND
440 > export SSH_ORIGINAL_COMMAND
441 > PYTHONPATH="$PYTHONPATH"
441 > PYTHONPATH="$PYTHONPATH"
442 > export PYTHONPATH
442 > export PYTHONPATH
443 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
443 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
444 > EOF
444 > EOF
445
445
446 $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
446 $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
447 requesting all changes
447 requesting all changes
448 adding changesets
448 adding changesets
449 adding manifests
449 adding manifests
450 adding file changes
450 adding file changes
451 added 6 changesets with 5 changes to 4 files (+1 heads)
451 added 6 changesets with 5 changes to 4 files (+1 heads)
452 new changesets 1160648e36ce:1383141674ec
452 new changesets 1160648e36ce:1383141674ec
453 updating to branch default
453 updating to branch default
454 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
454 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
455
455
456 $ cd read-only-local
456 $ cd read-only-local
457 $ echo "baz" > bar
457 $ echo "baz" > bar
458 $ hg ci -A -m "unpushable commit" bar
458 $ hg ci -A -m "unpushable commit" bar
459 $ hg push --ssh "sh ../ssh.sh"
459 $ hg push --ssh "sh ../ssh.sh"
460 pushing to ssh://user@dummy/*/remote (glob)
460 pushing to ssh://user@dummy/*/remote (glob)
461 searching for changes
461 searching for changes
462 remote: Permission denied
462 remote: Permission denied
463 remote: pretxnopen.hg-ssh hook failed
463 remote: pretxnopen.hg-ssh hook failed
464 abort: push failed on remote
464 abort: push failed on remote
465 [255]
465 [255]
466
466
467 $ cd $TESTTMP
467 $ cd $TESTTMP
468
468
469 stderr from remote commands should be printed before stdout from local code (issue4336)
469 stderr from remote commands should be printed before stdout from local code (issue4336)
470
470
471 $ hg clone remote stderr-ordering
471 $ hg clone remote stderr-ordering
472 updating to branch default
472 updating to branch default
473 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
473 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
474 $ cd stderr-ordering
474 $ cd stderr-ordering
475 $ cat >> localwrite.py << EOF
475 $ cat >> localwrite.py << EOF
476 > from mercurial import exchange, extensions
476 > from mercurial import exchange, extensions
477 >
477 >
478 > def wrappedpush(orig, repo, *args, **kwargs):
478 > def wrappedpush(orig, repo, *args, **kwargs):
479 > res = orig(repo, *args, **kwargs)
479 > res = orig(repo, *args, **kwargs)
480 > repo.ui.write(b'local stdout\n')
480 > repo.ui.write(b'local stdout\n')
481 > repo.ui.flush()
481 > repo.ui.flush()
482 > return res
482 > return res
483 >
483 >
484 > def extsetup(ui):
484 > def extsetup(ui):
485 > extensions.wrapfunction(exchange, b'push', wrappedpush)
485 > extensions.wrapfunction(exchange, b'push', wrappedpush)
486 > EOF
486 > EOF
487
487
488 $ cat >> .hg/hgrc << EOF
488 $ cat >> .hg/hgrc << EOF
489 > [paths]
489 > [paths]
490 > default-push = ssh://user@dummy/remote
490 > default-push = ssh://user@dummy/remote
491 > [ui]
491 > [ui]
492 > ssh = "$PYTHON" "$TESTDIR/dummyssh"
492 > ssh = "$PYTHON" "$TESTDIR/dummyssh"
493 > [extensions]
493 > [extensions]
494 > localwrite = localwrite.py
494 > localwrite = localwrite.py
495 > EOF
495 > EOF
496
496
497 $ echo localwrite > foo
497 $ echo localwrite > foo
498 $ hg commit -m 'testing localwrite'
498 $ hg commit -m 'testing localwrite'
499 $ hg push
499 $ hg push
500 pushing to ssh://user@dummy/remote
500 pushing to ssh://user@dummy/remote
501 searching for changes
501 searching for changes
502 remote: adding changesets
502 remote: adding changesets
503 remote: adding manifests
503 remote: adding manifests
504 remote: adding file changes
504 remote: adding file changes
505 remote: added 1 changesets with 1 changes to 1 files
505 remote: added 1 changesets with 1 changes to 1 files
506 remote: KABOOM
506 remote: KABOOM
507 remote: KABOOM IN PROCESS
507 remote: KABOOM IN PROCESS
508 local stdout
508 local stdout
509
509
510 debug output
510 debug output
511
511
512 $ hg pull --debug ssh://user@dummy/remote --config devel.debug.peer-request=yes
512 $ hg pull --debug ssh://user@dummy/remote --config devel.debug.peer-request=yes
513 pulling from ssh://user@dummy/remote
513 pulling from ssh://user@dummy/remote
514 running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
514 running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
515 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
515 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
516 devel-peer-request: hello+between
516 devel-peer-request: hello+between
517 devel-peer-request: pairs: 81 bytes
517 devel-peer-request: pairs: 81 bytes
518 sending hello command
518 sending hello command
519 sending between command
519 sending between command
520 remote: 463 (sshv1 !)
520 remote: 463 (sshv1 !)
521 protocol upgraded to exp-ssh-v2-0003 (sshv2 !)
521 protocol upgraded to exp-ssh-v2-0003 (sshv2 !)
522 remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
522 remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
523 remote: 1 (sshv1 !)
523 remote: 1 (sshv1 !)
524 devel-peer-request: protocaps
524 devel-peer-request: protocaps
525 devel-peer-request: caps: * bytes (glob)
525 devel-peer-request: caps: * bytes (glob)
526 sending protocaps command
526 sending protocaps command
527 query 1; heads
527 query 1; heads
528 devel-peer-request: batched-content
528 devel-peer-request: batched-content
529 devel-peer-request: - heads (0 arguments)
529 devel-peer-request: - heads (0 arguments)
530 devel-peer-request: - known (1 arguments)
530 devel-peer-request: - known (1 arguments)
531 devel-peer-request: batch
531 devel-peer-request: batch
532 devel-peer-request: cmds: 141 bytes
532 devel-peer-request: cmds: 141 bytes
533 sending batch command
533 sending batch command
534 searching for changes
534 searching for changes
535 all remote heads known locally
535 all remote heads known locally
536 no changes found
536 no changes found
537 devel-peer-request: getbundle
537 devel-peer-request: getbundle
538 devel-peer-request: bookmarks: 1 bytes
538 devel-peer-request: bookmarks: 1 bytes
539 devel-peer-request: bundlecaps: 289 bytes
539 devel-peer-request: bundlecaps: 289 bytes
540 devel-peer-request: cg: 1 bytes
540 devel-peer-request: cg: 1 bytes
541 devel-peer-request: common: 122 bytes
541 devel-peer-request: common: 122 bytes
542 devel-peer-request: heads: 122 bytes
542 devel-peer-request: heads: 122 bytes
543 devel-peer-request: listkeys: 9 bytes
543 devel-peer-request: listkeys: 9 bytes
544 devel-peer-request: phases: 1 bytes
544 devel-peer-request: phases: 1 bytes
545 sending getbundle command
545 sending getbundle command
546 bundle2-input-bundle: with-transaction
546 bundle2-input-bundle: with-transaction
547 bundle2-input-part: "bookmarks" supported
547 bundle2-input-part: "bookmarks" supported
548 bundle2-input-part: total payload size 26
548 bundle2-input-part: total payload size 26
549 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
549 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
550 bundle2-input-part: total payload size 45
550 bundle2-input-part: total payload size 45
551 bundle2-input-part: "phase-heads" supported
551 bundle2-input-part: "phase-heads" supported
552 bundle2-input-part: total payload size 72
552 bundle2-input-part: total payload size 72
553 bundle2-input-bundle: 3 parts total
553 bundle2-input-bundle: 3 parts total
554 checking for updated bookmarks
554 checking for updated bookmarks
555
555
556 $ cd $TESTTMP
556 $ cd $TESTTMP
557
557
558 $ cat dummylog
558 $ cat dummylog
559 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
559 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
560 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
560 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
561 Got arguments 1:user@dummy 2:hg -R $TESTTMP/nonexistent serve --stdio
561 Got arguments 1:user@dummy 2:hg -R $TESTTMP/nonexistent serve --stdio
562 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
562 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
563 Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio (no-reposimplestore !)
563 Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio (no-reposimplestore !)
564 Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
564 Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
565 Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
565 Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
566 Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio
566 Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio
567 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
567 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
568 Got arguments 1:user@dummy 2:hg -R local serve --stdio
568 Got arguments 1:user@dummy 2:hg -R local serve --stdio
569 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
569 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
570 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
570 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
571 changegroup-in-remote hook: HG_BUNDLE2=1
571 changegroup-in-remote hook: HG_BUNDLE2=1
572 HG_HOOKNAME=changegroup
572 HG_HOOKNAME=changegroup
573 HG_HOOKTYPE=changegroup
573 HG_HOOKTYPE=changegroup
574 HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60
574 HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60
575 HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60
575 HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60
576 HG_SOURCE=serve
576 HG_SOURCE=serve
577 HG_TXNID=TXN:$ID$
577 HG_TXNID=TXN:$ID$
578 HG_TXNNAME=serve
578 HG_TXNNAME=serve
579 HG_URL=remote:ssh:$LOCALIP
579 HG_URL=remote:ssh:$LOCALIP
580
580
581 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
581 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
582 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
582 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
583 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
583 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
584 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
584 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
585 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
585 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
586 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
586 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
587 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
587 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
588 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
588 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
589 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
589 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
590 changegroup-in-remote hook: HG_BUNDLE2=1
590 changegroup-in-remote hook: HG_BUNDLE2=1
591 HG_HOOKNAME=changegroup
591 HG_HOOKNAME=changegroup
592 HG_HOOKTYPE=changegroup
592 HG_HOOKTYPE=changegroup
593 HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6
593 HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6
594 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6
594 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6
595 HG_SOURCE=serve
595 HG_SOURCE=serve
596 HG_TXNID=TXN:$ID$
596 HG_TXNID=TXN:$ID$
597 HG_TXNNAME=serve
597 HG_TXNNAME=serve
598 HG_URL=remote:ssh:$LOCALIP
598 HG_URL=remote:ssh:$LOCALIP
599
599
600 Got arguments 1:user@dummy 2:chg -R remote serve --stdio (chg !)
600 Got arguments 1:user@dummy 2:chg -R remote serve --stdio (chg !)
601 changegroup-in-remote hook: HG_BUNDLE2=1 (chg !)
601 changegroup-in-remote hook: HG_BUNDLE2=1 (chg !)
602 HG_HOOKNAME=changegroup (chg !)
602 HG_HOOKNAME=changegroup (chg !)
603 HG_HOOKTYPE=changegroup (chg !)
603 HG_HOOKTYPE=changegroup (chg !)
604 HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 (chg !)
604 HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 (chg !)
605 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 (chg !)
605 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 (chg !)
606 HG_SOURCE=serve (chg !)
606 HG_SOURCE=serve (chg !)
607 HG_TXNID=TXN:$ID$ (chg !)
607 HG_TXNID=TXN:$ID$ (chg !)
608 HG_TXNNAME=serve (chg !)
608 HG_TXNNAME=serve (chg !)
609 HG_URL=remote:ssh:$LOCALIP (chg !)
609 HG_URL=remote:ssh:$LOCALIP (chg !)
610 (chg !)
610 (chg !)
611 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
611 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
612 Got arguments 1:user@dummy 2:hg init 'a repo'
612 Got arguments 1:user@dummy 2:hg init 'a repo'
613 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
613 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
614 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
614 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
615 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
615 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
616 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
616 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
617 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
617 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
618 changegroup-in-remote hook: HG_BUNDLE2=1
618 changegroup-in-remote hook: HG_BUNDLE2=1
619 HG_HOOKNAME=changegroup
619 HG_HOOKNAME=changegroup
620 HG_HOOKTYPE=changegroup
620 HG_HOOKTYPE=changegroup
621 HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8
621 HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8
622 HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8
622 HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8
623 HG_SOURCE=serve
623 HG_SOURCE=serve
624 HG_TXNID=TXN:$ID$
624 HG_TXNID=TXN:$ID$
625 HG_TXNNAME=serve
625 HG_TXNNAME=serve
626 HG_URL=remote:ssh:$LOCALIP
626 HG_URL=remote:ssh:$LOCALIP
627
627
628 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
628 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
629
629
630
630
631 remote hook failure is attributed to remote
631 remote hook failure is attributed to remote
632
632
633 $ cat > $TESTTMP/failhook << EOF
633 $ cat > $TESTTMP/failhook << EOF
634 > def hook(ui, repo, **kwargs):
634 > def hook(ui, repo, **kwargs):
635 > ui.write(b'hook failure!\n')
635 > ui.write(b'hook failure!\n')
636 > ui.flush()
636 > ui.flush()
637 > return 1
637 > return 1
638 > EOF
638 > EOF
639
639
640 $ echo "pretxnchangegroup.fail = python:$TESTTMP/failhook:hook" >> remote/.hg/hgrc
640 $ echo "pretxnchangegroup.fail = python:$TESTTMP/failhook:hook" >> remote/.hg/hgrc
641
641
642 $ hg -q --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" clone ssh://user@dummy/remote hookout
642 $ hg -q --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" clone ssh://user@dummy/remote hookout
643 $ cd hookout
643 $ cd hookout
644 $ touch hookfailure
644 $ touch hookfailure
645 $ hg -q commit -A -m 'remote hook failure'
645 $ hg -q commit -A -m 'remote hook failure'
646 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" push
646 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" push
647 pushing to ssh://user@dummy/remote
647 pushing to ssh://user@dummy/remote
648 searching for changes
648 searching for changes
649 remote: adding changesets
649 remote: adding changesets
650 remote: adding manifests
650 remote: adding manifests
651 remote: adding file changes
651 remote: adding file changes
652 remote: hook failure!
652 remote: hook failure!
653 remote: transaction abort!
653 remote: transaction abort!
654 remote: rollback completed
654 remote: rollback completed
655 remote: pretxnchangegroup.fail hook failed
655 remote: pretxnchangegroup.fail hook failed
656 abort: push failed on remote
656 abort: push failed on remote
657 [255]
657 [255]
658
658
659 abort during pull is properly reported as such
659 abort during pull is properly reported as such
660
660
661 $ echo morefoo >> ../remote/foo
661 $ echo morefoo >> ../remote/foo
662 $ hg -R ../remote commit --message "more foo to be pulled"
662 $ hg -R ../remote commit --message "more foo to be pulled"
663 $ cat >> ../remote/.hg/hgrc << EOF
663 $ cat >> ../remote/.hg/hgrc << EOF
664 > [extensions]
664 > [extensions]
665 > crash = ${TESTDIR}/crashgetbundler.py
665 > crash = ${TESTDIR}/crashgetbundler.py
666 > EOF
666 > EOF
667 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" pull
667 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" pull
668 pulling from ssh://user@dummy/remote
668 pulling from ssh://user@dummy/remote
669 searching for changes
669 searching for changes
670 remote: abort: this is an exercise
670 remote: abort: this is an exercise
671 abort: pull failed on remote
671 abort: pull failed on remote
672 [255]
672 [255]
673
673
674 abort with no error hint when there is a ssh problem when pulling
674 abort with no error hint when there is a ssh problem when pulling
675
675
676 $ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
676 $ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
677 pulling from ssh://brokenrepository/
677 pulling from ssh://brokenrepository/
678 abort: no suitable response from remote hg!
678 abort: no suitable response from remote hg!
679 [255]
679 [255]
680
680
681 abort with configured error hint when there is a ssh problem when pulling
681 abort with configured error hint when there is a ssh problem when pulling
682
682
683 $ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" \
683 $ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" \
684 > --config ui.ssherrorhint="Please see http://company/internalwiki/ssh.html"
684 > --config ui.ssherrorhint="Please see http://company/internalwiki/ssh.html"
685 pulling from ssh://brokenrepository/
685 pulling from ssh://brokenrepository/
686 abort: no suitable response from remote hg!
686 abort: no suitable response from remote hg!
687 (Please see http://company/internalwiki/ssh.html)
687 (Please see http://company/internalwiki/ssh.html)
688 [255]
688 [255]
689
689
690 test that custom environment is passed down to ssh executable
690 test that custom environment is passed down to ssh executable
691 $ cat >>dumpenv <<EOF
691 $ cat >>dumpenv <<EOF
692 > #! /bin/sh
692 > #! /bin/sh
693 > echo \$VAR >&2
693 > echo \$VAR >&2
694 > EOF
694 > EOF
695 $ chmod +x dumpenv
695 $ chmod +x dumpenv
696 $ hg pull ssh://something --config ui.ssh="sh dumpenv"
696 $ hg pull ssh://something --config ui.ssh="sh dumpenv"
697 pulling from ssh://something/
697 pulling from ssh://something/
698 remote:
698 remote:
699 abort: no suitable response from remote hg!
699 abort: no suitable response from remote hg!
700 [255]
700 [255]
701 $ hg pull ssh://something --config ui.ssh="sh dumpenv" --config sshenv.VAR=17
701 $ hg pull ssh://something --config ui.ssh="sh dumpenv" --config sshenv.VAR=17
702 pulling from ssh://something/
702 pulling from ssh://something/
703 remote: 17
703 remote: 17
704 abort: no suitable response from remote hg!
704 abort: no suitable response from remote hg!
705 [255]
705 [255]
706
706
General Comments 0
You need to be logged in to leave comments. Login now