[PATCH 1 of 2 V2] filelog: add the ability to report the user facing name

Yuya Nishihara yuya at tcha.org
Tue Jan 9 07:10:45 EST 2018


On Mon, 08 Jan 2018 22:57:31 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1515355319 18000
> #      Sun Jan 07 15:01:59 2018 -0500
> # Node ID 12d63e3a9bcf3df302341ade98d014ecc98a0276
> # Parent  4c3a4bb31c0e3d9b8920b4c9b64ae930b1fe52ce
> filelog: add the ability to report the user facing name
> 
> This will be used by lfs, but is probably generally useful.  There are various
> bits of code that reverse engineer this from the index or data file names, but
> it seems better to just store it.  Especially if there's experimenting with
> backing storage other than revlog.
> 
> diff --git a/mercurial/filelog.py b/mercurial/filelog.py
> --- a/mercurial/filelog.py
> +++ b/mercurial/filelog.py
> @@ -41,9 +41,15 @@
>  
>  class filelog(revlog.revlog):
>      def __init__(self, opener, path):
> +        self._filename = path
>          super(filelog, self).__init__(opener,
>                          "/".join(("data", path + ".i")))
>  
> +    def filename(self):
> +        """Return the full name of the user visible file, relative to the
> +        repository root."""
> +        return self._filename

Minor nit, but it seems revlog API generally export variables as attributes.
Could be changed in flight if you agree.


More information about the Mercurial-devel mailing list