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

Matt Harbison mharbison72 at gmail.com
Tue Jan 9 07:49:52 EST 2018


> On Jan 9, 2018, at 7:10 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> 
>> 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.

Works for me, thanks.



More information about the Mercurial-devel mailing list