##// END OF EJS Templates
outgoing: display info about secret changets while no sharable changeset found
Alain Leufroy <alain.leufroyATgmailMYDOTcom> -
r15992:963c8a55 stable
parent child Browse files
Show More
@@ -1,584 +1,588
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 i18n import _
9 from i18n import _
10 from lock import release
10 from lock import release
11 from node import hex, nullid
11 from node import hex, nullid
12 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo, bookmarks
12 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo, bookmarks
13 import lock, util, extensions, error, node
13 import lock, util, extensions, error, node
14 import cmdutil, discovery
14 import cmdutil, discovery
15 import merge as mergemod
15 import merge as mergemod
16 import verify as verifymod
16 import verify as verifymod
17 import errno, os, shutil
17 import errno, os, shutil
18
18
19 def _local(path):
19 def _local(path):
20 path = util.expandpath(util.urllocalpath(path))
20 path = util.expandpath(util.urllocalpath(path))
21 return (os.path.isfile(path) and bundlerepo or localrepo)
21 return (os.path.isfile(path) and bundlerepo or localrepo)
22
22
23 def addbranchrevs(lrepo, repo, branches, revs):
23 def addbranchrevs(lrepo, repo, branches, revs):
24 hashbranch, branches = branches
24 hashbranch, branches = branches
25 if not hashbranch and not branches:
25 if not hashbranch and not branches:
26 return revs or None, revs and revs[0] or None
26 return revs or None, revs and revs[0] or None
27 revs = revs and list(revs) or []
27 revs = revs and list(revs) or []
28 if not repo.capable('branchmap'):
28 if not repo.capable('branchmap'):
29 if branches:
29 if branches:
30 raise util.Abort(_("remote branch lookup not supported"))
30 raise util.Abort(_("remote branch lookup not supported"))
31 revs.append(hashbranch)
31 revs.append(hashbranch)
32 return revs, revs[0]
32 return revs, revs[0]
33 branchmap = repo.branchmap()
33 branchmap = repo.branchmap()
34
34
35 def primary(branch):
35 def primary(branch):
36 if branch == '.':
36 if branch == '.':
37 if not lrepo or not lrepo.local():
37 if not lrepo or not lrepo.local():
38 raise util.Abort(_("dirstate branch not accessible"))
38 raise util.Abort(_("dirstate branch not accessible"))
39 branch = lrepo.dirstate.branch()
39 branch = lrepo.dirstate.branch()
40 if branch in branchmap:
40 if branch in branchmap:
41 revs.extend(node.hex(r) for r in reversed(branchmap[branch]))
41 revs.extend(node.hex(r) for r in reversed(branchmap[branch]))
42 return True
42 return True
43 else:
43 else:
44 return False
44 return False
45
45
46 for branch in branches:
46 for branch in branches:
47 if not primary(branch):
47 if not primary(branch):
48 raise error.RepoLookupError(_("unknown branch '%s'") % branch)
48 raise error.RepoLookupError(_("unknown branch '%s'") % branch)
49 if hashbranch:
49 if hashbranch:
50 if not primary(hashbranch):
50 if not primary(hashbranch):
51 revs.append(hashbranch)
51 revs.append(hashbranch)
52 return revs, revs[0]
52 return revs, revs[0]
53
53
54 def parseurl(path, branches=None):
54 def parseurl(path, branches=None):
55 '''parse url#branch, returning (url, (branch, branches))'''
55 '''parse url#branch, returning (url, (branch, branches))'''
56
56
57 u = util.url(path)
57 u = util.url(path)
58 branch = None
58 branch = None
59 if u.fragment:
59 if u.fragment:
60 branch = u.fragment
60 branch = u.fragment
61 u.fragment = None
61 u.fragment = None
62 return str(u), (branch, branches or [])
62 return str(u), (branch, branches or [])
63
63
64 schemes = {
64 schemes = {
65 'bundle': bundlerepo,
65 'bundle': bundlerepo,
66 'file': _local,
66 'file': _local,
67 'http': httprepo,
67 'http': httprepo,
68 'https': httprepo,
68 'https': httprepo,
69 'ssh': sshrepo,
69 'ssh': sshrepo,
70 'static-http': statichttprepo,
70 'static-http': statichttprepo,
71 }
71 }
72
72
73 def _peerlookup(path):
73 def _peerlookup(path):
74 u = util.url(path)
74 u = util.url(path)
75 scheme = u.scheme or 'file'
75 scheme = u.scheme or 'file'
76 thing = schemes.get(scheme) or schemes['file']
76 thing = schemes.get(scheme) or schemes['file']
77 try:
77 try:
78 return thing(path)
78 return thing(path)
79 except TypeError:
79 except TypeError:
80 return thing
80 return thing
81
81
82 def islocal(repo):
82 def islocal(repo):
83 '''return true if repo or path is local'''
83 '''return true if repo or path is local'''
84 if isinstance(repo, str):
84 if isinstance(repo, str):
85 try:
85 try:
86 return _peerlookup(repo).islocal(repo)
86 return _peerlookup(repo).islocal(repo)
87 except AttributeError:
87 except AttributeError:
88 return False
88 return False
89 return repo.local()
89 return repo.local()
90
90
91 def repository(ui, path='', create=False):
91 def repository(ui, path='', create=False):
92 """return a repository object for the specified path"""
92 """return a repository object for the specified path"""
93 repo = _peerlookup(path).instance(ui, path, create)
93 repo = _peerlookup(path).instance(ui, path, create)
94 ui = getattr(repo, "ui", ui)
94 ui = getattr(repo, "ui", ui)
95 for name, module in extensions.extensions():
95 for name, module in extensions.extensions():
96 hook = getattr(module, 'reposetup', None)
96 hook = getattr(module, 'reposetup', None)
97 if hook:
97 if hook:
98 hook(ui, repo)
98 hook(ui, repo)
99 return repo
99 return repo
100
100
101 def peer(uiorrepo, opts, path, create=False):
101 def peer(uiorrepo, opts, path, create=False):
102 '''return a repository peer for the specified path'''
102 '''return a repository peer for the specified path'''
103 rui = remoteui(uiorrepo, opts)
103 rui = remoteui(uiorrepo, opts)
104 return repository(rui, path, create)
104 return repository(rui, path, create)
105
105
106 def defaultdest(source):
106 def defaultdest(source):
107 '''return default destination of clone if none is given'''
107 '''return default destination of clone if none is given'''
108 return os.path.basename(os.path.normpath(source))
108 return os.path.basename(os.path.normpath(source))
109
109
110 def share(ui, source, dest=None, update=True):
110 def share(ui, source, dest=None, update=True):
111 '''create a shared repository'''
111 '''create a shared repository'''
112
112
113 if not islocal(source):
113 if not islocal(source):
114 raise util.Abort(_('can only share local repositories'))
114 raise util.Abort(_('can only share local repositories'))
115
115
116 if not dest:
116 if not dest:
117 dest = defaultdest(source)
117 dest = defaultdest(source)
118 else:
118 else:
119 dest = ui.expandpath(dest)
119 dest = ui.expandpath(dest)
120
120
121 if isinstance(source, str):
121 if isinstance(source, str):
122 origsource = ui.expandpath(source)
122 origsource = ui.expandpath(source)
123 source, branches = parseurl(origsource)
123 source, branches = parseurl(origsource)
124 srcrepo = repository(ui, source)
124 srcrepo = repository(ui, source)
125 rev, checkout = addbranchrevs(srcrepo, srcrepo, branches, None)
125 rev, checkout = addbranchrevs(srcrepo, srcrepo, branches, None)
126 else:
126 else:
127 srcrepo = source
127 srcrepo = source
128 origsource = source = srcrepo.url()
128 origsource = source = srcrepo.url()
129 checkout = None
129 checkout = None
130
130
131 sharedpath = srcrepo.sharedpath # if our source is already sharing
131 sharedpath = srcrepo.sharedpath # if our source is already sharing
132
132
133 root = os.path.realpath(dest)
133 root = os.path.realpath(dest)
134 roothg = os.path.join(root, '.hg')
134 roothg = os.path.join(root, '.hg')
135
135
136 if os.path.exists(roothg):
136 if os.path.exists(roothg):
137 raise util.Abort(_('destination already exists'))
137 raise util.Abort(_('destination already exists'))
138
138
139 if not os.path.isdir(root):
139 if not os.path.isdir(root):
140 os.mkdir(root)
140 os.mkdir(root)
141 util.makedir(roothg, notindexed=True)
141 util.makedir(roothg, notindexed=True)
142
142
143 requirements = ''
143 requirements = ''
144 try:
144 try:
145 requirements = srcrepo.opener.read('requires')
145 requirements = srcrepo.opener.read('requires')
146 except IOError, inst:
146 except IOError, inst:
147 if inst.errno != errno.ENOENT:
147 if inst.errno != errno.ENOENT:
148 raise
148 raise
149
149
150 requirements += 'shared\n'
150 requirements += 'shared\n'
151 util.writefile(os.path.join(roothg, 'requires'), requirements)
151 util.writefile(os.path.join(roothg, 'requires'), requirements)
152 util.writefile(os.path.join(roothg, 'sharedpath'), sharedpath)
152 util.writefile(os.path.join(roothg, 'sharedpath'), sharedpath)
153
153
154 r = repository(ui, root)
154 r = repository(ui, root)
155
155
156 default = srcrepo.ui.config('paths', 'default')
156 default = srcrepo.ui.config('paths', 'default')
157 if default:
157 if default:
158 fp = r.opener("hgrc", "w", text=True)
158 fp = r.opener("hgrc", "w", text=True)
159 fp.write("[paths]\n")
159 fp.write("[paths]\n")
160 fp.write("default = %s\n" % default)
160 fp.write("default = %s\n" % default)
161 fp.close()
161 fp.close()
162
162
163 if update:
163 if update:
164 r.ui.status(_("updating working directory\n"))
164 r.ui.status(_("updating working directory\n"))
165 if update is not True:
165 if update is not True:
166 checkout = update
166 checkout = update
167 for test in (checkout, 'default', 'tip'):
167 for test in (checkout, 'default', 'tip'):
168 if test is None:
168 if test is None:
169 continue
169 continue
170 try:
170 try:
171 uprev = r.lookup(test)
171 uprev = r.lookup(test)
172 break
172 break
173 except error.RepoLookupError:
173 except error.RepoLookupError:
174 continue
174 continue
175 _update(r, uprev)
175 _update(r, uprev)
176
176
177 def copystore(ui, srcrepo, destpath):
177 def copystore(ui, srcrepo, destpath):
178 '''copy files from store of srcrepo in destpath
178 '''copy files from store of srcrepo in destpath
179
179
180 returns destlock
180 returns destlock
181 '''
181 '''
182 destlock = None
182 destlock = None
183 try:
183 try:
184 hardlink = None
184 hardlink = None
185 num = 0
185 num = 0
186 srcpublishing = srcrepo.ui.configbool('phases', 'publish', True)
186 srcpublishing = srcrepo.ui.configbool('phases', 'publish', True)
187 for f in srcrepo.store.copylist():
187 for f in srcrepo.store.copylist():
188 if srcpublishing and f.endswith('phaseroots'):
188 if srcpublishing and f.endswith('phaseroots'):
189 continue
189 continue
190 src = os.path.join(srcrepo.sharedpath, f)
190 src = os.path.join(srcrepo.sharedpath, f)
191 dst = os.path.join(destpath, f)
191 dst = os.path.join(destpath, f)
192 dstbase = os.path.dirname(dst)
192 dstbase = os.path.dirname(dst)
193 if dstbase and not os.path.exists(dstbase):
193 if dstbase and not os.path.exists(dstbase):
194 os.mkdir(dstbase)
194 os.mkdir(dstbase)
195 if os.path.exists(src):
195 if os.path.exists(src):
196 if dst.endswith('data'):
196 if dst.endswith('data'):
197 # lock to avoid premature writing to the target
197 # lock to avoid premature writing to the target
198 destlock = lock.lock(os.path.join(dstbase, "lock"))
198 destlock = lock.lock(os.path.join(dstbase, "lock"))
199 hardlink, n = util.copyfiles(src, dst, hardlink)
199 hardlink, n = util.copyfiles(src, dst, hardlink)
200 num += n
200 num += n
201 if hardlink:
201 if hardlink:
202 ui.debug("linked %d files\n" % num)
202 ui.debug("linked %d files\n" % num)
203 else:
203 else:
204 ui.debug("copied %d files\n" % num)
204 ui.debug("copied %d files\n" % num)
205 return destlock
205 return destlock
206 except:
206 except:
207 release(destlock)
207 release(destlock)
208 raise
208 raise
209
209
210 def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
210 def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
211 update=True, stream=False, branch=None):
211 update=True, stream=False, branch=None):
212 """Make a copy of an existing repository.
212 """Make a copy of an existing repository.
213
213
214 Create a copy of an existing repository in a new directory. The
214 Create a copy of an existing repository in a new directory. The
215 source and destination are URLs, as passed to the repository
215 source and destination are URLs, as passed to the repository
216 function. Returns a pair of repository objects, the source and
216 function. Returns a pair of repository objects, the source and
217 newly created destination.
217 newly created destination.
218
218
219 The location of the source is added to the new repository's
219 The location of the source is added to the new repository's
220 .hg/hgrc file, as the default to be used for future pulls and
220 .hg/hgrc file, as the default to be used for future pulls and
221 pushes.
221 pushes.
222
222
223 If an exception is raised, the partly cloned/updated destination
223 If an exception is raised, the partly cloned/updated destination
224 repository will be deleted.
224 repository will be deleted.
225
225
226 Arguments:
226 Arguments:
227
227
228 source: repository object or URL
228 source: repository object or URL
229
229
230 dest: URL of destination repository to create (defaults to base
230 dest: URL of destination repository to create (defaults to base
231 name of source repository)
231 name of source repository)
232
232
233 pull: always pull from source repository, even in local case
233 pull: always pull from source repository, even in local case
234
234
235 stream: stream raw data uncompressed from repository (fast over
235 stream: stream raw data uncompressed from repository (fast over
236 LAN, slow over WAN)
236 LAN, slow over WAN)
237
237
238 rev: revision to clone up to (implies pull=True)
238 rev: revision to clone up to (implies pull=True)
239
239
240 update: update working directory after clone completes, if
240 update: update working directory after clone completes, if
241 destination is local repository (True means update to default rev,
241 destination is local repository (True means update to default rev,
242 anything else is treated as a revision)
242 anything else is treated as a revision)
243
243
244 branch: branches to clone
244 branch: branches to clone
245 """
245 """
246
246
247 if isinstance(source, str):
247 if isinstance(source, str):
248 origsource = ui.expandpath(source)
248 origsource = ui.expandpath(source)
249 source, branch = parseurl(origsource, branch)
249 source, branch = parseurl(origsource, branch)
250 srcrepo = repository(remoteui(ui, peeropts), source)
250 srcrepo = repository(remoteui(ui, peeropts), source)
251 else:
251 else:
252 srcrepo = source
252 srcrepo = source
253 branch = (None, branch or [])
253 branch = (None, branch or [])
254 origsource = source = srcrepo.url()
254 origsource = source = srcrepo.url()
255 rev, checkout = addbranchrevs(srcrepo, srcrepo, branch, rev)
255 rev, checkout = addbranchrevs(srcrepo, srcrepo, branch, rev)
256
256
257 if dest is None:
257 if dest is None:
258 dest = defaultdest(source)
258 dest = defaultdest(source)
259 ui.status(_("destination directory: %s\n") % dest)
259 ui.status(_("destination directory: %s\n") % dest)
260 else:
260 else:
261 dest = ui.expandpath(dest)
261 dest = ui.expandpath(dest)
262
262
263 dest = util.urllocalpath(dest)
263 dest = util.urllocalpath(dest)
264 source = util.urllocalpath(source)
264 source = util.urllocalpath(source)
265
265
266 if os.path.exists(dest):
266 if os.path.exists(dest):
267 if not os.path.isdir(dest):
267 if not os.path.isdir(dest):
268 raise util.Abort(_("destination '%s' already exists") % dest)
268 raise util.Abort(_("destination '%s' already exists") % dest)
269 elif os.listdir(dest):
269 elif os.listdir(dest):
270 raise util.Abort(_("destination '%s' is not empty") % dest)
270 raise util.Abort(_("destination '%s' is not empty") % dest)
271
271
272 class DirCleanup(object):
272 class DirCleanup(object):
273 def __init__(self, dir_):
273 def __init__(self, dir_):
274 self.rmtree = shutil.rmtree
274 self.rmtree = shutil.rmtree
275 self.dir_ = dir_
275 self.dir_ = dir_
276 def close(self):
276 def close(self):
277 self.dir_ = None
277 self.dir_ = None
278 def cleanup(self):
278 def cleanup(self):
279 if self.dir_:
279 if self.dir_:
280 self.rmtree(self.dir_, True)
280 self.rmtree(self.dir_, True)
281
281
282 srclock = destlock = dircleanup = None
282 srclock = destlock = dircleanup = None
283 try:
283 try:
284 abspath = origsource
284 abspath = origsource
285 if islocal(origsource):
285 if islocal(origsource):
286 abspath = os.path.abspath(util.urllocalpath(origsource))
286 abspath = os.path.abspath(util.urllocalpath(origsource))
287
287
288 if islocal(dest):
288 if islocal(dest):
289 dircleanup = DirCleanup(dest)
289 dircleanup = DirCleanup(dest)
290
290
291 copy = False
291 copy = False
292 if srcrepo.cancopy() and islocal(dest):
292 if srcrepo.cancopy() and islocal(dest):
293 copy = not pull and not rev
293 copy = not pull and not rev
294
294
295 if copy:
295 if copy:
296 try:
296 try:
297 # we use a lock here because if we race with commit, we
297 # we use a lock here because if we race with commit, we
298 # can end up with extra data in the cloned revlogs that's
298 # can end up with extra data in the cloned revlogs that's
299 # not pointed to by changesets, thus causing verify to
299 # not pointed to by changesets, thus causing verify to
300 # fail
300 # fail
301 srclock = srcrepo.lock(wait=False)
301 srclock = srcrepo.lock(wait=False)
302 except error.LockError:
302 except error.LockError:
303 copy = False
303 copy = False
304
304
305 if copy:
305 if copy:
306 srcrepo.hook('preoutgoing', throw=True, source='clone')
306 srcrepo.hook('preoutgoing', throw=True, source='clone')
307 hgdir = os.path.realpath(os.path.join(dest, ".hg"))
307 hgdir = os.path.realpath(os.path.join(dest, ".hg"))
308 if not os.path.exists(dest):
308 if not os.path.exists(dest):
309 os.mkdir(dest)
309 os.mkdir(dest)
310 else:
310 else:
311 # only clean up directories we create ourselves
311 # only clean up directories we create ourselves
312 dircleanup.dir_ = hgdir
312 dircleanup.dir_ = hgdir
313 try:
313 try:
314 destpath = hgdir
314 destpath = hgdir
315 util.makedir(destpath, notindexed=True)
315 util.makedir(destpath, notindexed=True)
316 except OSError, inst:
316 except OSError, inst:
317 if inst.errno == errno.EEXIST:
317 if inst.errno == errno.EEXIST:
318 dircleanup.close()
318 dircleanup.close()
319 raise util.Abort(_("destination '%s' already exists")
319 raise util.Abort(_("destination '%s' already exists")
320 % dest)
320 % dest)
321 raise
321 raise
322
322
323 destlock = copystore(ui, srcrepo, destpath)
323 destlock = copystore(ui, srcrepo, destpath)
324
324
325 # we need to re-init the repo after manually copying the data
325 # we need to re-init the repo after manually copying the data
326 # into it
326 # into it
327 destrepo = repository(remoteui(ui, peeropts), dest)
327 destrepo = repository(remoteui(ui, peeropts), dest)
328 srcrepo.hook('outgoing', source='clone',
328 srcrepo.hook('outgoing', source='clone',
329 node=node.hex(node.nullid))
329 node=node.hex(node.nullid))
330 else:
330 else:
331 try:
331 try:
332 destrepo = repository(remoteui(ui, peeropts), dest,
332 destrepo = repository(remoteui(ui, peeropts), dest,
333 create=True)
333 create=True)
334 except OSError, inst:
334 except OSError, inst:
335 if inst.errno == errno.EEXIST:
335 if inst.errno == errno.EEXIST:
336 dircleanup.close()
336 dircleanup.close()
337 raise util.Abort(_("destination '%s' already exists")
337 raise util.Abort(_("destination '%s' already exists")
338 % dest)
338 % dest)
339 raise
339 raise
340
340
341 revs = None
341 revs = None
342 if rev:
342 if rev:
343 if not srcrepo.capable('lookup'):
343 if not srcrepo.capable('lookup'):
344 raise util.Abort(_("src repository does not support "
344 raise util.Abort(_("src repository does not support "
345 "revision lookup and so doesn't "
345 "revision lookup and so doesn't "
346 "support clone by revision"))
346 "support clone by revision"))
347 revs = [srcrepo.lookup(r) for r in rev]
347 revs = [srcrepo.lookup(r) for r in rev]
348 checkout = revs[0]
348 checkout = revs[0]
349 if destrepo.local():
349 if destrepo.local():
350 destrepo.clone(srcrepo, heads=revs, stream=stream)
350 destrepo.clone(srcrepo, heads=revs, stream=stream)
351 elif srcrepo.local():
351 elif srcrepo.local():
352 srcrepo.push(destrepo, revs=revs)
352 srcrepo.push(destrepo, revs=revs)
353 else:
353 else:
354 raise util.Abort(_("clone from remote to remote not supported"))
354 raise util.Abort(_("clone from remote to remote not supported"))
355
355
356 if dircleanup:
356 if dircleanup:
357 dircleanup.close()
357 dircleanup.close()
358
358
359 # clone all bookmarks
359 # clone all bookmarks
360 if destrepo.local() and srcrepo.capable("pushkey"):
360 if destrepo.local() and srcrepo.capable("pushkey"):
361 rb = srcrepo.listkeys('bookmarks')
361 rb = srcrepo.listkeys('bookmarks')
362 for k, n in rb.iteritems():
362 for k, n in rb.iteritems():
363 try:
363 try:
364 m = destrepo.lookup(n)
364 m = destrepo.lookup(n)
365 destrepo._bookmarks[k] = m
365 destrepo._bookmarks[k] = m
366 except error.RepoLookupError:
366 except error.RepoLookupError:
367 pass
367 pass
368 if rb:
368 if rb:
369 bookmarks.write(destrepo)
369 bookmarks.write(destrepo)
370 elif srcrepo.local() and destrepo.capable("pushkey"):
370 elif srcrepo.local() and destrepo.capable("pushkey"):
371 for k, n in srcrepo._bookmarks.iteritems():
371 for k, n in srcrepo._bookmarks.iteritems():
372 destrepo.pushkey('bookmarks', k, '', hex(n))
372 destrepo.pushkey('bookmarks', k, '', hex(n))
373
373
374 if destrepo.local():
374 if destrepo.local():
375 fp = destrepo.opener("hgrc", "w", text=True)
375 fp = destrepo.opener("hgrc", "w", text=True)
376 fp.write("[paths]\n")
376 fp.write("[paths]\n")
377 u = util.url(abspath)
377 u = util.url(abspath)
378 u.passwd = None
378 u.passwd = None
379 defaulturl = str(u)
379 defaulturl = str(u)
380 fp.write("default = %s\n" % defaulturl)
380 fp.write("default = %s\n" % defaulturl)
381 fp.close()
381 fp.close()
382
382
383 destrepo.ui.setconfig('paths', 'default', defaulturl)
383 destrepo.ui.setconfig('paths', 'default', defaulturl)
384
384
385 if update:
385 if update:
386 if update is not True:
386 if update is not True:
387 checkout = update
387 checkout = update
388 if srcrepo.local():
388 if srcrepo.local():
389 checkout = srcrepo.lookup(update)
389 checkout = srcrepo.lookup(update)
390 for test in (checkout, 'default', 'tip'):
390 for test in (checkout, 'default', 'tip'):
391 if test is None:
391 if test is None:
392 continue
392 continue
393 try:
393 try:
394 uprev = destrepo.lookup(test)
394 uprev = destrepo.lookup(test)
395 break
395 break
396 except error.RepoLookupError:
396 except error.RepoLookupError:
397 continue
397 continue
398 bn = destrepo[uprev].branch()
398 bn = destrepo[uprev].branch()
399 destrepo.ui.status(_("updating to branch %s\n") % bn)
399 destrepo.ui.status(_("updating to branch %s\n") % bn)
400 _update(destrepo, uprev)
400 _update(destrepo, uprev)
401
401
402 return srcrepo, destrepo
402 return srcrepo, destrepo
403 finally:
403 finally:
404 release(srclock, destlock)
404 release(srclock, destlock)
405 if dircleanup is not None:
405 if dircleanup is not None:
406 dircleanup.cleanup()
406 dircleanup.cleanup()
407
407
408 def _showstats(repo, stats):
408 def _showstats(repo, stats):
409 repo.ui.status(_("%d files updated, %d files merged, "
409 repo.ui.status(_("%d files updated, %d files merged, "
410 "%d files removed, %d files unresolved\n") % stats)
410 "%d files removed, %d files unresolved\n") % stats)
411
411
412 def update(repo, node):
412 def update(repo, node):
413 """update the working directory to node, merging linear changes"""
413 """update the working directory to node, merging linear changes"""
414 stats = mergemod.update(repo, node, False, False, None)
414 stats = mergemod.update(repo, node, False, False, None)
415 _showstats(repo, stats)
415 _showstats(repo, stats)
416 if stats[3]:
416 if stats[3]:
417 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n"))
417 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n"))
418 return stats[3] > 0
418 return stats[3] > 0
419
419
420 # naming conflict in clone()
420 # naming conflict in clone()
421 _update = update
421 _update = update
422
422
423 def clean(repo, node, show_stats=True):
423 def clean(repo, node, show_stats=True):
424 """forcibly switch the working directory to node, clobbering changes"""
424 """forcibly switch the working directory to node, clobbering changes"""
425 stats = mergemod.update(repo, node, False, True, None)
425 stats = mergemod.update(repo, node, False, True, None)
426 if show_stats:
426 if show_stats:
427 _showstats(repo, stats)
427 _showstats(repo, stats)
428 return stats[3] > 0
428 return stats[3] > 0
429
429
430 def merge(repo, node, force=None, remind=True):
430 def merge(repo, node, force=None, remind=True):
431 """Branch merge with node, resolving changes. Return true if any
431 """Branch merge with node, resolving changes. Return true if any
432 unresolved conflicts."""
432 unresolved conflicts."""
433 stats = mergemod.update(repo, node, True, force, False)
433 stats = mergemod.update(repo, node, True, force, False)
434 _showstats(repo, stats)
434 _showstats(repo, stats)
435 if stats[3]:
435 if stats[3]:
436 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
436 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
437 "or 'hg update -C .' to abandon\n"))
437 "or 'hg update -C .' to abandon\n"))
438 elif remind:
438 elif remind:
439 repo.ui.status(_("(branch merge, don't forget to commit)\n"))
439 repo.ui.status(_("(branch merge, don't forget to commit)\n"))
440 return stats[3] > 0
440 return stats[3] > 0
441
441
442 def _incoming(displaychlist, subreporecurse, ui, repo, source,
442 def _incoming(displaychlist, subreporecurse, ui, repo, source,
443 opts, buffered=False):
443 opts, buffered=False):
444 """
444 """
445 Helper for incoming / gincoming.
445 Helper for incoming / gincoming.
446 displaychlist gets called with
446 displaychlist gets called with
447 (remoterepo, incomingchangesetlist, displayer) parameters,
447 (remoterepo, incomingchangesetlist, displayer) parameters,
448 and is supposed to contain only code that can't be unified.
448 and is supposed to contain only code that can't be unified.
449 """
449 """
450 source, branches = parseurl(ui.expandpath(source), opts.get('branch'))
450 source, branches = parseurl(ui.expandpath(source), opts.get('branch'))
451 other = peer(repo, opts, source)
451 other = peer(repo, opts, source)
452 ui.status(_('comparing with %s\n') % util.hidepassword(source))
452 ui.status(_('comparing with %s\n') % util.hidepassword(source))
453 revs, checkout = addbranchrevs(repo, other, branches, opts.get('rev'))
453 revs, checkout = addbranchrevs(repo, other, branches, opts.get('rev'))
454
454
455 if revs:
455 if revs:
456 revs = [other.lookup(rev) for rev in revs]
456 revs = [other.lookup(rev) for rev in revs]
457 other, chlist, cleanupfn = bundlerepo.getremotechanges(ui, repo, other,
457 other, chlist, cleanupfn = bundlerepo.getremotechanges(ui, repo, other,
458 revs, opts["bundle"], opts["force"])
458 revs, opts["bundle"], opts["force"])
459 try:
459 try:
460 if not chlist:
460 if not chlist:
461 ui.status(_("no changes found\n"))
461 ui.status(_("no changes found\n"))
462 return subreporecurse()
462 return subreporecurse()
463
463
464 displayer = cmdutil.show_changeset(ui, other, opts, buffered)
464 displayer = cmdutil.show_changeset(ui, other, opts, buffered)
465
465
466 # XXX once graphlog extension makes it into core,
466 # XXX once graphlog extension makes it into core,
467 # should be replaced by a if graph/else
467 # should be replaced by a if graph/else
468 displaychlist(other, chlist, displayer)
468 displaychlist(other, chlist, displayer)
469
469
470 displayer.close()
470 displayer.close()
471 finally:
471 finally:
472 cleanupfn()
472 cleanupfn()
473 subreporecurse()
473 subreporecurse()
474 return 0 # exit code is zero since we found incoming changes
474 return 0 # exit code is zero since we found incoming changes
475
475
476 def incoming(ui, repo, source, opts):
476 def incoming(ui, repo, source, opts):
477 def subreporecurse():
477 def subreporecurse():
478 ret = 1
478 ret = 1
479 if opts.get('subrepos'):
479 if opts.get('subrepos'):
480 ctx = repo[None]
480 ctx = repo[None]
481 for subpath in sorted(ctx.substate):
481 for subpath in sorted(ctx.substate):
482 sub = ctx.sub(subpath)
482 sub = ctx.sub(subpath)
483 ret = min(ret, sub.incoming(ui, source, opts))
483 ret = min(ret, sub.incoming(ui, source, opts))
484 return ret
484 return ret
485
485
486 def display(other, chlist, displayer):
486 def display(other, chlist, displayer):
487 limit = cmdutil.loglimit(opts)
487 limit = cmdutil.loglimit(opts)
488 if opts.get('newest_first'):
488 if opts.get('newest_first'):
489 chlist.reverse()
489 chlist.reverse()
490 count = 0
490 count = 0
491 for n in chlist:
491 for n in chlist:
492 if limit is not None and count >= limit:
492 if limit is not None and count >= limit:
493 break
493 break
494 parents = [p for p in other.changelog.parents(n) if p != nullid]
494 parents = [p for p in other.changelog.parents(n) if p != nullid]
495 if opts.get('no_merges') and len(parents) == 2:
495 if opts.get('no_merges') and len(parents) == 2:
496 continue
496 continue
497 count += 1
497 count += 1
498 displayer.show(other[n])
498 displayer.show(other[n])
499 return _incoming(display, subreporecurse, ui, repo, source, opts)
499 return _incoming(display, subreporecurse, ui, repo, source, opts)
500
500
501 def _outgoing(ui, repo, dest, opts):
501 def _outgoing(ui, repo, dest, opts):
502 dest = ui.expandpath(dest or 'default-push', dest or 'default')
502 dest = ui.expandpath(dest or 'default-push', dest or 'default')
503 dest, branches = parseurl(dest, opts.get('branch'))
503 dest, branches = parseurl(dest, opts.get('branch'))
504 ui.status(_('comparing with %s\n') % util.hidepassword(dest))
504 ui.status(_('comparing with %s\n') % util.hidepassword(dest))
505 revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev'))
505 revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev'))
506 if revs:
506 if revs:
507 revs = [repo.lookup(rev) for rev in revs]
507 revs = [repo.lookup(rev) for rev in revs]
508
508
509 other = peer(repo, opts, dest)
509 other = peer(repo, opts, dest)
510 outgoing = discovery.findcommonoutgoing(repo, other, revs,
510 outgoing = discovery.findcommonoutgoing(repo, other, revs,
511 force=opts.get('force'))
511 force=opts.get('force'))
512 o = outgoing.missing
512 o = outgoing.missing
513 if not o:
513 if not o:
514 ui.status(_("no changes found\n"))
514 if outgoing.excluded:
515 repo.ui.status(_("no outgoing changes but %i secret changesets\n")
516 % len(outgoing.excluded))
517 else:
518 ui.status(_("no changes found\n"))
515 return None
519 return None
516 return o
520 return o
517
521
518 def outgoing(ui, repo, dest, opts):
522 def outgoing(ui, repo, dest, opts):
519 def recurse():
523 def recurse():
520 ret = 1
524 ret = 1
521 if opts.get('subrepos'):
525 if opts.get('subrepos'):
522 ctx = repo[None]
526 ctx = repo[None]
523 for subpath in sorted(ctx.substate):
527 for subpath in sorted(ctx.substate):
524 sub = ctx.sub(subpath)
528 sub = ctx.sub(subpath)
525 ret = min(ret, sub.outgoing(ui, dest, opts))
529 ret = min(ret, sub.outgoing(ui, dest, opts))
526 return ret
530 return ret
527
531
528 limit = cmdutil.loglimit(opts)
532 limit = cmdutil.loglimit(opts)
529 o = _outgoing(ui, repo, dest, opts)
533 o = _outgoing(ui, repo, dest, opts)
530 if o is None:
534 if o is None:
531 return recurse()
535 return recurse()
532
536
533 if opts.get('newest_first'):
537 if opts.get('newest_first'):
534 o.reverse()
538 o.reverse()
535 displayer = cmdutil.show_changeset(ui, repo, opts)
539 displayer = cmdutil.show_changeset(ui, repo, opts)
536 count = 0
540 count = 0
537 for n in o:
541 for n in o:
538 if limit is not None and count >= limit:
542 if limit is not None and count >= limit:
539 break
543 break
540 parents = [p for p in repo.changelog.parents(n) if p != nullid]
544 parents = [p for p in repo.changelog.parents(n) if p != nullid]
541 if opts.get('no_merges') and len(parents) == 2:
545 if opts.get('no_merges') and len(parents) == 2:
542 continue
546 continue
543 count += 1
547 count += 1
544 displayer.show(repo[n])
548 displayer.show(repo[n])
545 displayer.close()
549 displayer.close()
546 recurse()
550 recurse()
547 return 0 # exit code is zero since we found outgoing changes
551 return 0 # exit code is zero since we found outgoing changes
548
552
549 def revert(repo, node, choose):
553 def revert(repo, node, choose):
550 """revert changes to revision in node without updating dirstate"""
554 """revert changes to revision in node without updating dirstate"""
551 return mergemod.update(repo, node, False, True, choose)[3] > 0
555 return mergemod.update(repo, node, False, True, choose)[3] > 0
552
556
553 def verify(repo):
557 def verify(repo):
554 """verify the consistency of a repository"""
558 """verify the consistency of a repository"""
555 return verifymod.verify(repo)
559 return verifymod.verify(repo)
556
560
557 def remoteui(src, opts):
561 def remoteui(src, opts):
558 'build a remote ui from ui or repo and opts'
562 'build a remote ui from ui or repo and opts'
559 if util.safehasattr(src, 'baseui'): # looks like a repository
563 if util.safehasattr(src, 'baseui'): # looks like a repository
560 dst = src.baseui.copy() # drop repo-specific config
564 dst = src.baseui.copy() # drop repo-specific config
561 src = src.ui # copy target options from repo
565 src = src.ui # copy target options from repo
562 else: # assume it's a global ui object
566 else: # assume it's a global ui object
563 dst = src.copy() # keep all global options
567 dst = src.copy() # keep all global options
564
568
565 # copy ssh-specific options
569 # copy ssh-specific options
566 for o in 'ssh', 'remotecmd':
570 for o in 'ssh', 'remotecmd':
567 v = opts.get(o) or src.config('ui', o)
571 v = opts.get(o) or src.config('ui', o)
568 if v:
572 if v:
569 dst.setconfig("ui", o, v)
573 dst.setconfig("ui", o, v)
570
574
571 # copy bundle-specific options
575 # copy bundle-specific options
572 r = src.config('bundle', 'mainreporoot')
576 r = src.config('bundle', 'mainreporoot')
573 if r:
577 if r:
574 dst.setconfig('bundle', 'mainreporoot', r)
578 dst.setconfig('bundle', 'mainreporoot', r)
575
579
576 # copy selected local settings to the remote ui
580 # copy selected local settings to the remote ui
577 for sect in ('auth', 'hostfingerprints', 'http_proxy'):
581 for sect in ('auth', 'hostfingerprints', 'http_proxy'):
578 for key, val in src.configitems(sect):
582 for key, val in src.configitems(sect):
579 dst.setconfig(sect, key, val)
583 dst.setconfig(sect, key, val)
580 v = src.config('web', 'cacerts')
584 v = src.config('web', 'cacerts')
581 if v:
585 if v:
582 dst.setconfig('web', 'cacerts', util.expandpath(v))
586 dst.setconfig('web', 'cacerts', util.expandpath(v))
583
587
584 return dst
588 return dst
@@ -1,482 +1,491
1 $ "$TESTDIR/hghave" serve || exit 80
1 $ "$TESTDIR/hghave" serve || exit 80
2
2
3 $ hg init test
3 $ hg init test
4 $ cd test
4 $ cd test
5 $ for i in 0 1 2 3 4 5 6 7 8; do
5 $ for i in 0 1 2 3 4 5 6 7 8; do
6 > echo $i >> foo
6 > echo $i >> foo
7 > hg commit -A -m $i
7 > hg commit -A -m $i
8 > done
8 > done
9 adding foo
9 adding foo
10 $ hg verify
10 $ hg verify
11 checking changesets
11 checking changesets
12 checking manifests
12 checking manifests
13 crosschecking files in changesets and manifests
13 crosschecking files in changesets and manifests
14 checking files
14 checking files
15 1 files, 9 changesets, 9 total revisions
15 1 files, 9 changesets, 9 total revisions
16 $ hg serve -p $HGPORT -d --pid-file=hg.pid
16 $ hg serve -p $HGPORT -d --pid-file=hg.pid
17 $ cat hg.pid >> $DAEMON_PIDS
17 $ cat hg.pid >> $DAEMON_PIDS
18 $ cd ..
18 $ cd ..
19
19
20 $ hg init new
20 $ hg init new
21
21
22 http incoming
22 http incoming
23
23
24 $ hg -R new incoming http://localhost:$HGPORT/
24 $ hg -R new incoming http://localhost:$HGPORT/
25 comparing with http://localhost:$HGPORT/
25 comparing with http://localhost:$HGPORT/
26 changeset: 0:00a43fa82f62
26 changeset: 0:00a43fa82f62
27 user: test
27 user: test
28 date: Thu Jan 01 00:00:00 1970 +0000
28 date: Thu Jan 01 00:00:00 1970 +0000
29 summary: 0
29 summary: 0
30
30
31 changeset: 1:5460a410df01
31 changeset: 1:5460a410df01
32 user: test
32 user: test
33 date: Thu Jan 01 00:00:00 1970 +0000
33 date: Thu Jan 01 00:00:00 1970 +0000
34 summary: 1
34 summary: 1
35
35
36 changeset: 2:d9f42cd1a1ec
36 changeset: 2:d9f42cd1a1ec
37 user: test
37 user: test
38 date: Thu Jan 01 00:00:00 1970 +0000
38 date: Thu Jan 01 00:00:00 1970 +0000
39 summary: 2
39 summary: 2
40
40
41 changeset: 3:376476025137
41 changeset: 3:376476025137
42 user: test
42 user: test
43 date: Thu Jan 01 00:00:00 1970 +0000
43 date: Thu Jan 01 00:00:00 1970 +0000
44 summary: 3
44 summary: 3
45
45
46 changeset: 4:70d7eb252d49
46 changeset: 4:70d7eb252d49
47 user: test
47 user: test
48 date: Thu Jan 01 00:00:00 1970 +0000
48 date: Thu Jan 01 00:00:00 1970 +0000
49 summary: 4
49 summary: 4
50
50
51 changeset: 5:ad284ee3b5ee
51 changeset: 5:ad284ee3b5ee
52 user: test
52 user: test
53 date: Thu Jan 01 00:00:00 1970 +0000
53 date: Thu Jan 01 00:00:00 1970 +0000
54 summary: 5
54 summary: 5
55
55
56 changeset: 6:e9229f2de384
56 changeset: 6:e9229f2de384
57 user: test
57 user: test
58 date: Thu Jan 01 00:00:00 1970 +0000
58 date: Thu Jan 01 00:00:00 1970 +0000
59 summary: 6
59 summary: 6
60
60
61 changeset: 7:d152815bb8db
61 changeset: 7:d152815bb8db
62 user: test
62 user: test
63 date: Thu Jan 01 00:00:00 1970 +0000
63 date: Thu Jan 01 00:00:00 1970 +0000
64 summary: 7
64 summary: 7
65
65
66 changeset: 8:e4feb4ac9035
66 changeset: 8:e4feb4ac9035
67 tag: tip
67 tag: tip
68 user: test
68 user: test
69 date: Thu Jan 01 00:00:00 1970 +0000
69 date: Thu Jan 01 00:00:00 1970 +0000
70 summary: 8
70 summary: 8
71
71
72 $ hg -R new incoming -r 4 http://localhost:$HGPORT/
72 $ hg -R new incoming -r 4 http://localhost:$HGPORT/
73 comparing with http://localhost:$HGPORT/
73 comparing with http://localhost:$HGPORT/
74 changeset: 0:00a43fa82f62
74 changeset: 0:00a43fa82f62
75 user: test
75 user: test
76 date: Thu Jan 01 00:00:00 1970 +0000
76 date: Thu Jan 01 00:00:00 1970 +0000
77 summary: 0
77 summary: 0
78
78
79 changeset: 1:5460a410df01
79 changeset: 1:5460a410df01
80 user: test
80 user: test
81 date: Thu Jan 01 00:00:00 1970 +0000
81 date: Thu Jan 01 00:00:00 1970 +0000
82 summary: 1
82 summary: 1
83
83
84 changeset: 2:d9f42cd1a1ec
84 changeset: 2:d9f42cd1a1ec
85 user: test
85 user: test
86 date: Thu Jan 01 00:00:00 1970 +0000
86 date: Thu Jan 01 00:00:00 1970 +0000
87 summary: 2
87 summary: 2
88
88
89 changeset: 3:376476025137
89 changeset: 3:376476025137
90 user: test
90 user: test
91 date: Thu Jan 01 00:00:00 1970 +0000
91 date: Thu Jan 01 00:00:00 1970 +0000
92 summary: 3
92 summary: 3
93
93
94 changeset: 4:70d7eb252d49
94 changeset: 4:70d7eb252d49
95 tag: tip
95 tag: tip
96 user: test
96 user: test
97 date: Thu Jan 01 00:00:00 1970 +0000
97 date: Thu Jan 01 00:00:00 1970 +0000
98 summary: 4
98 summary: 4
99
99
100
100
101 local incoming
101 local incoming
102
102
103 $ hg -R new incoming test
103 $ hg -R new incoming test
104 comparing with test
104 comparing with test
105 changeset: 0:00a43fa82f62
105 changeset: 0:00a43fa82f62
106 user: test
106 user: test
107 date: Thu Jan 01 00:00:00 1970 +0000
107 date: Thu Jan 01 00:00:00 1970 +0000
108 summary: 0
108 summary: 0
109
109
110 changeset: 1:5460a410df01
110 changeset: 1:5460a410df01
111 user: test
111 user: test
112 date: Thu Jan 01 00:00:00 1970 +0000
112 date: Thu Jan 01 00:00:00 1970 +0000
113 summary: 1
113 summary: 1
114
114
115 changeset: 2:d9f42cd1a1ec
115 changeset: 2:d9f42cd1a1ec
116 user: test
116 user: test
117 date: Thu Jan 01 00:00:00 1970 +0000
117 date: Thu Jan 01 00:00:00 1970 +0000
118 summary: 2
118 summary: 2
119
119
120 changeset: 3:376476025137
120 changeset: 3:376476025137
121 user: test
121 user: test
122 date: Thu Jan 01 00:00:00 1970 +0000
122 date: Thu Jan 01 00:00:00 1970 +0000
123 summary: 3
123 summary: 3
124
124
125 changeset: 4:70d7eb252d49
125 changeset: 4:70d7eb252d49
126 user: test
126 user: test
127 date: Thu Jan 01 00:00:00 1970 +0000
127 date: Thu Jan 01 00:00:00 1970 +0000
128 summary: 4
128 summary: 4
129
129
130 changeset: 5:ad284ee3b5ee
130 changeset: 5:ad284ee3b5ee
131 user: test
131 user: test
132 date: Thu Jan 01 00:00:00 1970 +0000
132 date: Thu Jan 01 00:00:00 1970 +0000
133 summary: 5
133 summary: 5
134
134
135 changeset: 6:e9229f2de384
135 changeset: 6:e9229f2de384
136 user: test
136 user: test
137 date: Thu Jan 01 00:00:00 1970 +0000
137 date: Thu Jan 01 00:00:00 1970 +0000
138 summary: 6
138 summary: 6
139
139
140 changeset: 7:d152815bb8db
140 changeset: 7:d152815bb8db
141 user: test
141 user: test
142 date: Thu Jan 01 00:00:00 1970 +0000
142 date: Thu Jan 01 00:00:00 1970 +0000
143 summary: 7
143 summary: 7
144
144
145 changeset: 8:e4feb4ac9035
145 changeset: 8:e4feb4ac9035
146 tag: tip
146 tag: tip
147 user: test
147 user: test
148 date: Thu Jan 01 00:00:00 1970 +0000
148 date: Thu Jan 01 00:00:00 1970 +0000
149 summary: 8
149 summary: 8
150
150
151 $ hg -R new incoming -r 4 test
151 $ hg -R new incoming -r 4 test
152 comparing with test
152 comparing with test
153 changeset: 0:00a43fa82f62
153 changeset: 0:00a43fa82f62
154 user: test
154 user: test
155 date: Thu Jan 01 00:00:00 1970 +0000
155 date: Thu Jan 01 00:00:00 1970 +0000
156 summary: 0
156 summary: 0
157
157
158 changeset: 1:5460a410df01
158 changeset: 1:5460a410df01
159 user: test
159 user: test
160 date: Thu Jan 01 00:00:00 1970 +0000
160 date: Thu Jan 01 00:00:00 1970 +0000
161 summary: 1
161 summary: 1
162
162
163 changeset: 2:d9f42cd1a1ec
163 changeset: 2:d9f42cd1a1ec
164 user: test
164 user: test
165 date: Thu Jan 01 00:00:00 1970 +0000
165 date: Thu Jan 01 00:00:00 1970 +0000
166 summary: 2
166 summary: 2
167
167
168 changeset: 3:376476025137
168 changeset: 3:376476025137
169 user: test
169 user: test
170 date: Thu Jan 01 00:00:00 1970 +0000
170 date: Thu Jan 01 00:00:00 1970 +0000
171 summary: 3
171 summary: 3
172
172
173 changeset: 4:70d7eb252d49
173 changeset: 4:70d7eb252d49
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: 4
176 summary: 4
177
177
178
178
179 limit to 2 changesets
179 limit to 2 changesets
180
180
181 $ hg -R new incoming -l 2 test
181 $ hg -R new incoming -l 2 test
182 comparing with test
182 comparing with test
183 changeset: 0:00a43fa82f62
183 changeset: 0:00a43fa82f62
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: 0
186 summary: 0
187
187
188 changeset: 1:5460a410df01
188 changeset: 1:5460a410df01
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: 1
191 summary: 1
192
192
193
193
194 limit to 2 changesets, test with -p --git
194 limit to 2 changesets, test with -p --git
195
195
196 $ hg -R new incoming -l 2 -p --git test
196 $ hg -R new incoming -l 2 -p --git test
197 comparing with test
197 comparing with test
198 changeset: 0:00a43fa82f62
198 changeset: 0:00a43fa82f62
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
201 summary: 0
202
202
203 diff --git a/foo b/foo
203 diff --git a/foo b/foo
204 new file mode 100644
204 new file mode 100644
205 --- /dev/null
205 --- /dev/null
206 +++ b/foo
206 +++ b/foo
207 @@ -0,0 +1,1 @@
207 @@ -0,0 +1,1 @@
208 +0
208 +0
209
209
210 changeset: 1:5460a410df01
210 changeset: 1:5460a410df01
211 user: test
211 user: test
212 date: Thu Jan 01 00:00:00 1970 +0000
212 date: Thu Jan 01 00:00:00 1970 +0000
213 summary: 1
213 summary: 1
214
214
215 diff --git a/foo b/foo
215 diff --git a/foo b/foo
216 --- a/foo
216 --- a/foo
217 +++ b/foo
217 +++ b/foo
218 @@ -1,1 +1,2 @@
218 @@ -1,1 +1,2 @@
219 0
219 0
220 +1
220 +1
221
221
222
222
223 test with --bundle
223 test with --bundle
224
224
225 $ hg -R new incoming --bundle test.hg http://localhost:$HGPORT/
225 $ hg -R new incoming --bundle test.hg http://localhost:$HGPORT/
226 comparing with http://localhost:$HGPORT/
226 comparing with http://localhost:$HGPORT/
227 changeset: 0:00a43fa82f62
227 changeset: 0:00a43fa82f62
228 user: test
228 user: test
229 date: Thu Jan 01 00:00:00 1970 +0000
229 date: Thu Jan 01 00:00:00 1970 +0000
230 summary: 0
230 summary: 0
231
231
232 changeset: 1:5460a410df01
232 changeset: 1:5460a410df01
233 user: test
233 user: test
234 date: Thu Jan 01 00:00:00 1970 +0000
234 date: Thu Jan 01 00:00:00 1970 +0000
235 summary: 1
235 summary: 1
236
236
237 changeset: 2:d9f42cd1a1ec
237 changeset: 2:d9f42cd1a1ec
238 user: test
238 user: test
239 date: Thu Jan 01 00:00:00 1970 +0000
239 date: Thu Jan 01 00:00:00 1970 +0000
240 summary: 2
240 summary: 2
241
241
242 changeset: 3:376476025137
242 changeset: 3:376476025137
243 user: test
243 user: test
244 date: Thu Jan 01 00:00:00 1970 +0000
244 date: Thu Jan 01 00:00:00 1970 +0000
245 summary: 3
245 summary: 3
246
246
247 changeset: 4:70d7eb252d49
247 changeset: 4:70d7eb252d49
248 user: test
248 user: test
249 date: Thu Jan 01 00:00:00 1970 +0000
249 date: Thu Jan 01 00:00:00 1970 +0000
250 summary: 4
250 summary: 4
251
251
252 changeset: 5:ad284ee3b5ee
252 changeset: 5:ad284ee3b5ee
253 user: test
253 user: test
254 date: Thu Jan 01 00:00:00 1970 +0000
254 date: Thu Jan 01 00:00:00 1970 +0000
255 summary: 5
255 summary: 5
256
256
257 changeset: 6:e9229f2de384
257 changeset: 6:e9229f2de384
258 user: test
258 user: test
259 date: Thu Jan 01 00:00:00 1970 +0000
259 date: Thu Jan 01 00:00:00 1970 +0000
260 summary: 6
260 summary: 6
261
261
262 changeset: 7:d152815bb8db
262 changeset: 7:d152815bb8db
263 user: test
263 user: test
264 date: Thu Jan 01 00:00:00 1970 +0000
264 date: Thu Jan 01 00:00:00 1970 +0000
265 summary: 7
265 summary: 7
266
266
267 changeset: 8:e4feb4ac9035
267 changeset: 8:e4feb4ac9035
268 tag: tip
268 tag: tip
269 user: test
269 user: test
270 date: Thu Jan 01 00:00:00 1970 +0000
270 date: Thu Jan 01 00:00:00 1970 +0000
271 summary: 8
271 summary: 8
272
272
273 $ hg -R new incoming --bundle test2.hg test
273 $ hg -R new incoming --bundle test2.hg test
274 comparing with test
274 comparing with test
275 changeset: 0:00a43fa82f62
275 changeset: 0:00a43fa82f62
276 user: test
276 user: test
277 date: Thu Jan 01 00:00:00 1970 +0000
277 date: Thu Jan 01 00:00:00 1970 +0000
278 summary: 0
278 summary: 0
279
279
280 changeset: 1:5460a410df01
280 changeset: 1:5460a410df01
281 user: test
281 user: test
282 date: Thu Jan 01 00:00:00 1970 +0000
282 date: Thu Jan 01 00:00:00 1970 +0000
283 summary: 1
283 summary: 1
284
284
285 changeset: 2:d9f42cd1a1ec
285 changeset: 2:d9f42cd1a1ec
286 user: test
286 user: test
287 date: Thu Jan 01 00:00:00 1970 +0000
287 date: Thu Jan 01 00:00:00 1970 +0000
288 summary: 2
288 summary: 2
289
289
290 changeset: 3:376476025137
290 changeset: 3:376476025137
291 user: test
291 user: test
292 date: Thu Jan 01 00:00:00 1970 +0000
292 date: Thu Jan 01 00:00:00 1970 +0000
293 summary: 3
293 summary: 3
294
294
295 changeset: 4:70d7eb252d49
295 changeset: 4:70d7eb252d49
296 user: test
296 user: test
297 date: Thu Jan 01 00:00:00 1970 +0000
297 date: Thu Jan 01 00:00:00 1970 +0000
298 summary: 4
298 summary: 4
299
299
300 changeset: 5:ad284ee3b5ee
300 changeset: 5:ad284ee3b5ee
301 user: test
301 user: test
302 date: Thu Jan 01 00:00:00 1970 +0000
302 date: Thu Jan 01 00:00:00 1970 +0000
303 summary: 5
303 summary: 5
304
304
305 changeset: 6:e9229f2de384
305 changeset: 6:e9229f2de384
306 user: test
306 user: test
307 date: Thu Jan 01 00:00:00 1970 +0000
307 date: Thu Jan 01 00:00:00 1970 +0000
308 summary: 6
308 summary: 6
309
309
310 changeset: 7:d152815bb8db
310 changeset: 7:d152815bb8db
311 user: test
311 user: test
312 date: Thu Jan 01 00:00:00 1970 +0000
312 date: Thu Jan 01 00:00:00 1970 +0000
313 summary: 7
313 summary: 7
314
314
315 changeset: 8:e4feb4ac9035
315 changeset: 8:e4feb4ac9035
316 tag: tip
316 tag: tip
317 user: test
317 user: test
318 date: Thu Jan 01 00:00:00 1970 +0000
318 date: Thu Jan 01 00:00:00 1970 +0000
319 summary: 8
319 summary: 8
320
320
321
321
322
322
323 test the resulting bundles
323 test the resulting bundles
324
324
325 $ hg init temp
325 $ hg init temp
326 $ hg init temp2
326 $ hg init temp2
327 $ hg -R temp unbundle test.hg
327 $ hg -R temp unbundle test.hg
328 adding changesets
328 adding changesets
329 adding manifests
329 adding manifests
330 adding file changes
330 adding file changes
331 added 9 changesets with 9 changes to 1 files
331 added 9 changesets with 9 changes to 1 files
332 (run 'hg update' to get a working copy)
332 (run 'hg update' to get a working copy)
333 $ hg -R temp2 unbundle test2.hg
333 $ hg -R temp2 unbundle test2.hg
334 adding changesets
334 adding changesets
335 adding manifests
335 adding manifests
336 adding file changes
336 adding file changes
337 added 9 changesets with 9 changes to 1 files
337 added 9 changesets with 9 changes to 1 files
338 (run 'hg update' to get a working copy)
338 (run 'hg update' to get a working copy)
339 $ hg -R temp tip
339 $ hg -R temp tip
340 changeset: 8:e4feb4ac9035
340 changeset: 8:e4feb4ac9035
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: 8
344 summary: 8
345
345
346 $ hg -R temp2 tip
346 $ hg -R temp2 tip
347 changeset: 8:e4feb4ac9035
347 changeset: 8:e4feb4ac9035
348 tag: tip
348 tag: tip
349 user: test
349 user: test
350 date: Thu Jan 01 00:00:00 1970 +0000
350 date: Thu Jan 01 00:00:00 1970 +0000
351 summary: 8
351 summary: 8
352
352
353
353
354 $ rm -r temp temp2 new
354 $ rm -r temp temp2 new
355
355
356 test outgoing
356 test outgoing
357
357
358 $ hg clone test test-dev
358 $ hg clone test test-dev
359 updating to branch default
359 updating to branch default
360 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
360 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
361 $ cd test-dev
361 $ cd test-dev
362 $ for i in 9 10 11 12 13; do
362 $ for i in 9 10 11 12 13; do
363 > echo $i >> foo
363 > echo $i >> foo
364 > hg commit -A -m $i
364 > hg commit -A -m $i
365 > done
365 > done
366 $ hg verify
366 $ hg verify
367 checking changesets
367 checking changesets
368 checking manifests
368 checking manifests
369 crosschecking files in changesets and manifests
369 crosschecking files in changesets and manifests
370 checking files
370 checking files
371 1 files, 14 changesets, 14 total revisions
371 1 files, 14 changesets, 14 total revisions
372 $ cd ..
372 $ cd ..
373 $ hg -R test-dev outgoing test
373 $ hg -R test-dev outgoing test
374 comparing with test
374 comparing with test
375 searching for changes
375 searching for changes
376 changeset: 9:d89d4abea5bc
376 changeset: 9:d89d4abea5bc
377 user: test
377 user: test
378 date: Thu Jan 01 00:00:00 1970 +0000
378 date: Thu Jan 01 00:00:00 1970 +0000
379 summary: 9
379 summary: 9
380
380
381 changeset: 10:820095aa7158
381 changeset: 10:820095aa7158
382 user: test
382 user: test
383 date: Thu Jan 01 00:00:00 1970 +0000
383 date: Thu Jan 01 00:00:00 1970 +0000
384 summary: 10
384 summary: 10
385
385
386 changeset: 11:09ede2f3a638
386 changeset: 11:09ede2f3a638
387 user: test
387 user: test
388 date: Thu Jan 01 00:00:00 1970 +0000
388 date: Thu Jan 01 00:00:00 1970 +0000
389 summary: 11
389 summary: 11
390
390
391 changeset: 12:e576b1bed305
391 changeset: 12:e576b1bed305
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: 12
394 summary: 12
395
395
396 changeset: 13:96bbff09a7cc
396 changeset: 13:96bbff09a7cc
397 tag: tip
397 tag: tip
398 user: test
398 user: test
399 date: Thu Jan 01 00:00:00 1970 +0000
399 date: Thu Jan 01 00:00:00 1970 +0000
400 summary: 13
400 summary: 13
401
401
402 test outgoing with secret changesets
403
404 $ hg -R test-dev phase --force --secret 9
405 $ hg -R test-dev outgoing test
406 comparing with test
407 searching for changes
408 no outgoing changes but 5 secret changesets
409 [1]
410 $ hg -R test-dev phase --draft -r 'head()'
402
411
403 limit to 3 changesets
412 limit to 3 changesets
404
413
405 $ hg -R test-dev outgoing -l 3 test
414 $ hg -R test-dev outgoing -l 3 test
406 comparing with test
415 comparing with test
407 searching for changes
416 searching for changes
408 changeset: 9:d89d4abea5bc
417 changeset: 9:d89d4abea5bc
409 user: test
418 user: test
410 date: Thu Jan 01 00:00:00 1970 +0000
419 date: Thu Jan 01 00:00:00 1970 +0000
411 summary: 9
420 summary: 9
412
421
413 changeset: 10:820095aa7158
422 changeset: 10:820095aa7158
414 user: test
423 user: test
415 date: Thu Jan 01 00:00:00 1970 +0000
424 date: Thu Jan 01 00:00:00 1970 +0000
416 summary: 10
425 summary: 10
417
426
418 changeset: 11:09ede2f3a638
427 changeset: 11:09ede2f3a638
419 user: test
428 user: test
420 date: Thu Jan 01 00:00:00 1970 +0000
429 date: Thu Jan 01 00:00:00 1970 +0000
421 summary: 11
430 summary: 11
422
431
423 $ hg -R test-dev outgoing http://localhost:$HGPORT/
432 $ hg -R test-dev outgoing http://localhost:$HGPORT/
424 comparing with http://localhost:$HGPORT/
433 comparing with http://localhost:$HGPORT/
425 searching for changes
434 searching for changes
426 changeset: 9:d89d4abea5bc
435 changeset: 9:d89d4abea5bc
427 user: test
436 user: test
428 date: Thu Jan 01 00:00:00 1970 +0000
437 date: Thu Jan 01 00:00:00 1970 +0000
429 summary: 9
438 summary: 9
430
439
431 changeset: 10:820095aa7158
440 changeset: 10:820095aa7158
432 user: test
441 user: test
433 date: Thu Jan 01 00:00:00 1970 +0000
442 date: Thu Jan 01 00:00:00 1970 +0000
434 summary: 10
443 summary: 10
435
444
436 changeset: 11:09ede2f3a638
445 changeset: 11:09ede2f3a638
437 user: test
446 user: test
438 date: Thu Jan 01 00:00:00 1970 +0000
447 date: Thu Jan 01 00:00:00 1970 +0000
439 summary: 11
448 summary: 11
440
449
441 changeset: 12:e576b1bed305
450 changeset: 12:e576b1bed305
442 user: test
451 user: test
443 date: Thu Jan 01 00:00:00 1970 +0000
452 date: Thu Jan 01 00:00:00 1970 +0000
444 summary: 12
453 summary: 12
445
454
446 changeset: 13:96bbff09a7cc
455 changeset: 13:96bbff09a7cc
447 tag: tip
456 tag: tip
448 user: test
457 user: test
449 date: Thu Jan 01 00:00:00 1970 +0000
458 date: Thu Jan 01 00:00:00 1970 +0000
450 summary: 13
459 summary: 13
451
460
452 $ hg -R test-dev outgoing -r 11 http://localhost:$HGPORT/
461 $ hg -R test-dev outgoing -r 11 http://localhost:$HGPORT/
453 comparing with http://localhost:$HGPORT/
462 comparing with http://localhost:$HGPORT/
454 searching for changes
463 searching for changes
455 changeset: 9:d89d4abea5bc
464 changeset: 9:d89d4abea5bc
456 user: test
465 user: test
457 date: Thu Jan 01 00:00:00 1970 +0000
466 date: Thu Jan 01 00:00:00 1970 +0000
458 summary: 9
467 summary: 9
459
468
460 changeset: 10:820095aa7158
469 changeset: 10:820095aa7158
461 user: test
470 user: test
462 date: Thu Jan 01 00:00:00 1970 +0000
471 date: Thu Jan 01 00:00:00 1970 +0000
463 summary: 10
472 summary: 10
464
473
465 changeset: 11:09ede2f3a638
474 changeset: 11:09ede2f3a638
466 user: test
475 user: test
467 date: Thu Jan 01 00:00:00 1970 +0000
476 date: Thu Jan 01 00:00:00 1970 +0000
468 summary: 11
477 summary: 11
469
478
470
479
471 incoming from empty remote repository
480 incoming from empty remote repository
472
481
473 $ hg init r1
482 $ hg init r1
474 $ hg init r2
483 $ hg init r2
475 $ echo a > r1/foo
484 $ echo a > r1/foo
476 $ hg -R r1 ci -Ama
485 $ hg -R r1 ci -Ama
477 adding foo
486 adding foo
478 $ hg -R r1 incoming r2 --bundle x.hg
487 $ hg -R r1 incoming r2 --bundle x.hg
479 comparing with r2
488 comparing with r2
480 searching for changes
489 searching for changes
481 no changes found
490 no changes found
482 [1]
491 [1]
General Comments 0
You need to be logged in to leave comments. Login now