Patchwork [discussion-starter] context: use unfiltered repo for '.'

login
register
mail settings
Submitter Martin von Zweigbergk
Date Feb. 4, 2015, 10:26 p.m.
Message ID <0fc2520d2eb615497542.1423088777@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/7677/
State Accepted
Commit a9b61dbdb827165a9fd9d44dd42b892dbd9fa07c
Headers show

Comments

Martin von Zweigbergk - Feb. 4, 2015, 10:26 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1416514512 28800
#      Thu Nov 20 12:15:12 2014 -0800
# Node ID 0fc2520d2eb615497542d3103eab0c3c7ab25e13
# Parent  e1dbe0b215ae137eec53ceb12440536d570a83d2
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.
Matt Mackall - Feb. 5, 2015, 11:01 p.m.
On Wed, 2015-02-04 at 14:26 -0800, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1416514512 28800
> #      Thu Nov 20 12:15:12 2014 -0800
> # Node ID 0fc2520d2eb615497542d3103eab0c3c7ab25e13
> # Parent  e1dbe0b215ae137eec53ceb12440536d570a83d2
> 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.

This is such a big deal that I've just gone ahead and queued it (with an
explanatory comment). A brief look at how the filtering works
(blacklist) suggests it's going to be hard to make lazy.

Patch

diff -r e1dbe0b215ae -r 0fc2520d2eb6 mercurial/context.py
--- a/mercurial/context.py	Mon Feb 02 19:58:41 2015 -0500
+++ 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,10 @@ 
                 self._node = repo.changelog.tip()
                 self._rev = repo.changelog.rev(self._node)
                 return
+            if changeid == '.' or changeid == repo.dirstate.p1():
+                self._node = repo.dirstate.p1()
+                self._rev = repo.unfiltered().changelog.rev(self._node)
+                return
             if len(changeid) == 20:
                 try:
                     self._node = changeid