comparison mercurial/commands.py @ 7415:6163ef936a00

protocol: use changegroupsubset() if possible (issue1389) Due to the fix to the pull race, to avoid sending unnecessary changesets, use changegroupsubset if possible. This will increase the load on the server.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 25 Nov 2008 23:26:33 +0100
parents 040484030491
children f848d7f96195
comparison
equal deleted inserted replaced
7414:040484030491 7415:6163ef936a00
1698 1698
1699 other = hg.repository(ui, source) 1699 other = hg.repository(ui, source)
1700 ui.status(_('comparing with %s\n') % url.hidepassword(source)) 1700 ui.status(_('comparing with %s\n') % url.hidepassword(source))
1701 if revs: 1701 if revs:
1702 revs = [other.lookup(rev) for rev in revs] 1702 revs = [other.lookup(rev) for rev in revs]
1703 incoming = repo.findincoming(other, heads=revs, force=opts["force"]) 1703 common, incoming, rheads = repo.findcommonincoming(other, heads=revs,
1704 force=opts["force"])
1704 if not incoming: 1705 if not incoming:
1705 try: 1706 try:
1706 os.unlink(opts["bundle"]) 1707 os.unlink(opts["bundle"])
1707 except: 1708 except:
1708 pass 1709 pass
1712 cleanup = None 1713 cleanup = None
1713 try: 1714 try:
1714 fname = opts["bundle"] 1715 fname = opts["bundle"]
1715 if fname or not other.local(): 1716 if fname or not other.local():
1716 # create a bundle (uncompressed if other repo is not local) 1717 # create a bundle (uncompressed if other repo is not local)
1718
1719 if revs is None and other.capable('changegroupsubset'):
1720 revs = rheads
1721
1717 if revs is None: 1722 if revs is None:
1718 cg = other.changegroup(incoming, "incoming") 1723 cg = other.changegroup(incoming, "incoming")
1719 else: 1724 else:
1720 cg = other.changegroupsubset(incoming, revs, 'incoming') 1725 cg = other.changegroupsubset(incoming, revs, 'incoming')
1721 bundletype = other.local() and "HG10BZ" or "HG10UN" 1726 bundletype = other.local() and "HG10BZ" or "HG10UN"