##// END OF EJS Templates
dirstate: move rust fast-path calling code to its own method...
Raphaël Gomès -
r44537:f2c350e7 default
parent child Browse files
Show More
@@ -1083,6 +1083,46 b' class dirstate(object):'
1083 results[next(iv)] = st
1083 results[next(iv)] = st
1084 return results
1084 return results
1085
1085
1086 def _rust_status(self, matcher, list_clean):
1087 # Force Rayon (Rust parallelism library) to respect the number of
1088 # workers. This is a temporary workaround until Rust code knows
1089 # how to read the config file.
1090 numcpus = self._ui.configint(b"worker", b"numcpus")
1091 if numcpus is not None:
1092 encoding.environ.setdefault(b'RAYON_NUM_THREADS', b'%d' % numcpus)
1093
1094 workers_enabled = self._ui.configbool(b"worker", b"enabled", True)
1095 if not workers_enabled:
1096 encoding.environ[b"RAYON_NUM_THREADS"] = b"1"
1097
1098 (
1099 lookup,
1100 modified,
1101 added,
1102 removed,
1103 deleted,
1104 unknown,
1105 clean,
1106 ) = rustmod.status(
1107 self._map._rustmap,
1108 matcher,
1109 self._rootdir,
1110 bool(list_clean),
1111 self._lastnormaltime,
1112 self._checkexec,
1113 )
1114
1115 status = scmutil.status(
1116 modified=modified,
1117 added=added,
1118 removed=removed,
1119 deleted=deleted,
1120 unknown=unknown,
1121 ignored=[],
1122 clean=clean,
1123 )
1124 return (lookup, status)
1125
1086 def status(self, match, subrepos, ignored, clean, unknown):
1126 def status(self, match, subrepos, ignored, clean, unknown):
1087 '''Determine the status of the working copy relative to the
1127 '''Determine the status of the working copy relative to the
1088 dirstate and return a pair of (unsure, status), where status is of type
1128 dirstate and return a pair of (unsure, status), where status is of type
@@ -1127,46 +1167,7 b' class dirstate(object):'
1127 use_rust = False
1167 use_rust = False
1128
1168
1129 if use_rust:
1169 if use_rust:
1130 # Force Rayon (Rust parallelism library) to respect the number of
1170 return self._rust_status(match, listclean)
1131 # workers. This is a temporary workaround until Rust code knows
1132 # how to read the config file.
1133 numcpus = self._ui.configint(b"worker", b"numcpus")
1134 if numcpus is not None:
1135 encoding.environ.setdefault(
1136 b'RAYON_NUM_THREADS', b'%d' % numcpus
1137 )
1138
1139 workers_enabled = self._ui.configbool(b"worker", b"enabled", True)
1140 if not workers_enabled:
1141 encoding.environ[b"RAYON_NUM_THREADS"] = b"1"
1142
1143 (
1144 lookup,
1145 modified,
1146 added,
1147 removed,
1148 deleted,
1149 unknown,
1150 clean,
1151 ) = rustmod.status(
1152 dmap._rustmap,
1153 match,
1154 self._rootdir,
1155 bool(listclean),
1156 self._lastnormaltime,
1157 self._checkexec,
1158 )
1159
1160 status = scmutil.status(
1161 modified=modified,
1162 added=added,
1163 removed=removed,
1164 deleted=deleted,
1165 unknown=unknown,
1166 ignored=ignored,
1167 clean=clean,
1168 )
1169 return (lookup, status)
1170
1171
1171 def noop(f):
1172 def noop(f):
1172 pass
1173 pass
General Comments 0
You need to be logged in to leave comments. Login now