[PATCH 2 of 8] filectx: remove dependencies on filerev

Durham Goode durham at fb.com
Mon Jun 10 19:03:11 CDT 2013


On 5/31/13 10:19 AM, "Durham Goode" <durham at fb.com> wrote:

># HG changeset patch
># User Durham Goode <durham at fb.com>
># Date 1369967361 25200
>#      Thu May 30 19:29:21 2013 -0700
># Node ID 3f547fa7afcace32827789deb6865b789970f158
># Parent  d6d28e9ca7f60bf791f0b9226804f9010441d88f
>filectx: remove dependencies on filerev
>
>Removing dependencies on filectx.filerev() makes it easier to create a
>filelog
>implementation that doesn't have rev numbers.
>
>diff --git a/mercurial/context.py b/mercurial/context.py
>--- a/mercurial/context.py
>+++ b/mercurial/context.py
>@@ -677,7 +677,7 @@
> 
>         # use linkrev to find the first changeset where self appeared
>         if self.rev() != self.linkrev():
>-            base = self.filectx(self.filerev())
>+            base = self.filectx(self.filenode())
>         else:
>             base = self
> 
>@@ -746,7 +746,7 @@
>         # prime the ancestor cache for the working directory
>         acache = {}
>         for c in (self, fc2):
>-            if c._filerev is None:
>+            if c.filenode() is None:
>                 pl = [(n.path(), n.filenode()) for n in c.parents()]
>                 acache[(c._path, None)] = pl
> 

I looked into whether these might hurt the fast path.

Line 677: Since self.linkrev() is called immediately before, the index
entry should already be in memory, so self.filenode() won't cause a disk
hit.

Line 746: 15 lines below this change we are guaranteed to call
self._filenode and fc2._filenode, so my change doesn't introduce any extra
disk hit here either.


Matt, does that ease your concerns over perf here?  I looked at patch #1
in this series (about nullid vs nullrev), and I can abandon that patch and
handle that case internally in my extension.



More information about the Mercurial-devel mailing list