Patchwork D7117: rust-dirstatemap: remove additional lookups in dirstatemap

login
register
mail settings
Submitter phabricator
Date Oct. 16, 2019, 1:48 p.m.
Message ID <differential-rev-PHID-DREV-3bhrf4ujhb75kay43sgc-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42383/
State Superseded
Headers show

Comments

phabricator - Oct. 16, 2019, 1:48 p.m.
Alphare created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We're copying this shortcut from the Python implementation, pretty standard
  for this codebase.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7117

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1726,6 +1726,10 @@ 
             if parents and not self._dirtyparents:
                 self.setparents(*parents)
 
+            self.__contains__ = self._rustmap.__contains__
+            self.__getitem__ = self._rustmap.__getitem__
+            self.get = self._rustmap.get
+
         def write(self, st, now):
             parents = self.parents()
             st.write(self._rustmap.write(parents[0], parents[1], now))