comparison mercurial/commands.py @ 15837:cd956049fc14

discovery: introduce outgoing object for result of findcommonoutgoing Simplifies client logic in multiple places since it encapsulates the computation of the common and, more importantly, the missing node lists. This also allows an upcomping patch to communicate precomputed versions of these lists to clients.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 09 Jan 2012 03:47:16 +0100
parents 926c9ee8d4be
children 513ca86b88ef
comparison
equal deleted inserted replaced
15836:926c9ee8d4be 15837:cd956049fc14
975 if base: 975 if base:
976 if dest: 976 if dest:
977 raise util.Abort(_("--base is incompatible with specifying " 977 raise util.Abort(_("--base is incompatible with specifying "
978 "a destination")) 978 "a destination"))
979 common = [repo.lookup(rev) for rev in base] 979 common = [repo.lookup(rev) for rev in base]
980 outheads = revs and map(repo.lookup, revs) or revs 980 heads = revs and map(repo.lookup, revs) or revs
981 cg = repo.getbundle('bundle', heads=heads, common=common)
981 else: 982 else:
982 dest = ui.expandpath(dest or 'default-push', dest or 'default') 983 dest = ui.expandpath(dest or 'default-push', dest or 'default')
983 dest, branches = hg.parseurl(dest, opts.get('branch')) 984 dest, branches = hg.parseurl(dest, opts.get('branch'))
984 other = hg.peer(repo, opts, dest) 985 other = hg.peer(repo, opts, dest)
985 revs, checkout = hg.addbranchrevs(repo, other, branches, revs) 986 revs, checkout = hg.addbranchrevs(repo, other, branches, revs)
986 heads = revs and map(repo.lookup, revs) or revs 987 heads = revs and map(repo.lookup, revs) or revs
987 common, outheads = discovery.findcommonoutgoing(repo, other, 988 outgoing = discovery.findcommonoutgoing(repo, other,
988 onlyheads=heads, 989 onlyheads=heads,
989 force=opts.get('force')) 990 force=opts.get('force'))
990 991 cg = repo.getlocalbundle('bundle', outgoing)
991 cg = repo.getbundle('bundle', common=common, heads=outheads)
992 if not cg: 992 if not cg:
993 ui.status(_("no changes found\n")) 993 ui.status(_("no changes found\n"))
994 return 1 994 return 1
995 995
996 bundletype = opts.get('type', 'bzip2').lower() 996 bundletype = opts.get('type', 'bzip2').lower()
5434 if source != dest: 5434 if source != dest:
5435 other = hg.peer(repo, {}, dest) 5435 other = hg.peer(repo, {}, dest)
5436 commoninc = None 5436 commoninc = None
5437 ui.debug('comparing with %s\n' % util.hidepassword(dest)) 5437 ui.debug('comparing with %s\n' % util.hidepassword(dest))
5438 repo.ui.pushbuffer() 5438 repo.ui.pushbuffer()
5439 common, outheads = discovery.findcommonoutgoing(repo, other, 5439 outgoing = discovery.findcommonoutgoing(repo, other,
5440 commoninc=commoninc) 5440 commoninc=commoninc)
5441 repo.ui.popbuffer() 5441 repo.ui.popbuffer()
5442 o = repo.changelog.findmissing(common=common, heads=outheads) 5442 o = outgoing.missing
5443 if o: 5443 if o:
5444 t.append(_('%d outgoing') % len(o)) 5444 t.append(_('%d outgoing') % len(o))
5445 if 'bookmarks' in other.listkeys('namespaces'): 5445 if 'bookmarks' in other.listkeys('namespaces'):
5446 lmarks = repo.listkeys('bookmarks') 5446 lmarks = repo.listkeys('bookmarks')
5447 rmarks = other.listkeys('bookmarks') 5447 rmarks = other.listkeys('bookmarks')