mercurial/util.py
changeset 5659 3da652f2039c
parent 5647 165cda754d9e
child 5691 8e495dd6662e
child 6499 479847ccabe0
equal deleted inserted replaced
5658:ae3089cefaab 5659:3da652f2039c
   770     except AttributeError:
   770     except AttributeError:
   771         return os.stat(fp.name)
   771         return os.stat(fp.name)
   772 
   772 
   773 posixfile = file
   773 posixfile = file
   774 
   774 
   775 def is_win_9x():
   775 def openhardlinks():
   776     '''return true if run on windows 95, 98 or me.'''
   776     '''return true if it is safe to hold open file handles to hardlinks'''
   777     try:
   777     return True
   778         return sys.getwindowsversion()[3] == 1
       
   779     except AttributeError:
       
   780         return os.name == 'nt' and 'command' in os.environ.get('comspec', '')
       
   781 
   778 
   782 getuser_fallback = None
   779 getuser_fallback = None
   783 
   780 
   784 def getuser():
   781 def getuser():
   785     '''return name of current user'''
   782     '''return name of current user'''
   941                 self.close()
   938                 self.close()
   942                 raise IOError(errno.EPIPE, 'Broken pipe')
   939                 raise IOError(errno.EPIPE, 'Broken pipe')
   943 
   940 
   944     sys.stdout = winstdout(sys.stdout)
   941     sys.stdout = winstdout(sys.stdout)
   945 
   942 
       
   943     def _is_win_9x():
       
   944         '''return true if run on windows 95, 98 or me.'''
       
   945         try:
       
   946             return sys.getwindowsversion()[3] == 1
       
   947         except AttributeError:
       
   948             return 'command' in os.environ.get('comspec', '')
       
   949 
       
   950     def openhardlinks():
       
   951         return not _is_win_9x and "win32api" in locals()
       
   952 
   946     def system_rcpath():
   953     def system_rcpath():
   947         try:
   954         try:
   948             return system_rcpath_win32()
   955             return system_rcpath_win32()
   949         except:
   956         except:
   950             return [r'c:\mercurial\mercurial.ini']
   957             return [r'c:\mercurial\mercurial.ini']
  1072             pass
  1079             pass
  1073 
  1080 
  1074     try:
  1081     try:
  1075         # override functions with win32 versions if possible
  1082         # override functions with win32 versions if possible
  1076         from util_win32 import *
  1083         from util_win32 import *
  1077         if not is_win_9x():
  1084         if not _is_win_9x():
  1078             posixfile = posixfile_nt
  1085             posixfile = posixfile_nt
  1079     except ImportError:
  1086     except ImportError:
  1080         pass
  1087         pass
  1081 
  1088 
  1082 else:
  1089 else: