Submitter | Matt Harbison |
---|---|
Date | Jan. 9, 2018, 3:57 a.m. |
Message ID | <12d63e3a9bcf3df30234.1515470251@Envy> |
Download | mbox | patch |
Permalink | /patch/26623/ |
State | Accepted |
Headers | show |
Comments
On Mon, 08 Jan 2018 22:57:31 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison <matt_harbison@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.
> On Jan 9, 2018, at 7:10 AM, Yuya Nishihara <yuya@tcha.org> wrote: > >> On Mon, 08 Jan 2018 22:57:31 -0500, Matt Harbison wrote: >> # HG changeset patch >> # User Matt Harbison <matt_harbison@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.
On Tue, 9 Jan 2018 07:49:52 -0500, Matt Harbison wrote: > > > On Jan 9, 2018, at 7:10 AM, Yuya Nishihara <yuya@tcha.org> wrote: > > > >> On Mon, 08 Jan 2018 22:57:31 -0500, Matt Harbison wrote: > >> # HG changeset patch > >> # User Matt Harbison <matt_harbison@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. Queued updated version, thanks.
Patch
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 + def read(self, node): t = self.revision(node) if not t.startswith('\1\n'):