aalekseyev created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/revlog/revlog.rs
  tests/test-rhg.t

CHANGE DETAILS

diff --git a/tests/test-rhg.t b/tests/test-rhg.t
--- a/tests/test-rhg.t
+++ b/tests/test-rhg.t
@@ -129,8 +129,8 @@
   $ $NO_FALLBACK rhg cat -r d file-2
   2
   $ $NO_FALLBACK rhg cat -r 0000 file-2
-  abort: invalid revision identifier: 0000
-  [255]
+  file-2: no such file in rev 000000000000
+  [1]
 
 Cat files
   $ cd $TESTTMP
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
@@ -76,7 +76,8 @@
                 Some(index_mmap) => {
                     let version = get_version(&index_mmap)?;
                     if version != 1 {
-                        // A proper new version should have had a repo/store 
requirement.
+                        // A proper new version should have had a repo/store
+                        // requirement.
                         return Err(HgError::corrupted("corrupted revlog"));
                     }
 
@@ -128,6 +129,9 @@
     /// Returns the node ID for the given revision number, if it exists in this
     /// revlog
     pub fn node_from_rev(&self, rev: Revision) -> Option<&Node> {
+        if rev == NULL_REVISION {
+            return Some(&NULL_NODE);
+        }
         Some(self.index.get_entry(rev)?.hash())
     }
 
@@ -424,6 +428,6 @@
             .with_version(1)
             .build();
 
-        assert_eq!(get_version(&bytes).map_err(|_err|()), Ok(1))
+        assert_eq!(get_version(&bytes).map_err(|_err| ()), Ok(1))
     }
 }



To: aalekseyev, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to