mercurial/url.py
changeset 13817 7f18bab2c0b0
parent 13816 2540f8087e02
child 13818 bf6156bab41b
equal deleted inserted replaced
13816:2540f8087e02 13817:7f18bab2c0b0
   138             if (self.host and ':' in self.host and
   138             if (self.host and ':' in self.host and
   139                 not (self.host.startswith('[') and self.host.endswith(']'))):
   139                 not (self.host.startswith('[') and self.host.endswith(']'))):
   140                 self.host, self.port = self.host.rsplit(':', 1)
   140                 self.host, self.port = self.host.rsplit(':', 1)
   141                 if not self.host:
   141                 if not self.host:
   142                     self.host = None
   142                     self.host = None
       
   143 
       
   144             if (self.host and self.scheme == 'file' and
       
   145                 self.host not in ('localhost', '127.0.0.1', '[::1]')):
       
   146                 raise util.Abort(_('file:// URLs can only refer to localhost'))
       
   147 
   143         self.path = path
   148         self.path = path
   144 
   149 
   145         for a in ('user', 'passwd', 'host', 'port',
   150         for a in ('user', 'passwd', 'host', 'port',
   146                   'path', 'query', 'fragment'):
   151                   'path', 'query', 'fragment'):
   147             v = getattr(self, a)
   152             v = getattr(self, a)