Patchwork context.status: explain "caching reasons" more fully

login
register
mail settings
Submitter Martin von Zweigbergk
Date Nov. 11, 2014, 6:17 p.m.
Message ID <c5c6b4f91232f45cd798.1415729862@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6684/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Nov. 11, 2014, 6:17 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1415729814 28800
#      Tue Nov 11 10:16:54 2014 -0800
# Node ID c5c6b4f91232f45cd798023e369c39e63b80dd37
# Parent  18cc87e4375afaeb5986ef9e941854cefa893759
context.status: explain "caching reasons" more fully

Where we "load earliest manifest first for caching reasons", elaborate
on what "caching reasons" refers to. Text provided by Matt in
http://thread.gmane.org/gmane.comp.version-control.mercurial.devel/73235/focus=73578.
Pierre-Yves David - Nov. 11, 2014, 7:27 p.m.
On 11/11/2014 06:17 PM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1415729814 28800
> #      Tue Nov 11 10:16:54 2014 -0800
> # Node ID c5c6b4f91232f45cd798023e369c39e63b80dd37
> # Parent  18cc87e4375afaeb5986ef9e941854cefa893759
> context.status: explain "caching reasons" more fully

Pushed to the clowncopter, thanks.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -96,7 +96,12 @@ 
     def _buildstatus(self, other, s, match, listignored, listclean,
                      listunknown):
         """build a status with respect to another context"""
-        # load earliest manifest first for caching reasons
+        # Load earliest manifest first for caching reasons. More specifically,
+        # if you have revisions 1000 and 1001, 1001 is probably stored as a
+        # delta against 1000. Thus, if you read 1000 first, we'll reconstruct
+        # 1000 and cache it so that when you read 1001, we just need to apply a
+        # delta to what's in the cache. So that's one full reconstruction + one
+        # delta application.
         if self.rev() is not None and self.rev() < other.rev():
             self.manifest()
         mf1 = other._manifestmatches(match, s)