##// 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 112 # lazyparser is not safe to use on windows if win32 extensions not
113 113 # available. it keeps file handle open, which make it not possible
114 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 116 def __init__(self, dataf, size):
119 117 self.dataf = dataf
@@ -362,7 +360,7 b' class revlogio(object):'
362 360 except AttributeError:
363 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 364 # big index, let's parse it on demand
367 365 parser = lazyparser(fp, size)
368 366 index = lazyindex(parser)
@@ -772,12 +772,9 b' def fstat(fp):'
772 772
773 773 posixfile = file
774 774
775 def is_win_9x():
776 '''return true if run on windows 95, 98 or me.'''
777 try:
778 return sys.getwindowsversion()[3] == 1
779 except AttributeError:
780 return os.name == 'nt' and 'command' in os.environ.get('comspec', '')
775 def openhardlinks():
776 '''return true if it is safe to hold open file handles to hardlinks'''
777 return True
781 778
782 779 getuser_fallback = None
783 780
@@ -943,6 +940,16 b" if os.name == 'nt':"
943 940
944 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 953 def system_rcpath():
947 954 try:
948 955 return system_rcpath_win32()
@@ -1074,7 +1081,7 b" if os.name == 'nt':"
1074 1081 try:
1075 1082 # override functions with win32 versions if possible
1076 1083 from util_win32 import *
1077 if not is_win_9x():
1084 if not _is_win_9x():
1078 1085 posixfile = posixfile_nt
1079 1086 except ImportError:
1080 1087 pass
General Comments 0
You need to be logged in to leave comments. Login now