##// END OF EJS Templates
httprepo: make __del__ more stable in error situations...
Mads Kiilerich -
r15246:7b15dd91 default
parent child Browse files
Show More
@@ -28,6 +28,7 b' class httprepository(wireproto.wirerepos'
28 self.path = path
28 self.path = path
29 self.caps = None
29 self.caps = None
30 self.handler = None
30 self.handler = None
31 self.urlopener = None
31 u = util.url(path)
32 u = util.url(path)
32 if u.query or u.fragment:
33 if u.query or u.fragment:
33 raise util.Abort(_('unsupported URL component: "%s"') %
34 raise util.Abort(_('unsupported URL component: "%s"') %
@@ -42,9 +43,10 b' class httprepository(wireproto.wirerepos'
42 self.urlopener = url.opener(ui, authinfo)
43 self.urlopener = url.opener(ui, authinfo)
43
44
44 def __del__(self):
45 def __del__(self):
45 for h in self.urlopener.handlers:
46 if self.urlopener:
46 h.close()
47 for h in self.urlopener.handlers:
47 getattr(h, "close_all", lambda : None)()
48 h.close()
49 getattr(h, "close_all", lambda : None)()
48
50
49 def url(self):
51 def url(self):
50 return self.path
52 return self.path
@@ -200,4 +200,8 b' Pull -u takes us back to branch foo:'
200 date: Thu Jan 01 00:00:00 1970 +0000
200 date: Thu Jan 01 00:00:00 1970 +0000
201 summary: new head of branch foo
201 summary: new head of branch foo
202
202
203 Test handling of invalid urls
203
204
205 $ hg id http://foo/?bar
206 abort: unsupported URL component: "bar"
207 [255]
General Comments 0
You need to be logged in to leave comments. Login now