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