Mercurial > public > mercurial-scm > hg
comparison mercurial/hg.py @ 14073:72c84f24b420
discovery: drop findoutgoing and simplify findcommonincoming's api
This is a long desired cleanup and paves the way for new discovery.
To specify subsets for bundling changes, all code should use the heads
of the desired subset ("heads") and the heads of the common subset
("common") to be excluded from the bundled set. These can be used
revlog.findmissing instead of revlog.nodesbetween.
This fixes an actual bug exposed by the change in test-bundle-r.t
where we try to bundle a changeset while specifying that said changeset
is to be assumed already present in the target. This used to still
bundle the changeset. It no longer does. This is similar to the bugs
fixed by the recent switch to heads/common for incoming/pull.
author | Peter Arrenbrecht <peter.arrenbrecht@gmail.com> |
---|---|
date | Sat, 30 Apr 2011 17:21:37 +0200 |
parents | e4bfb9c337f3 |
children | 924c82157d46 |
comparison
equal
deleted
inserted
replaced
14072:2e4d79dcc0a0 | 14073:72c84f24b420 |
---|---|
424 ui.status(_('comparing with %s\n') % url.hidepassword(source)) | 424 ui.status(_('comparing with %s\n') % url.hidepassword(source)) |
425 revs, checkout = addbranchrevs(repo, other, branches, opts.get('rev')) | 425 revs, checkout = addbranchrevs(repo, other, branches, opts.get('rev')) |
426 | 426 |
427 if revs: | 427 if revs: |
428 revs = [other.lookup(rev) for rev in revs] | 428 revs = [other.lookup(rev) for rev in revs] |
429 usecommon = other.capable('getbundle') | 429 other, common, anyinc, bundle = bundlerepo.getremotechanges(ui, repo, other, |
430 other, common, incoming, bundle = bundlerepo.getremotechanges(ui, repo, other, | 430 revs, opts["bundle"], opts["force"]) |
431 revs, opts["bundle"], opts["force"], | 431 if not anyinc: |
432 usecommon=usecommon) | |
433 if not incoming: | |
434 ui.status(_("no changes found\n")) | 432 ui.status(_("no changes found\n")) |
435 return subreporecurse() | 433 return subreporecurse() |
436 | 434 |
437 try: | 435 try: |
438 if usecommon: | 436 chlist = other.changelog.findmissing(common, revs) |
439 chlist = other.changelog.findmissing(common, revs) | |
440 else: | |
441 chlist = other.changelog.nodesbetween(incoming, revs)[0] | |
442 displayer = cmdutil.show_changeset(ui, other, opts, buffered) | 437 displayer = cmdutil.show_changeset(ui, other, opts, buffered) |
443 | 438 |
444 # XXX once graphlog extension makes it into core, | 439 # XXX once graphlog extension makes it into core, |
445 # should be replaced by a if graph/else | 440 # should be replaced by a if graph/else |
446 displaychlist(other, chlist, displayer) | 441 displaychlist(other, chlist, displayer) |
486 revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev')) | 481 revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev')) |
487 if revs: | 482 if revs: |
488 revs = [repo.lookup(rev) for rev in revs] | 483 revs = [repo.lookup(rev) for rev in revs] |
489 | 484 |
490 other = repository(remoteui(repo, opts), dest) | 485 other = repository(remoteui(repo, opts), dest) |
491 o = discovery.findoutgoing(repo, other, force=opts.get('force')) | 486 inc = discovery.findcommonincoming(repo, other, force=opts.get('force')) |
487 common, _anyinc, _heads = inc | |
488 o = repo.changelog.findmissing(common, revs) | |
492 if not o: | 489 if not o: |
493 ui.status(_("no changes found\n")) | 490 ui.status(_("no changes found\n")) |
494 return None | 491 return None |
495 | 492 return o |
496 return repo.changelog.nodesbetween(o, revs)[0] | |
497 | 493 |
498 def outgoing(ui, repo, dest, opts): | 494 def outgoing(ui, repo, dest, opts): |
499 def recurse(): | 495 def recurse(): |
500 ret = 1 | 496 ret = 1 |
501 if opts.get('subrepos'): | 497 if opts.get('subrepos'): |