comparison mercurial/httprepo.py @ 1251:84cf8834efb5

Fix lots of exception-related problems. These have been around since the Big Code Split.
author Bryan O'Sullivan <bos@serpentine.com>
date Wed, 14 Sep 2005 15:41:22 -0700
parents 142b5d5ec9cc
children 51ac9a79f3e5
comparison
equal deleted inserted replaced
1250:0ad3f9b27260 1251:84cf8834efb5
3 # Copyright 2005 Matt Mackall <mpm@selenic.com> 3 # Copyright 2005 Matt Mackall <mpm@selenic.com>
4 # 4 #
5 # This software may be used and distributed according to the terms 5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference. 6 # of the GNU General Public License, incorporated herein by reference.
7 7
8 import urllib, urllib2, urlparse, os, zlib
9 from node import * 8 from node import *
10 from remoterepo import * 9 from remoterepo import *
10 from demandload import *
11 demandload(globals(), "hg os urllib urllib2 urlparse zlib")
11 12
12 class httprepository(remoterepository): 13 class httprepository(remoterepository):
13 def __init__(self, ui, path): 14 def __init__(self, ui, path):
14 # fix missing / after hostname 15 # fix missing / after hostname
15 s = urlparse.urlsplit(path) 16 s = urlparse.urlsplit(path)
74 75
75 # accept old "text/plain" and "application/hg-changegroup" for now 76 # accept old "text/plain" and "application/hg-changegroup" for now
76 if not proto.startswith('application/mercurial') and \ 77 if not proto.startswith('application/mercurial') and \
77 not proto.startswith('text/plain') and \ 78 not proto.startswith('text/plain') and \
78 not proto.startswith('application/hg-changegroup'): 79 not proto.startswith('application/hg-changegroup'):
79 raise RepoError("'%s' does not appear to be an hg repository" 80 raise hg.RepoError("'%s' does not appear to be an hg repository" %
80 % self.url) 81 self.url)
81 82
82 if proto.startswith('application/mercurial'): 83 if proto.startswith('application/mercurial'):
83 version = proto[22:] 84 version = proto[22:]
84 if float(version) > 0.1: 85 if float(version) > 0.1:
85 raise RepoError("'%s' uses newer protocol %s" % 86 raise hg.RepoError("'%s' uses newer protocol %s" %
86 (self.url, version)) 87 (self.url, version))
87 88
88 return resp 89 return resp
89 90
90 def heads(self): 91 def heads(self):
91 d = self.do_cmd("heads").read() 92 d = self.do_cmd("heads").read()