Show More
@@ -702,16 +702,18 b' def bundle(ui, repo, fname, dest=None, *' | |||||
702 | raise util.Abort(_("--base is incompatible with specifying " |
|
702 | raise util.Abort(_("--base is incompatible with specifying " | |
703 | "a destination")) |
|
703 | "a destination")) | |
704 | common = [repo.lookup(rev) for rev in base] |
|
704 | common = [repo.lookup(rev) for rev in base] | |
|
705 | heads = revs and map(repo.lookup, revs) or revs | |||
705 | else: |
|
706 | else: | |
706 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
707 | dest = ui.expandpath(dest or 'default-push', dest or 'default') | |
707 | dest, branches = hg.parseurl(dest, opts.get('branch')) |
|
708 | dest, branches = hg.parseurl(dest, opts.get('branch')) | |
708 | other = hg.repository(hg.remoteui(repo, opts), dest) |
|
709 | other = hg.repository(hg.remoteui(repo, opts), dest) | |
709 | revs, checkout = hg.addbranchrevs(repo, other, branches, revs) |
|
710 | revs, checkout = hg.addbranchrevs(repo, other, branches, revs) | |
710 | inc = discovery.findcommonincoming(repo, other, force=opts.get('force')) |
|
711 | heads = revs and map(repo.lookup, revs) or revs | |
711 | common, _anyinc, _heads = inc |
|
712 | common, outheads = discovery.findcommonoutgoing(repo, other, | |
712 |
|
713 | onlyheads=heads, | ||
713 | nodes = revs and map(repo.lookup, revs) or revs |
|
714 | force=opts.get('force')) | |
714 | cg = repo.getbundle('bundle', common=common, heads=nodes) |
|
715 | ||
|
716 | cg = repo.getbundle('bundle', common=common, heads=heads) | |||
715 | if not cg: |
|
717 | if not cg: | |
716 | ui.status(_("no changes found\n")) |
|
718 | ui.status(_("no changes found\n")) | |
717 | return 1 |
|
719 | return 1 | |
@@ -4024,9 +4026,9 b' def summary(ui, repo, **opts):' | |||||
4024 | other = hg.repository(hg.remoteui(repo, {}), dest) |
|
4026 | other = hg.repository(hg.remoteui(repo, {}), dest) | |
4025 | ui.debug('comparing with %s\n' % util.hidepassword(dest)) |
|
4027 | ui.debug('comparing with %s\n' % util.hidepassword(dest)) | |
4026 | repo.ui.pushbuffer() |
|
4028 | repo.ui.pushbuffer() | |
4027 |
common, |
|
4029 | common, outheads = discovery.findcommonoutgoing(repo, other) | |
4028 | repo.ui.popbuffer() |
|
4030 | repo.ui.popbuffer() | |
4029 | o = repo.changelog.findmissing(common=common) |
|
4031 | o = repo.changelog.findmissing(common=common, heads=outheads) | |
4030 | if o: |
|
4032 | if o: | |
4031 | t.append(_('%d outgoing') % len(o)) |
|
4033 | t.append(_('%d outgoing') % len(o)) | |
4032 | if 'bookmarks' in other.listkeys('namespaces'): |
|
4034 | if 'bookmarks' in other.listkeys('namespaces'): |
@@ -23,6 +23,9 b' def findcommonincoming(repo, remote, hea' | |||||
23 |
|
23 | |||
24 | If you pass heads and they are all known locally, the reponse lists justs |
|
24 | If you pass heads and they are all known locally, the reponse lists justs | |
25 | these heads in "common" and in "heads". |
|
25 | these heads in "common" and in "heads". | |
|
26 | ||||
|
27 | Please use findcommonoutgoing to compute the set of outgoing nodes to give | |||
|
28 | extensions a good hook into outgoing. | |||
26 | """ |
|
29 | """ | |
27 |
|
30 | |||
28 | if not remote.capable('getbundle'): |
|
31 | if not remote.capable('getbundle'): | |
@@ -43,6 +46,21 b' def findcommonincoming(repo, remote, hea' | |||||
43 | common, anyinc, srvheads = res |
|
46 | common, anyinc, srvheads = res | |
44 | return (list(common), anyinc, heads or list(srvheads)) |
|
47 | return (list(common), anyinc, heads or list(srvheads)) | |
45 |
|
48 | |||
|
49 | def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None): | |||
|
50 | '''Return a tuple (common, anyoutgoing, heads) used to identify the set | |||
|
51 | of nodes present in repo but not in other. | |||
|
52 | ||||
|
53 | If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive) | |||
|
54 | are included. If you already know the local repo's heads, passing them in | |||
|
55 | onlyheads is faster than letting them be recomputed here. | |||
|
56 | ||||
|
57 | If commoninc is given, it must the the result of a prior call to | |||
|
58 | findcommonincoming(repo, other, force) to avoid recomputing it here. | |||
|
59 | ||||
|
60 | The returned tuple is meant to be passed to changelog.findmissing.''' | |||
|
61 | common, _any, _hds = commoninc or findcommonincoming(repo, other, force=force) | |||
|
62 | return (common, onlyheads or repo.heads()) | |||
|
63 | ||||
46 | def prepush(repo, remote, force, revs, newbranch): |
|
64 | def prepush(repo, remote, force, revs, newbranch): | |
47 | '''Analyze the local and remote repositories and determine which |
|
65 | '''Analyze the local and remote repositories and determine which | |
48 | changesets need to be pushed to the remote. Return value depends |
|
66 | changesets need to be pushed to the remote. Return value depends | |
@@ -57,7 +75,10 b' def prepush(repo, remote, force, revs, n' | |||||
57 | changegroup is a readable file-like object whose read() returns |
|
75 | changegroup is a readable file-like object whose read() returns | |
58 | successive changegroup chunks ready to be sent over the wire and |
|
76 | successive changegroup chunks ready to be sent over the wire and | |
59 | remoteheads is the list of remote heads.''' |
|
77 | remoteheads is the list of remote heads.''' | |
60 |
common |
|
78 | commoninc = findcommonincoming(repo, remote, force=force) | |
|
79 | common, revs = findcommonoutgoing(repo, remote, onlyheads=revs, | |||
|
80 | commoninc=commoninc, force=force) | |||
|
81 | _common, inc, remoteheads = commoninc | |||
61 |
|
82 | |||
62 | cl = repo.changelog |
|
83 | cl = repo.changelog | |
63 | outg = cl.findmissing(common, revs) |
|
84 | outg = cl.findmissing(common, revs) |
@@ -480,9 +480,9 b' def _outgoing(ui, repo, dest, opts):' | |||||
480 | revs = [repo.lookup(rev) for rev in revs] |
|
480 | revs = [repo.lookup(rev) for rev in revs] | |
481 |
|
481 | |||
482 | other = repository(remoteui(repo, opts), dest) |
|
482 | other = repository(remoteui(repo, opts), dest) | |
483 |
|
|
483 | common, outheads = discovery.findcommonoutgoing(repo, other, revs, | |
484 | common, _anyinc, _heads = inc |
|
484 | force=opts.get('force')) | |
485 |
o = repo.changelog.findmissing(common, |
|
485 | o = repo.changelog.findmissing(common, outheads) | |
486 | if not o: |
|
486 | if not o: | |
487 | ui.status(_("no changes found\n")) |
|
487 | ui.status(_("no changes found\n")) | |
488 | return None |
|
488 | return None |
@@ -558,10 +558,10 b' def outgoing(repo, subset, x):' | |||||
558 | revs = [repo.lookup(rev) for rev in revs] |
|
558 | revs = [repo.lookup(rev) for rev in revs] | |
559 | other = hg.repository(hg.remoteui(repo, {}), dest) |
|
559 | other = hg.repository(hg.remoteui(repo, {}), dest) | |
560 | repo.ui.pushbuffer() |
|
560 | repo.ui.pushbuffer() | |
561 |
common, |
|
561 | common, outheads = discovery.findcommonoutgoing(repo, other, onlyheads=revs) | |
562 | repo.ui.popbuffer() |
|
562 | repo.ui.popbuffer() | |
563 | cl = repo.changelog |
|
563 | cl = repo.changelog | |
564 |
o = set([cl.rev(r) for r in repo.changelog.findmissing(common, |
|
564 | o = set([cl.rev(r) for r in repo.changelog.findmissing(common, outheads)]) | |
565 | return [r for r in subset if r in o] |
|
565 | return [r for r in subset if r in o] | |
566 |
|
566 | |||
567 | def p1(repo, subset, x): |
|
567 | def p1(repo, subset, x): |
General Comments 0
You need to be logged in to leave comments.
Login now