diff mercurial/context.py @ 24050:a9b61dbdb827

context: use unfiltered repo for '.' There is no reason to read obsolescence markers when doing a plain 'hg status' without --rev. Use the unfiltered repo when initializing context._rev to speed things up. This speeds up 'hg status' from 1.342s to 0.080s on my repo with ~110k markers.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 20 Nov 2014 12:15:12 -0800
parents 2896f53509a7
children d8e0c591781c
line wrap: on
line diff
--- a/mercurial/context.py	Thu Feb 05 14:09:08 2015 -0800
+++ b/mercurial/context.py	Thu Nov 20 12:15:12 2014 -0800
@@ -376,10 +376,6 @@
                 return
             if isinstance(changeid, long):
                 changeid = str(changeid)
-            if changeid == '.':
-                self._node = repo.dirstate.p1()
-                self._rev = repo.changelog.rev(self._node)
-                return
             if changeid == 'null':
                 self._node = nullid
                 self._rev = nullrev
@@ -388,6 +384,12 @@
                 self._node = repo.changelog.tip()
                 self._rev = repo.changelog.rev(self._node)
                 return
+            if changeid == '.' or changeid == repo.dirstate.p1():
+                # this is a hack to delay/avoid loading obsmarkers
+                # when we know that '.' won't be hidden
+                self._node = repo.dirstate.p1()
+                self._rev = repo.unfiltered().changelog.rev(self._node)
+                return
             if len(changeid) == 20:
                 try:
                     self._node = changeid