[Updated] D9022: repo: avoid copying/updating a dict on every `repo.__getitem__`

spectral (Kyle Lippincott) phabricator at mercurial-scm.org
Wed Sep 16 08:50:40 UTC 2020


Closed by commit rHG4a0ccbecbaa6: repo: avoid copying/updating a dict on every `repo.__getitem__` (authored by spectral).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9022?vs=22645&id=22648

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9022/new/

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1570,7 +1570,7 @@
     def _quick_access_changeid_wc(self):
         # also fast path access to the working copy parents
         # however, only do it for filter that ensure wc is visible.
-        quick = {}
+        quick = self._quick_access_changeid_null.copy()
         cl = self.unfiltered().changelog
         for node in self.dirstate.parents():
             if node == nullid:
@@ -1609,11 +1609,9 @@
         This contains a list of symbol we can recognise right away without
         further processing.
         """
-        mapping = self._quick_access_changeid_null
         if self.filtername in repoview.filter_has_wc:
-            mapping = mapping.copy()
-            mapping.update(self._quick_access_changeid_wc)
-        return mapping
+            return self._quick_access_changeid_wc
+        return self._quick_access_changeid_null
 
     def __getitem__(self, changeid):
         # dealing with special cases



To: spectral, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200916/3de81292/attachment-0002.html>


More information about the Mercurial-patches mailing list