mercurial/posix.py
changeset 43506 9f70512ae2cf
parent 43477 147576a4e6a2
child 44306 a0ec05d93c8e
equal deleted inserted replaced
43505:47fac1692ede 43506:9f70512ae2cf
    30     error,
    30     error,
    31     policy,
    31     policy,
    32     pycompat,
    32     pycompat,
    33 )
    33 )
    34 
    34 
    35 osutil = policy.importmod(r'osutil')
    35 osutil = policy.importmod('osutil')
    36 
    36 
    37 normpath = os.path.normpath
    37 normpath = os.path.normpath
    38 samestat = os.path.samestat
    38 samestat = os.path.samestat
    39 try:
    39 try:
    40     oslink = os.link
    40     oslink = os.link
    58 umask = os.umask(0)
    58 umask = os.umask(0)
    59 os.umask(umask)
    59 os.umask(umask)
    60 
    60 
    61 if not pycompat.ispy3:
    61 if not pycompat.ispy3:
    62 
    62 
    63     def posixfile(name, mode=r'r', buffering=-1):
    63     def posixfile(name, mode='r', buffering=-1):
    64         fp = open(name, mode=mode, buffering=buffering)
    64         fp = open(name, mode=mode, buffering=buffering)
    65         # The position when opening in append mode is implementation defined, so
    65         # The position when opening in append mode is implementation defined, so
    66         # make it consistent by always seeking to the end.
    66         # make it consistent by always seeking to the end.
    67         if r'a' in mode:
    67         if 'a' in mode:
    68             fp.seek(0, os.SEEK_END)
    68             fp.seek(0, os.SEEK_END)
    69         return fp
    69         return fp
    70 
    70 
    71 
    71 
    72 else:
    72 else:
   464                 s += c
   464                 s += c
   465 
   465 
   466             u = s.decode('utf-8')
   466             u = s.decode('utf-8')
   467 
   467 
   468         # Decompose then lowercase (HFS+ technote specifies lower)
   468         # Decompose then lowercase (HFS+ technote specifies lower)
   469         enc = unicodedata.normalize(r'NFD', u).lower().encode('utf-8')
   469         enc = unicodedata.normalize('NFD', u).lower().encode('utf-8')
   470         # drop HFS+ ignored characters
   470         # drop HFS+ ignored characters
   471         return encoding.hfsignoreclean(enc)
   471         return encoding.hfsignoreclean(enc)
   472 
   472 
   473 
   473 
   474 if pycompat.sysplatform == b'cygwin':
   474 if pycompat.sysplatform == b'cygwin':