[PATCH] filectx: replace use of _filerev with _filenode

Siddharth Agarwal sid at less-broken.com
Mon Feb 8 17:55:48 EST 2016


On 2/8/16 14:48, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1454969831 28800
> #      Mon Feb 08 14:17:11 2016 -0800
> # Node ID b8f90918f80e13e468d0fa22ca2f678896223cbd
> # Parent  01a5143cd25f285f8c745a92986cd7186bb32c90
> filectx: replace use of _filerev with _filenode
>
> _filerev depends on the filelog implementation using revlogs and linkrevs.
> Alternative implementations, like remotefilelog, do not have rev numbers, so
> this call fails. Replacing it with _filenode means it doesn't rely on rev
> numbers, and doesn't cost anything extra, since _filerev is using _filenode
> under the hood anyway.

Someone else can easily reintroduce a dependency on _filerev without 
realizing -- as a followup, can we deprecate it somehow?


>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -789,7 +789,7 @@ class basefilectx(object):
>           if fctx._customcmp:
>               return fctx.cmp(self)
>   
> -        if (fctx._filerev is None
> +        if (fctx._filenode is None
>               and (self._repo._encodefilterpats
>                    # if file data starts with '\1\n', empty metadata block is
>                    # prepended, which adds 4 bytes to filelog.size().
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list