mercurial/httprepo.py
changeset 10282 08a0f04b56bd
parent 10264 d6512b3e9ac0
child 10491 d7e582cab6b6
equal deleted inserted replaced
10281:e7d3b509af8b 10282:08a0f04b56bd
   105         # accept old "text/plain" and "application/hg-changegroup" for now
   105         # accept old "text/plain" and "application/hg-changegroup" for now
   106         if not (proto.startswith('application/mercurial-') or
   106         if not (proto.startswith('application/mercurial-') or
   107                 proto.startswith('text/plain') or
   107                 proto.startswith('text/plain') or
   108                 proto.startswith('application/hg-changegroup')):
   108                 proto.startswith('application/hg-changegroup')):
   109             self.ui.debug("requested URL: '%s'\n" % url.hidepassword(cu))
   109             self.ui.debug("requested URL: '%s'\n" % url.hidepassword(cu))
   110             raise error.RepoError(_("'%s' does not appear to be an hg repository:\n"
   110             raise error.RepoError(
   111                                     "---%%<--- (%s)\n%s\n---%%<---\n")
   111                 _("'%s' does not appear to be an hg repository:\n"
   112                                   % (safeurl, proto, resp.read()))
   112                   "---%%<--- (%s)\n%s\n---%%<---\n")
       
   113                 % (safeurl, proto, resp.read()))
   113 
   114 
   114         if proto.startswith('application/mercurial-'):
   115         if proto.startswith('application/mercurial-'):
   115             try:
   116             try:
   116                 version = proto.split('-', 1)[1]
   117                 version = proto.split('-', 1)[1]
   117                 version_info = tuple([int(n) for n in version.split('.')])
   118                 version_info = tuple([int(n) for n in version.split('.')])
   169 
   170 
   170     def branches(self, nodes):
   171     def branches(self, nodes):
   171         n = " ".join(map(hex, nodes))
   172         n = " ".join(map(hex, nodes))
   172         d = self.do_read("branches", nodes=n)
   173         d = self.do_read("branches", nodes=n)
   173         try:
   174         try:
   174             br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
   175             br = [tuple(map(bin, b.split(" "))) for b in d.splitlines()]
   175             return br
   176             return br
   176         except:
   177         except:
   177             raise error.ResponseError(_("unexpected response:"), d)
   178             raise error.ResponseError(_("unexpected response:"), d)
   178 
   179 
   179     def between(self, pairs):
   180     def between(self, pairs):
   181         r = []
   182         r = []
   182         for i in xrange(0, len(pairs), batch):
   183         for i in xrange(0, len(pairs), batch):
   183             n = " ".join(["-".join(map(hex, p)) for p in pairs[i:i + batch]])
   184             n = " ".join(["-".join(map(hex, p)) for p in pairs[i:i + batch]])
   184             d = self.do_read("between", pairs=n)
   185             d = self.do_read("between", pairs=n)
   185             try:
   186             try:
   186                 r += [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
   187                 r += [l and map(bin, l.split(" ")) or []
       
   188                       for l in d.splitlines()]
   187             except:
   189             except:
   188                 raise error.ResponseError(_("unexpected response:"), d)
   190                 raise error.ResponseError(_("unexpected response:"), d)
   189         return r
   191         return r
   190 
   192 
   191     def changegroup(self, nodes, kind):
   193     def changegroup(self, nodes, kind):