mercurial/hg.py
changeset 871 c2e77581bc84
parent 870 a82eae840447
parent 859 6390c377a9e6
child 874 d4cb383e7de7
child 878 781266a78fe1
child 879 953ccddd57bd
child 882 bc9ca4d51d23
equal deleted inserted replaced
870:a82eae840447 871:c2e77581bc84
    20                         os.path.join("data", self.encodedir(path + ".d")))
    20                         os.path.join("data", self.encodedir(path + ".d")))
    21 
    21 
    22     # This avoids a collision between a file named foo and a dir named
    22     # This avoids a collision between a file named foo and a dir named
    23     # foo.i or foo.d
    23     # foo.i or foo.d
    24     def encodedir(self, path):
    24     def encodedir(self, path):
    25         path.replace(".hg/", ".hg.hg/")
    25         return (path
    26         path.replace(".i/", ".i.hg/")
    26                 .replace(".hg/", ".hg.hg/")
    27         path.replace(".d/", ".i.hg/")
    27                 .replace(".i/", ".i.hg/")
    28         return path
    28                 .replace(".d/", ".d.hg/"))
    29 
    29 
    30     def decodedir(self, path):
    30     def decodedir(self, path):
    31         path.replace(".d.hg/", ".d/")
    31         return (path
    32         path.replace(".i.hg/", ".i/")
    32                 .replace(".d.hg/", ".d/")
    33         path.replace(".hg.hg/", ".hg/")
    33                 .replace(".i.hg/", ".i/")
    34         return path
    34                 .replace(".hg.hg/", ".hg/"))
    35 
    35 
    36     def read(self, node):
    36     def read(self, node):
    37         t = self.revision(node)
    37         t = self.revision(node)
    38         if not t.startswith('\1\n'):
    38         if not t.startswith('\1\n'):
    39             return t
    39             return t
  1782                 no_proxy = 1
  1782                 no_proxy = 1
  1783 
  1783 
  1784         # Note: urllib2 takes proxy values from the environment and those will
  1784         # Note: urllib2 takes proxy values from the environment and those will
  1785         # take precedence
  1785         # take precedence
  1786         for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
  1786         for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
  1787             if os.environ.has_key(env):
  1787             try:
  1788                 del os.environ[env]
  1788                 if os.environ.has_key(env):
       
  1789                     del os.environ[env]
       
  1790             except OSError:
       
  1791                 pass
  1789 
  1792 
  1790         proxy_handler = urllib2.BaseHandler()
  1793         proxy_handler = urllib2.BaseHandler()
  1791         if host and not no_proxy:
  1794         if host and not no_proxy:
  1792             proxy_handler = urllib2.ProxyHandler({"http" : "http://" + host})
  1795             proxy_handler = urllib2.ProxyHandler({"http" : "http://" + host})
  1793 
  1796