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