##// END OF EJS Templates
rust-status: use bare hg status fastpath from Python...
Raphaël Gomès -
r45017:4d1634e5 default
parent child Browse files
Show More
@@ -27,6 +27,7 b' from . import ('
27 27 policy,
28 28 pycompat,
29 29 scmutil,
30 sparse,
30 31 txnutil,
31 32 util,
32 33 )
@@ -1083,7 +1084,7 b' class dirstate(object):'
1083 1084 results[next(iv)] = st
1084 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 1088 # Force Rayon (Rust parallelism library) to respect the number of
1088 1089 # workers. This is a temporary workaround until Rust code knows
1089 1090 # how to read the config file.
@@ -1101,16 +1102,45 b' class dirstate(object):'
1101 1102 added,
1102 1103 removed,
1103 1104 deleted,
1105 clean,
1106 ignored,
1104 1107 unknown,
1105 clean,
1108 warnings,
1109 bad,
1106 1110 ) = rustmod.status(
1107 1111 self._map._rustmap,
1108 1112 matcher,
1109 1113 self._rootdir,
1110 bool(list_clean),
1114 self._ignorefiles(),
1115 self._checkexec,
1111 1116 self._lastnormaltime,
1112 self._checkexec,
1117 bool(list_clean),
1118 bool(list_ignored),
1119 bool(list_unknown),
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,
1113 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 1145 status = scmutil.status(
1116 1146 modified=modified,
@@ -1118,7 +1148,7 b' class dirstate(object):'
1118 1148 removed=removed,
1119 1149 deleted=deleted,
1120 1150 unknown=unknown,
1121 ignored=[],
1151 ignored=ignored,
1122 1152 clean=clean,
1123 1153 )
1124 1154 return (lookup, status)
@@ -1148,26 +1178,34 b' class dirstate(object):'
1148 1178
1149 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 1187 if rustmod is None:
1154 1188 use_rust = False
1189 elif self._checkcase:
1190 # Case-insensitive filesystems are not handled yet
1191 use_rust = False
1155 1192 elif subrepos:
1156 1193 use_rust = False
1157 elif bool(listunknown):
1158 # Pathauditor does not exist yet in Rust, unknown files
1159 # can't be trusted.
1194 elif sparse.enabled:
1160 1195 use_rust = False
1161 elif self._ignorefiles() and listignored:
1162 # Rust has no ignore mechanism yet, so don't use Rust for
1163 # commands that need ignore.
1196 elif match.traversedir is not None:
1164 1197 use_rust = False
1165 1198 elif not isinstance(match, allowed_matchers):
1166 1199 # Matchers have yet to be implemented
1167 1200 use_rust = False
1168 1201
1169 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 1210 def noop(f):
1173 1211 pass
@@ -1249,13 +1287,10 b' class dirstate(object):'
1249 1287 aadd(fn)
1250 1288 elif state == b'r':
1251 1289 radd(fn)
1252
1253 return (
1254 lookup,
1255 scmutil.status(
1290 status = scmutil.status(
1256 1291 modified, added, removed, deleted, unknown, ignored, clean
1257 ),
1258 1292 )
1293 return (lookup, status)
1259 1294
1260 1295 def matches(self, match):
1261 1296 '''
@@ -666,7 +666,10 b' class _dirchildren(object):'
666 666 class includematcher(basematcher):
667 667 def __init__(self, root, kindpats, badfn=None):
668 668 super(includematcher, self).__init__(badfn)
669
669 if rustmod is not None:
670 # We need to pass the patterns to Rust because they can contain
671 # patterns from the user interface
672 self._kindpats = kindpats
670 673 self._pats, self.matchfn = _buildmatch(kindpats, b'(?:/|$)', root)
671 674 self._prefix = _prefix(kindpats)
672 675 roots, dirs, parents = _rootsdirsandparents(kindpats)
@@ -355,6 +355,11 b' A deleted subrepo file is flagged as dir'
355 355 R sub1/sub2/folder/test.txt
356 356 ! sub1/.hgsub
357 357 ? sub1/x.hgsub
358 $ hg status -R sub1
359 warning: subrepo spec file 'sub1/.hgsub' not found
360 R .hgsubstate
361 ! .hgsub
362 ? x.hgsub
358 363 $ mv sub1/x.hgsub sub1/.hgsub
359 364 $ hg update -Cq
360 365 $ touch sub1/foo
General Comments 0
You need to be logged in to leave comments. Login now