mercurial/commands.py
changeset 4474 08ae451148b2
parent 4450 8fa54b9c6c5a
parent 4473 671158f060cc
child 4478 b2b55acbacdd
equal deleted inserted replaced
4472:f975e986b4bf 4474:08ae451148b2
  1591     source = ui.expandpath(source)
  1591     source = ui.expandpath(source)
  1592     setremoteconfig(ui, opts)
  1592     setremoteconfig(ui, opts)
  1593 
  1593 
  1594     other = hg.repository(ui, source)
  1594     other = hg.repository(ui, source)
  1595     ui.status(_('comparing with %s\n') % source)
  1595     ui.status(_('comparing with %s\n') % source)
  1596     incoming = repo.findincoming(other, force=opts["force"])
  1596     revs = None
       
  1597     if opts['rev']:
       
  1598         if 'lookup' in other.capabilities:
       
  1599             revs = [other.lookup(rev) for rev in opts['rev']]
       
  1600         else:
       
  1601             error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
       
  1602             raise util.Abort(error)
       
  1603     incoming = repo.findincoming(other, heads=revs, force=opts["force"])
  1597     if not incoming:
  1604     if not incoming:
  1598         try:
  1605         try:
  1599             os.unlink(opts["bundle"])
  1606             os.unlink(opts["bundle"])
  1600         except:
  1607         except:
  1601             pass
  1608             pass
  1605     cleanup = None
  1612     cleanup = None
  1606     try:
  1613     try:
  1607         fname = opts["bundle"]
  1614         fname = opts["bundle"]
  1608         if fname or not other.local():
  1615         if fname or not other.local():
  1609             # create a bundle (uncompressed if other repo is not local)
  1616             # create a bundle (uncompressed if other repo is not local)
  1610             cg = other.changegroup(incoming, "incoming")
  1617             if revs is None:
       
  1618                 cg = other.changegroup(incoming, "incoming")
       
  1619             else:
       
  1620                 if 'changegroupsubset' not in other.capabilities:
       
  1621                     raise util.Abort(_("Partial incoming cannot be done because other repository doesn't support changegroupsubset."))
       
  1622                 cg = other.changegroupsubset(incoming, revs, 'incoming')
  1611             bundletype = other.local() and "HG10BZ" or "HG10UN"
  1623             bundletype = other.local() and "HG10BZ" or "HG10UN"
  1612             fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
  1624             fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
  1613             # keep written bundle?
  1625             # keep written bundle?
  1614             if opts["bundle"]:
  1626             if opts["bundle"]:
  1615                 cleanup = None
  1627                 cleanup = None
  1616             if not other.local():
  1628             if not other.local():
  1617                 # use the created uncompressed bundlerepo
  1629                 # use the created uncompressed bundlerepo
  1618                 other = bundlerepo.bundlerepository(ui, repo.root, fname)
  1630                 other = bundlerepo.bundlerepository(ui, repo.root, fname)
  1619 
  1631 
  1620         revs = None
       
  1621         if opts['rev']:
       
  1622             revs = [other.lookup(rev) for rev in opts['rev']]
       
  1623         o = other.changelog.nodesbetween(incoming, revs)[0]
  1632         o = other.changelog.nodesbetween(incoming, revs)[0]
  1624         if opts['newest_first']:
  1633         if opts['newest_first']:
  1625             o.reverse()
  1634             o.reverse()
  1626         displayer = cmdutil.show_changeset(ui, other, opts)
  1635         displayer = cmdutil.show_changeset(ui, other, opts)
  1627         for n in o:
  1636         for n in o: