Submitter | phabricator |
---|---|
Date | Jan. 6, 2020, 7:25 p.m. |
Message ID | <differential-rev-PHID-DREV-ucrgxltl23uqhih2fuyf-req@mercurial-scm.org> |
Download | mbox | patch |
Permalink | /patch/44148/ |
State | Superseded |
Headers | show |
Comments
martinvonz added a comment. > The None return cases in node() match what the index_node() > C function does. You mean the code on https://www.mercurial-scm.org/repo/hg/file/fdaa4233dc18/mercurial/cext/revlog.c#l388? Line 394 there returns nullid, so does that really match? Why not return the nullid when given nullrev as input? REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7789/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7789 To: gracinet, #hg-reviewers Cc: martinvonz, durin42, kevincox, mercurial-devel
gracinet added a comment. @martinvonz yeah, probably wrote the doc-comment too fast Of course it's meant to match what revlog.c does, since the first implementation willl actually be re-exposure of the C version REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7789/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7789 To: gracinet, #hg-reviewers, martinvonz Cc: martinvonz, durin42, kevincox, mercurial-devel
Patch
diff --git a/rust/hg-core/src/revlog.rs b/rust/hg-core/src/revlog.rs --- a/rust/hg-core/src/revlog.rs +++ b/rust/hg-core/src/revlog.rs @@ -40,3 +40,15 @@ ParentOutOfRange(Revision), WorkingDirectoryUnsupported, } + +/// The Mercurial Revlog Index +/// +/// This is currently limited to the minimal interface that is needed for +/// the [`nodemap`](nodemap/index.html) module +pub trait RevlogIndex { + /// Total number of Revisions referenced in this index + fn len(&self) -> usize; + + /// Return the Node or `None` if rev is out of bounds or `NULL_REVISON` + fn node(&self, rev: Revision) -> Option<&Node>; +}