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

Matt Harbison mharbison72 at gmail.com
Tue Jan 9 03:57:31 UTC 2018


# 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
+
     def read(self, node):
         t = self.revision(node)
         if not t.startswith('\1\n'):


More information about the Mercurial-devel mailing list