mercurial/commands.py
changeset 5255 65dc707606ed
parent 5241 5517aa5aafb0
child 5263 d59ed18ec2d0
equal deleted inserted replaced
5254:b534c502bfb3 5255:65dc707606ed
  1643     cmdutil.setremoteconfig(ui, opts)
  1643     cmdutil.setremoteconfig(ui, opts)
  1644 
  1644 
  1645     other = hg.repository(ui, source)
  1645     other = hg.repository(ui, source)
  1646     ui.status(_('comparing with %s\n') % source)
  1646     ui.status(_('comparing with %s\n') % source)
  1647     if revs:
  1647     if revs:
  1648         if 'lookup' in other.capabilities:
  1648         revs = [other.lookup(rev) for rev in revs]
  1649             revs = [other.lookup(rev) for rev in revs]
       
  1650         else:
       
  1651             error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
       
  1652             raise util.Abort(error)
       
  1653     incoming = repo.findincoming(other, heads=revs, force=opts["force"])
  1649     incoming = repo.findincoming(other, heads=revs, force=opts["force"])
  1654     if not incoming:
  1650     if not incoming:
  1655         try:
  1651         try:
  1656             os.unlink(opts["bundle"])
  1652             os.unlink(opts["bundle"])
  1657         except:
  1653         except:
  1665         if fname or not other.local():
  1661         if fname or not other.local():
  1666             # create a bundle (uncompressed if other repo is not local)
  1662             # create a bundle (uncompressed if other repo is not local)
  1667             if revs is None:
  1663             if revs is None:
  1668                 cg = other.changegroup(incoming, "incoming")
  1664                 cg = other.changegroup(incoming, "incoming")
  1669             else:
  1665             else:
  1670                 if 'changegroupsubset' not in other.capabilities:
       
  1671                     raise util.Abort(_("Partial incoming cannot be done because other repository doesn't support changegroupsubset."))
       
  1672                 cg = other.changegroupsubset(incoming, revs, 'incoming')
  1666                 cg = other.changegroupsubset(incoming, revs, 'incoming')
  1673             bundletype = other.local() and "HG10BZ" or "HG10UN"
  1667             bundletype = other.local() and "HG10BZ" or "HG10UN"
  1674             fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
  1668             fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
  1675             # keep written bundle?
  1669             # keep written bundle?
  1676             if opts["bundle"]:
  1670             if opts["bundle"]:
  2076     cmdutil.setremoteconfig(ui, opts)
  2070     cmdutil.setremoteconfig(ui, opts)
  2077 
  2071 
  2078     other = hg.repository(ui, source)
  2072     other = hg.repository(ui, source)
  2079     ui.status(_('pulling from %s\n') % (source))
  2073     ui.status(_('pulling from %s\n') % (source))
  2080     if revs:
  2074     if revs:
  2081         if 'lookup' in other.capabilities:
  2075         try:
  2082             revs = [other.lookup(rev) for rev in revs]
  2076             revs = [other.lookup(rev) for rev in revs]
  2083         else:
  2077         except repo.NoCapability:
  2084             error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.")
  2078             error = _("Other repository doesn't support revision lookup, "
       
  2079                       "so a rev cannot be specified.")
  2085             raise util.Abort(error)
  2080             raise util.Abort(error)
  2086 
  2081 
  2087     modheads = repo.pull(other, heads=revs, force=opts['force'])
  2082     modheads = repo.pull(other, heads=revs, force=opts['force'])
  2088     return postincoming(ui, repo, modheads, opts['update'], checkout)
  2083     return postincoming(ui, repo, modheads, opts['update'], checkout)
  2089 
  2084