Show More
@@ -27,6 +27,12 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 | ||
|
30 | 36 | parsers = policy.importmod(r'parsers') |
|
31 | 37 | |
|
32 | 38 | propertycache = util.propertycache |
@@ -1465,7 +1471,12 b' class dirstatemap(object):' | |||
|
1465 | 1471 | # parsing the dirstate. |
|
1466 | 1472 | # |
|
1467 | 1473 | # (we cannot decorate the function directly since it is in a C module) |
|
1468 | parse_dirstate = util.nogc(parsers.parse_dirstate) | |
|
1474 | if rustext is not None: | |
|
1475 | parse_dirstate = rustext.dirstate.parse_dirstate | |
|
1476 | else: | |
|
1477 | parse_dirstate = parsers.parse_dirstate | |
|
1478 | ||
|
1479 | parse_dirstate = util.nogc(parse_dirstate) | |
|
1469 | 1480 | p = parse_dirstate(self._map, self.copymap, st) |
|
1470 | 1481 | if not self._dirtyparents: |
|
1471 | 1482 | self.setparents(*p) |
@@ -1476,7 +1487,12 b' class dirstatemap(object):' | |||
|
1476 | 1487 | self.get = self._map.get |
|
1477 | 1488 | |
|
1478 | 1489 | def write(self, st, now): |
|
1479 | st.write(parsers.pack_dirstate(self._map, self.copymap, | |
|
1490 | if rustext is not None: | |
|
1491 | pack_dirstate = rustext.dirstate.pack_dirstate | |
|
1492 | else: | |
|
1493 | pack_dirstate = parsers.pack_dirstate | |
|
1494 | ||
|
1495 | st.write(pack_dirstate(self._map, self.copymap, | |
|
1480 | 1496 | self.parents(), now)) |
|
1481 | 1497 | st.close() |
|
1482 | 1498 | self._dirtyparents = False |
@@ -16,6 +16,12 b' from mercurial import (' | |||
|
16 | 16 | ) |
|
17 | 17 | from mercurial.utils import dateutil |
|
18 | 18 | |
|
19 | try: | |
|
20 | from mercurial import rustext | |
|
21 | rustext.__name__ # force actual import (see hgdemandimport) | |
|
22 | except ImportError: | |
|
23 | rustext = None | |
|
24 | ||
|
19 | 25 | configtable = {} |
|
20 | 26 | configitem = registrar.configitem(configtable) |
|
21 | 27 | |
@@ -51,16 +57,22 b' def fakewrite(ui, func):' | |||
|
51 | 57 | # 'fakenow' value and 'touch -t YYYYmmddHHMM' argument easy |
|
52 | 58 | fakenow = dateutil.parsedate(fakenow, [b'%Y%m%d%H%M'])[0] |
|
53 | 59 | |
|
54 | orig_pack_dirstate = parsers.pack_dirstate | |
|
60 | if rustext is not None: | |
|
61 | orig_module = rustext.dirstate | |
|
62 | orig_pack_dirstate = rustext.dirstate.pack_dirstate | |
|
63 | else: | |
|
64 | orig_module = parsers | |
|
65 | orig_pack_dirstate = parsers.pack_dirstate | |
|
66 | ||
|
55 | 67 | orig_dirstate_getfsnow = dirstate._getfsnow |
|
56 | 68 | wrapper = lambda *args: pack_dirstate(fakenow, orig_pack_dirstate, *args) |
|
57 | 69 | |
|
58 |
|
|
|
70 | orig_module.pack_dirstate = wrapper | |
|
59 | 71 | dirstate._getfsnow = lambda *args: fakenow |
|
60 | 72 | try: |
|
61 | 73 | return func() |
|
62 | 74 | finally: |
|
63 |
|
|
|
75 | orig_module.pack_dirstate = orig_pack_dirstate | |
|
64 | 76 | dirstate._getfsnow = orig_dirstate_getfsnow |
|
65 | 77 | |
|
66 | 78 | def _poststatusfixup(orig, workingctx, status, fixup): |
General Comments 0
You need to be logged in to leave comments.
Login now