##// END OF EJS Templates
dirstate: move rust fast-path calling code to its own method...
Raphaël Gomès -
r44535:717f7eb3 default draft
parent child Browse files
Show More
@@ -1083,6 +1083,48 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(
1093 b'RAYON_NUM_THREADS', b'%d' % numcpus
1094 )
1095
1096 workers_enabled = self._ui.configbool(b"worker", b"enabled", True)
1097 if not workers_enabled:
1098 encoding.environ[b"RAYON_NUM_THREADS"] = b"1"
1099
1100 (
1101 lookup,
1102 modified,
1103 added,
1104 removed,
1105 deleted,
1106 unknown,
1107 clean,
1108 ) = rustmod.status(
1109 self._map._rustmap,
1110 matcher,
1111 self._rootdir,
1112 bool(list_clean),
1113 self._lastnormaltime,
1114 self._checkexec,
1115 )
1116
1117 status = scmutil.status(
1118 modified=modified,
1119 added=added,
1120 removed=removed,
1121 deleted=deleted,
1122 unknown=unknown,
1123 ignored=[],
1124 clean=clean,
1125 )
1126 return (lookup, status)
1127
1086 def status(self, match, subrepos, ignored, clean, unknown):
1128 def status(self, match, subrepos, ignored, clean, unknown):
1087 '''Determine the status of the working copy relative to the
1129 '''Determine the status of the working copy relative to the
1088 dirstate and return a pair of (unsure, status), where status is of type
1130 dirstate and return a pair of (unsure, status), where status is of type
@@ -1127,46 +1169,7 b' class dirstate(object):'
1127 use_rust = False
1169 use_rust = False
1128
1170
1129 if use_rust:
1171 if use_rust:
1130 # Force Rayon (Rust parallelism library) to respect the number of
1172 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
1173
1171 def noop(f):
1174 def noop(f):
1172 pass
1175 pass
General Comments 0
You need to be logged in to leave comments. Login now