1081 iv = iter(visit) |
1082 iv = iter(visit) |
1082 for st in util.statfiles([join(i) for i in visit]): |
1083 for st in util.statfiles([join(i) for i in visit]): |
1083 results[next(iv)] = st |
1084 results[next(iv)] = st |
1084 return results |
1085 return results |
1085 |
1086 |
1086 def _rust_status(self, matcher, list_clean): |
1087 def _rust_status(self, matcher, list_clean, list_ignored, list_unknown): |
1087 # Force Rayon (Rust parallelism library) to respect the number of |
1088 # Force Rayon (Rust parallelism library) to respect the number of |
1088 # workers. This is a temporary workaround until Rust code knows |
1089 # workers. This is a temporary workaround until Rust code knows |
1089 # how to read the config file. |
1090 # how to read the config file. |
1090 numcpus = self._ui.configint(b"worker", b"numcpus") |
1091 numcpus = self._ui.configint(b"worker", b"numcpus") |
1091 if numcpus is not None: |
1092 if numcpus is not None: |
1099 lookup, |
1100 lookup, |
1100 modified, |
1101 modified, |
1101 added, |
1102 added, |
1102 removed, |
1103 removed, |
1103 deleted, |
1104 deleted, |
|
1105 clean, |
|
1106 ignored, |
1104 unknown, |
1107 unknown, |
1105 clean, |
1108 warnings, |
|
1109 bad, |
1106 ) = rustmod.status( |
1110 ) = rustmod.status( |
1107 self._map._rustmap, |
1111 self._map._rustmap, |
1108 matcher, |
1112 matcher, |
1109 self._rootdir, |
1113 self._rootdir, |
|
1114 self._ignorefiles(), |
|
1115 self._checkexec, |
|
1116 self._lastnormaltime, |
1110 bool(list_clean), |
1117 bool(list_clean), |
1111 self._lastnormaltime, |
1118 bool(list_ignored), |
1112 self._checkexec, |
1119 bool(list_unknown), |
1113 ) |
1120 ) |
|
1121 if self._ui.warn: |
|
1122 for item in warnings: |
|
1123 if isinstance(item, tuple): |
|
1124 file_path, syntax = item |
|
1125 msg = _(b"%s: ignoring invalid syntax '%s'\n") % ( |
|
1126 file_path, |
|
1127 syntax, |
|
1128 ) |
|
1129 self._ui.warn(msg) |
|
1130 else: |
|
1131 msg = _(b"skipping unreadable pattern file '%s': %s\n") |
|
1132 self._ui.warn( |
|
1133 msg |
|
1134 % ( |
|
1135 pathutil.canonpath( |
|
1136 self._rootdir, self._rootdir, item |
|
1137 ), |
|
1138 b"No such file or directory", |
|
1139 ) |
|
1140 ) |
|
1141 |
|
1142 for (fn, message) in bad: |
|
1143 matcher.bad(fn, encoding.strtolocal(message)) |
1114 |
1144 |
1115 status = scmutil.status( |
1145 status = scmutil.status( |
1116 modified=modified, |
1146 modified=modified, |
1117 added=added, |
1147 added=added, |
1118 removed=removed, |
1148 removed=removed, |
1119 deleted=deleted, |
1149 deleted=deleted, |
1120 unknown=unknown, |
1150 unknown=unknown, |
1121 ignored=[], |
1151 ignored=ignored, |
1122 clean=clean, |
1152 clean=clean, |
1123 ) |
1153 ) |
1124 return (lookup, status) |
1154 return (lookup, status) |
1125 |
1155 |
1126 def status(self, match, subrepos, ignored, clean, unknown): |
1156 def status(self, match, subrepos, ignored, clean, unknown): |
1146 dmap = self._map |
1176 dmap = self._map |
1147 dmap.preload() |
1177 dmap.preload() |
1148 |
1178 |
1149 use_rust = True |
1179 use_rust = True |
1150 |
1180 |
1151 allowed_matchers = (matchmod.alwaysmatcher, matchmod.exactmatcher) |
1181 allowed_matchers = ( |
|
1182 matchmod.alwaysmatcher, |
|
1183 matchmod.exactmatcher, |
|
1184 matchmod.includematcher, |
|
1185 ) |
1152 |
1186 |
1153 if rustmod is None: |
1187 if rustmod is None: |
|
1188 use_rust = False |
|
1189 elif self._checkcase: |
|
1190 # Case-insensitive filesystems are not handled yet |
1154 use_rust = False |
1191 use_rust = False |
1155 elif subrepos: |
1192 elif subrepos: |
1156 use_rust = False |
1193 use_rust = False |
1157 elif bool(listunknown): |
1194 elif sparse.enabled: |
1158 # Pathauditor does not exist yet in Rust, unknown files |
|
1159 # can't be trusted. |
|
1160 use_rust = False |
1195 use_rust = False |
1161 elif self._ignorefiles() and listignored: |
1196 elif match.traversedir is not None: |
1162 # Rust has no ignore mechanism yet, so don't use Rust for |
|
1163 # commands that need ignore. |
|
1164 use_rust = False |
1197 use_rust = False |
1165 elif not isinstance(match, allowed_matchers): |
1198 elif not isinstance(match, allowed_matchers): |
1166 # Matchers have yet to be implemented |
1199 # Matchers have yet to be implemented |
1167 use_rust = False |
1200 use_rust = False |
1168 |
1201 |
1169 if use_rust: |
1202 if use_rust: |
1170 return self._rust_status(match, listclean) |
1203 try: |
|
1204 return self._rust_status( |
|
1205 match, listclean, listignored, listunknown |
|
1206 ) |
|
1207 except rustmod.FallbackError: |
|
1208 pass |
1171 |
1209 |
1172 def noop(f): |
1210 def noop(f): |
1173 pass |
1211 pass |
1174 |
1212 |
1175 dcontains = dmap.__contains__ |
1213 dcontains = dmap.__contains__ |
1247 madd(fn) |
1285 madd(fn) |
1248 elif state == b'a': |
1286 elif state == b'a': |
1249 aadd(fn) |
1287 aadd(fn) |
1250 elif state == b'r': |
1288 elif state == b'r': |
1251 radd(fn) |
1289 radd(fn) |
1252 |
1290 status = scmutil.status( |
1253 return ( |
1291 modified, added, removed, deleted, unknown, ignored, clean |
1254 lookup, |
|
1255 scmutil.status( |
|
1256 modified, added, removed, deleted, unknown, ignored, clean |
|
1257 ), |
|
1258 ) |
1292 ) |
|
1293 return (lookup, status) |
1259 |
1294 |
1260 def matches(self, match): |
1295 def matches(self, match): |
1261 ''' |
1296 ''' |
1262 return files in the dirstate (in whatever state) filtered by match |
1297 return files in the dirstate (in whatever state) filtered by match |
1263 ''' |
1298 ''' |