Mercurial > public > mercurial-scm > hg
comparison rust/hg-core/src/repo.rs @ 47969:87e3f878e65f
rust: Rename get_node methods to data_for_node, get_rev to data_for_rev
These are respective methods of Changelog, Manifestlog, and Filelog;
three Rust structs that that wrap a Revlog struct.
This rename clarifies that node IDs or revision numbers are parameters,
not return values.
Also reword doc-comments in Manifestlog and Filelog to separate node IDs
and revision numbers that are local to a given (non-changelog) revlog
from those of a changeset.
Differential Revision: https://phab.mercurial-scm.org/D11416
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Tue, 14 Sep 2021 18:25:51 +0200 |
parents | 796206e74b10 |
children | d1d9510f73f0 |
comparison
equal
deleted
inserted
replaced
47968:6f579618ea7b | 47969:87e3f878e65f |
---|---|
334 | 334 |
335 pub fn manifestlog_mut(&self) -> Result<RefMut<Manifestlog>, HgError> { | 335 pub fn manifestlog_mut(&self) -> Result<RefMut<Manifestlog>, HgError> { |
336 self.manifestlog.get_mut_or_init(self) | 336 self.manifestlog.get_mut_or_init(self) |
337 } | 337 } |
338 | 338 |
339 /// Returns the manifest of the given node ID | 339 /// Returns the manifest of the *changeset* with the given node ID |
340 pub fn manifest_for_node( | 340 pub fn manifest_for_node( |
341 &self, | 341 &self, |
342 node: impl Into<NodePrefix>, | 342 node: impl Into<NodePrefix>, |
343 ) -> Result<Manifest, RevlogError> { | 343 ) -> Result<Manifest, RevlogError> { |
344 self.manifestlog()?.get_node( | 344 self.manifestlog()?.data_for_node( |
345 self.changelog()? | 345 self.changelog()? |
346 .get_node(node.into())? | 346 .data_for_node(node.into())? |
347 .manifest_node()? | 347 .manifest_node()? |
348 .into(), | 348 .into(), |
349 ) | 349 ) |
350 } | 350 } |
351 | 351 |
352 /// Returns the manifest of the given revision | 352 /// Returns the manifest of the *changeset* with the given revision number |
353 pub fn manifest_for_rev( | 353 pub fn manifest_for_rev( |
354 &self, | 354 &self, |
355 revision: Revision, | 355 revision: Revision, |
356 ) -> Result<Manifest, RevlogError> { | 356 ) -> Result<Manifest, RevlogError> { |
357 self.manifestlog()?.get_node( | 357 self.manifestlog()?.data_for_node( |
358 self.changelog()?.get_rev(revision)?.manifest_node()?.into(), | 358 self.changelog()? |
359 .data_for_rev(revision)? | |
360 .manifest_node()? | |
361 .into(), | |
359 ) | 362 ) |
360 } | 363 } |
361 | 364 |
362 pub fn filelog(&self, path: &HgPath) -> Result<Filelog, HgError> { | 365 pub fn filelog(&self, path: &HgPath) -> Result<Filelog, HgError> { |
363 Filelog::open(self, path) | 366 Filelog::open(self, path) |