mercurial/util.py
changeset 5843 83c354c4d529
parent 5802 d852151fb8d4
child 5844 07d8eb78dd68
equal deleted inserted replaced
5842:111ed8c871bf 5843:83c354c4d529
   339 
   339 
   340 def canonpath(root, cwd, myname):
   340 def canonpath(root, cwd, myname):
   341     """return the canonical path of myname, given cwd and root"""
   341     """return the canonical path of myname, given cwd and root"""
   342     if root == os.sep:
   342     if root == os.sep:
   343         rootsep = os.sep
   343         rootsep = os.sep
   344     elif root.endswith(os.sep):
   344     elif endswithsep(root):
   345         rootsep = root
   345         rootsep = root
   346     else:
   346     else:
   347         rootsep = root + os.sep
   347         rootsep = root + os.sep
   348     name = myname
   348     name = myname
   349     if not os.path.isabs(name):
   349     if not os.path.isabs(name):
   880 
   880 
   881 def needbinarypatch():
   881 def needbinarypatch():
   882     """return True if patches should be applied in binary mode by default."""
   882     """return True if patches should be applied in binary mode by default."""
   883     return os.name == 'nt'
   883     return os.name == 'nt'
   884 
   884 
       
   885 def endswithsep(path):
       
   886     '''Check path ends with os.sep or os.altsep.'''
       
   887     return path.endswith(os.sep) or os.altsep and path.endswith(os.altsep)
       
   888 
   885 # Platform specific variants
   889 # Platform specific variants
   886 if os.name == 'nt':
   890 if os.name == 'nt':
   887     import msvcrt
   891     import msvcrt
   888     nulldev = 'NUL:'
   892     nulldev = 'NUL:'
   889 
   893