mercurial/bundle2.py
changeset 46907 ffd3e823a7e5
parent 46780 6266d19556ad
child 47012 d55b71393907
child 47062 f38bf44e077f
equal deleted inserted replaced
46906:33524c46a092 46907:ffd3e823a7e5
   175     streamclone,
   175     streamclone,
   176     tags,
   176     tags,
   177     url,
   177     url,
   178     util,
   178     util,
   179 )
   179 )
   180 from .utils import stringutil
   180 from .utils import (
       
   181     stringutil,
       
   182     urlutil,
       
   183 )
   181 
   184 
   182 urlerr = util.urlerr
   185 urlerr = util.urlerr
   183 urlreq = util.urlreq
   186 urlreq = util.urlreq
   184 
   187 
   185 _pack = struct.pack
   188 _pack = struct.pack
  2071     """
  2074     """
  2072     try:
  2075     try:
  2073         raw_url = inpart.params[b'url']
  2076         raw_url = inpart.params[b'url']
  2074     except KeyError:
  2077     except KeyError:
  2075         raise error.Abort(_(b'remote-changegroup: missing "%s" param') % b'url')
  2078         raise error.Abort(_(b'remote-changegroup: missing "%s" param') % b'url')
  2076     parsed_url = util.url(raw_url)
  2079     parsed_url = urlutil.url(raw_url)
  2077     if parsed_url.scheme not in capabilities[b'remote-changegroup']:
  2080     if parsed_url.scheme not in capabilities[b'remote-changegroup']:
  2078         raise error.Abort(
  2081         raise error.Abort(
  2079             _(b'remote-changegroup does not support %s urls')
  2082             _(b'remote-changegroup does not support %s urls')
  2080             % parsed_url.scheme
  2083             % parsed_url.scheme
  2081         )
  2084         )
  2108     from . import exchange
  2111     from . import exchange
  2109 
  2112 
  2110     cg = exchange.readbundle(op.repo.ui, real_part, raw_url)
  2113     cg = exchange.readbundle(op.repo.ui, real_part, raw_url)
  2111     if not isinstance(cg, changegroup.cg1unpacker):
  2114     if not isinstance(cg, changegroup.cg1unpacker):
  2112         raise error.Abort(
  2115         raise error.Abort(
  2113             _(b'%s: not a bundle version 1.0') % util.hidepassword(raw_url)
  2116             _(b'%s: not a bundle version 1.0') % urlutil.hidepassword(raw_url)
  2114         )
  2117         )
  2115     ret = _processchangegroup(op, cg, tr, op.source, b'bundle2')
  2118     ret = _processchangegroup(op, cg, tr, op.source, b'bundle2')
  2116     if op.reply is not None:
  2119     if op.reply is not None:
  2117         # This is definitely not the final form of this
  2120         # This is definitely not the final form of this
  2118         # return. But one need to start somewhere.
  2121         # return. But one need to start somewhere.
  2124     try:
  2127     try:
  2125         real_part.validate()
  2128         real_part.validate()
  2126     except error.Abort as e:
  2129     except error.Abort as e:
  2127         raise error.Abort(
  2130         raise error.Abort(
  2128             _(b'bundle at %s is corrupted:\n%s')
  2131             _(b'bundle at %s is corrupted:\n%s')
  2129             % (util.hidepassword(raw_url), e.message)
  2132             % (urlutil.hidepassword(raw_url), e.message)
  2130         )
  2133         )
  2131     assert not inpart.read()
  2134     assert not inpart.read()
  2132 
  2135 
  2133 
  2136 
  2134 @parthandler(b'reply:changegroup', (b'return', b'in-reply-to'))
  2137 @parthandler(b'reply:changegroup', (b'return', b'in-reply-to'))