Patchwork D11415: rust: Rename the `Revlog::get_node_rev` method to `rev_from_node`

login
register
mail settings
Submitter phabricator
Date Sept. 14, 2021, 4:46 p.m.
Message ID <differential-rev-PHID-DREV-vhg53rily4vyle6jyuvi-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49730/
State Superseded
Headers show

Comments

phabricator - Sept. 14, 2021, 4:46 p.m.
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This better describes the input and outputs of this method.
  
  Also rewrite the doc-comment, which seemed to have been left from copy-paste
  of another method.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/revlog/changelog.rs
  rust/hg-core/src/revlog/filelog.rs
  rust/hg-core/src/revlog/manifest.rs
  rust/hg-core/src/revlog/revlog.rs
  rust/hg-core/src/revset.rs

CHANGE DETAILS




To: SimonSapin, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/revset.rs b/rust/hg-core/src/revset.rs
--- a/rust/hg-core/src/revset.rs
+++ b/rust/hg-core/src/revset.rs
@@ -61,7 +61,7 @@ 
         {
             return Err(RevlogError::WDirUnsupported);
         }
-        return revlog.get_node_rev(prefix);
+        return revlog.rev_from_node(prefix);
     }
     Err(RevlogError::InvalidRevision)
 }
diff --git a/rust/hg-core/src/revlog/revlog.rs b/rust/hg-core/src/revlog/revlog.rs
--- a/rust/hg-core/src/revlog/revlog.rs
+++ b/rust/hg-core/src/revlog/revlog.rs
@@ -124,9 +124,9 @@ 
         Some(self.index.get_entry(rev)?.hash())
     }
 
-    /// Return the full data associated to a node.
+    /// Return the revision number for the given node ID, if it exists in this revlog
     #[timed]
-    pub fn get_node_rev(
+    pub fn rev_from_node(
         &self,
         node: NodePrefix,
     ) -> Result<Revision, RevlogError> {
diff --git a/rust/hg-core/src/revlog/manifest.rs b/rust/hg-core/src/revlog/manifest.rs
--- a/rust/hg-core/src/revlog/manifest.rs
+++ b/rust/hg-core/src/revlog/manifest.rs
@@ -20,7 +20,7 @@ 
 
     /// Return the `ManifestEntry` of a given node id.
     pub fn get_node(&self, node: NodePrefix) -> Result<Manifest, RevlogError> {
-        let rev = self.revlog.get_node_rev(node)?;
+        let rev = self.revlog.rev_from_node(node)?;
         self.get_rev(rev)
     }
 
diff --git a/rust/hg-core/src/revlog/filelog.rs b/rust/hg-core/src/revlog/filelog.rs
--- a/rust/hg-core/src/revlog/filelog.rs
+++ b/rust/hg-core/src/revlog/filelog.rs
@@ -30,7 +30,7 @@ 
         &self,
         file_node: impl Into<NodePrefix>,
     ) -> Result<FilelogEntry, RevlogError> {
-        let file_rev = self.revlog.get_node_rev(file_node.into())?;
+        let file_rev = self.revlog.rev_from_node(file_node.into())?;
         self.get_rev(file_rev)
     }
 
diff --git a/rust/hg-core/src/revlog/changelog.rs b/rust/hg-core/src/revlog/changelog.rs
--- a/rust/hg-core/src/revlog/changelog.rs
+++ b/rust/hg-core/src/revlog/changelog.rs
@@ -22,7 +22,7 @@ 
         &self,
         node: NodePrefix,
     ) -> Result<ChangelogEntry, RevlogError> {
-        let rev = self.revlog.get_node_rev(node)?;
+        let rev = self.revlog.rev_from_node(node)?;
         self.get_rev(rev)
     }