[PATCH 4 of 4] files: cache repo.dirstate

Siddharth Agarwal sid0 at fb.com
Tue Sep 30 18:08:22 CDT 2014


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1412118079 25200
#      Tue Sep 30 16:01:19 2014 -0700
# Node ID 927bc353a55e1e92d7af429ba850b6d279a5998b
# Parent  7a1f88d04efc612c8070ac0d7c59d8b33c37d438
files: cache repo.dirstate

For a large repo, 'hg files' goes from 2.27 seconds to 1.92.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3219,8 +3219,9 @@
     fmt = '%s' + end
 
     m = scmutil.match(ctx, pats, opts)
+    ds = repo.dirstate
     for f in ctx.matches(m):
-        if rev is None and repo.dirstate[f] == 'r':
+        if rev is None and ds[f] == 'r':
             continue
         fm.startitem()
         if ui.verbose:


More information about the Mercurial-devel mailing list