Patchwork D3882: manifest: define and implement rev() on manifestlog

login
register
mail settings
Submitter phabricator
Date July 5, 2018, 12:10 p.m.
Message ID <20f5474cdb48669091e85c82c8d9e9a9@localhost.localdomain>
Download mbox | patch
Permalink /patch/32635/
State Not Applicable
Headers show

Comments

phabricator - July 5, 2018, 12:10 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf2f9bacf0587: manifest: define and implement rev() on manifestlog (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3882?vs=9433&id=9453

REVISION DETAIL
  https://phab.mercurial-scm.org/D3882

AFFECTED FILES
  mercurial/logcmdutil.py
  mercurial/manifest.py
  mercurial/repository.py
  mercurial/templatekw.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -465,7 +465,7 @@ 
     if mnode is None:
         # just avoid crash, we might want to use the 'ff...' hash in future
         return
-    mrev = repo.manifestlog._revlog.rev(mnode)
+    mrev = repo.manifestlog.rev(mnode)
     mhex = hex(mnode)
     mapping = context.overlaymap(mapping, {'rev': mrev, 'node': mhex})
     f = context.process('manifest', mapping)
diff --git a/mercurial/repository.py b/mercurial/repository.py
--- a/mercurial/repository.py
+++ b/mercurial/repository.py
@@ -922,6 +922,12 @@ 
     def clearcaches():
         """Clear caches associated with this collection."""
 
+    def rev(node):
+        """Obtain the revision number for a binary node.
+
+        Raises ``error.LookupError`` if the node is not known.
+        """
+
 class completelocalrepository(interfaceutil.Interface):
     """Monolithic interface for local repositories.
 
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1348,6 +1348,9 @@ 
         self._dirmancache.clear()
         self._revlog.clearcaches()
 
+    def rev(self, node):
+        return self._revlog.rev(node)
+
 @interfaceutil.implementer(repository.imanifestrevisionwritable)
 class memmanifestctx(object):
     def __init__(self, manifestlog):
diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -228,7 +228,7 @@ 
 
         if self.ui.debugflag and rev is not None:
             mnode = ctx.manifestnode()
-            mrev = self.repo.manifestlog._revlog.rev(mnode)
+            mrev = self.repo.manifestlog.rev(mnode)
             self.ui.write(columns['manifest']
                           % scmutil.formatrevnode(self.ui, mrev, mnode),
                           label='ui.debug log.manifest')