##// END OF EJS Templates
util: get rid of is_win_9x wart
Matt Mackall -
r5659:3da652f2 default
parent child Browse files
Show More
@@ -112,8 +112,6 b' class lazyparser(object):'
112 # lazyparser is not safe to use on windows if win32 extensions not
112 # lazyparser is not safe to use on windows if win32 extensions not
113 # available. it keeps file handle open, which make it not possible
113 # available. it keeps file handle open, which make it not possible
114 # to break hardlinks on local cloned repos.
114 # to break hardlinks on local cloned repos.
115 safe_to_use = os.name != 'nt' or (not util.is_win_9x() and
116 hasattr(util, 'win32api'))
117
115
118 def __init__(self, dataf, size):
116 def __init__(self, dataf, size):
119 self.dataf = dataf
117 self.dataf = dataf
@@ -362,7 +360,7 b' class revlogio(object):'
362 except AttributeError:
360 except AttributeError:
363 size = 0
361 size = 0
364
362
365 if lazyparser.safe_to_use and not inline and size > 1000000:
363 if util.openhardlinks() and not inline and size > 1000000:
366 # big index, let's parse it on demand
364 # big index, let's parse it on demand
367 parser = lazyparser(fp, size)
365 parser = lazyparser(fp, size)
368 index = lazyindex(parser)
366 index = lazyindex(parser)
@@ -772,12 +772,9 b' def fstat(fp):'
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
@@ -943,6 +940,16 b" if os.name == 'nt':"
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()
@@ -1074,7 +1081,7 b" if os.name == 'nt':"
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
General Comments 0
You need to be logged in to leave comments. Login now