Show More
@@ -27,13 +27,8 b' from . import (' | |||
|
27 | 27 | util, |
|
28 | 28 | ) |
|
29 | 29 | |
|
30 | try: | |
|
31 | from . import rustext | |
|
32 | rustext.__name__ # force actual import (see hgdemandimport) | |
|
33 | except ImportError: | |
|
34 | rustext = None | |
|
35 | ||
|
36 | 30 | parsers = policy.importmod(r'parsers') |
|
31 | dirstatemod = policy.importrust(r'dirstate', default=parsers) | |
|
37 | 32 | |
|
38 | 33 | propertycache = util.propertycache |
|
39 | 34 | filecache = scmutil.filecache |
@@ -1468,12 +1463,7 b' class dirstatemap(object):' | |||
|
1468 | 1463 | # parsing the dirstate. |
|
1469 | 1464 | # |
|
1470 | 1465 | # (we cannot decorate the function directly since it is in a C module) |
|
1471 | if rustext is not None: | |
|
1472 | parse_dirstate = rustext.dirstate.parse_dirstate | |
|
1473 | else: | |
|
1474 | parse_dirstate = parsers.parse_dirstate | |
|
1475 | ||
|
1476 | parse_dirstate = util.nogc(parse_dirstate) | |
|
1466 | parse_dirstate = util.nogc(dirstatemod.parse_dirstate) | |
|
1477 | 1467 | p = parse_dirstate(self._map, self.copymap, st) |
|
1478 | 1468 | if not self._dirtyparents: |
|
1479 | 1469 | self.setparents(*p) |
@@ -1484,13 +1474,8 b' class dirstatemap(object):' | |||
|
1484 | 1474 | self.get = self._map.get |
|
1485 | 1475 | |
|
1486 | 1476 | def write(self, st, now): |
|
1487 | if rustext is not None: | |
|
1488 | pack_dirstate = rustext.dirstate.pack_dirstate | |
|
1489 | else: | |
|
1490 | pack_dirstate = parsers.pack_dirstate | |
|
1491 | ||
|
1492 | st.write(pack_dirstate(self._map, self.copymap, | |
|
1493 | self.parents(), now)) | |
|
1477 | st.write(dirstatemod.pack_dirstate(self._map, self.copymap, | |
|
1478 | self.parents(), now)) | |
|
1494 | 1479 | st.close() |
|
1495 | 1480 | self._dirtyparents = False |
|
1496 | 1481 | self.nonnormalset, self.otherparentset = self.nonnormalentries() |
@@ -17,6 +17,7 b' from . import (' | |||
|
17 | 17 | encoding, |
|
18 | 18 | error, |
|
19 | 19 | pathutil, |
|
20 | policy, | |
|
20 | 21 | pycompat, |
|
21 | 22 | util, |
|
22 | 23 | ) |
@@ -24,11 +25,7 b' from .utils import (' | |||
|
24 | 25 | stringutil, |
|
25 | 26 | ) |
|
26 | 27 | |
|
27 | try: | |
|
28 | from . import rustext | |
|
29 | rustext.__name__ # force actual import (see hgdemandimport) | |
|
30 | except ImportError: | |
|
31 | rustext = None | |
|
28 | rustmod = policy.importrust('filepatterns') | |
|
32 | 29 | |
|
33 | 30 | allpatternkinds = ('re', 'glob', 'path', 'relglob', 'relpath', 'relre', |
|
34 | 31 | 'rootglob', |
@@ -1197,14 +1194,14 b' def _regex(kind, pat, globsuffix):' | |||
|
1197 | 1194 | regular expression. |
|
1198 | 1195 | globsuffix is appended to the regexp of globs.''' |
|
1199 | 1196 | |
|
1200 |
if rust |
|
|
1197 | if rustmod is not None: | |
|
1201 | 1198 | try: |
|
1202 |
return rust |
|
|
1199 | return rustmod.build_single_regex( | |
|
1203 | 1200 | kind, |
|
1204 | 1201 | pat, |
|
1205 | 1202 | globsuffix |
|
1206 | 1203 | ) |
|
1207 |
except rust |
|
|
1204 | except rustmod.PatternError: | |
|
1208 | 1205 | raise error.ProgrammingError( |
|
1209 | 1206 | 'not a regex pattern: %s:%s' % (kind, pat) |
|
1210 | 1207 | ) |
@@ -1460,8 +1457,8 b' def readpatternfile(filepath, warn, sour' | |||
|
1460 | 1457 | This is useful to debug ignore patterns. |
|
1461 | 1458 | ''' |
|
1462 | 1459 | |
|
1463 |
if rust |
|
|
1464 |
result, warnings = rust |
|
|
1460 | if rustmod is not None: | |
|
1461 | result, warnings = rustmod.read_pattern_file( | |
|
1465 | 1462 | filepath, |
|
1466 | 1463 | bool(warn), |
|
1467 | 1464 | sourceinfo, |
@@ -97,11 +97,8 b' REVIDX_KNOWN_FLAGS' | |||
|
97 | 97 | REVIDX_RAWTEXT_CHANGING_FLAGS |
|
98 | 98 | |
|
99 | 99 | parsers = policy.importmod(r'parsers') |
|
100 | try: | |
|
101 | from . import rustext | |
|
102 | rustext.__name__ # force actual import (see hgdemandimport) | |
|
103 | except ImportError: | |
|
104 | rustext = None | |
|
100 | rustancestor = policy.importrust(r'ancestor') | |
|
101 | rustdagop = policy.importrust(r'dagop') | |
|
105 | 102 | |
|
106 | 103 | # Aliased for performance. |
|
107 | 104 | _zlibdecompress = zlib.decompress |
@@ -825,8 +822,8 b' class revlog(object):' | |||
|
825 | 822 | checkrev(r) |
|
826 | 823 | # and we're sure ancestors aren't filtered as well |
|
827 | 824 | |
|
828 |
if rust |
|
|
829 |
lazyancestors = rust |
|
|
825 | if rustancestor is not None: | |
|
826 | lazyancestors = rustancestor.LazyAncestors | |
|
830 | 827 | arg = self.index |
|
831 | 828 | elif util.safehasattr(parsers, 'rustlazyancestors'): |
|
832 | 829 | lazyancestors = ancestor.rustlazyancestors |
@@ -915,8 +912,8 b' class revlog(object):' | |||
|
915 | 912 | if common is None: |
|
916 | 913 | common = [nullrev] |
|
917 | 914 | |
|
918 |
if rust |
|
|
919 |
return rust |
|
|
915 | if rustancestor is not None: | |
|
916 | return rustancestor.MissingAncestors(self.index, common) | |
|
920 | 917 | return ancestor.incrementalmissingancestors(self.parentrevs, common) |
|
921 | 918 | |
|
922 | 919 | def findmissingrevs(self, common=None, heads=None): |
@@ -1130,8 +1127,8 b' class revlog(object):' | |||
|
1130 | 1127 | return self.index.headrevs() |
|
1131 | 1128 | except AttributeError: |
|
1132 | 1129 | return self._headrevs() |
|
1133 |
if rust |
|
|
1134 |
return rust |
|
|
1130 | if rustdagop is not None: | |
|
1131 | return rustdagop.headrevs(self.index, revs) | |
|
1135 | 1132 | return dagop.headrevs(revs, self._uncheckedparentrevs) |
|
1136 | 1133 | |
|
1137 | 1134 | def computephases(self, roots): |
General Comments 0
You need to be logged in to leave comments.
Login now