Patchwork D9479: rhg: allow specifying a changeset ID prefix

login
register
mail settings
Submitter phabricator
Date Dec. 1, 2020, 6:27 p.m.
Message ID <differential-rev-PHID-DREV-fpp76mp5u6btfsha4e3k-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47760/
State Superseded
Headers show

Comments

phabricator - Dec. 1, 2020, 6:27 p.m.
SimonSapin 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/D9479

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

CHANGE DETAILS




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

Patch

diff --git a/tests/test-rhg.t b/tests/test-rhg.t
--- a/tests/test-rhg.t
+++ b/tests/test-rhg.t
@@ -130,11 +130,10 @@ 
   summary:     add original
   
   $ rhg files -r 41263439dc17
-  abort: invalid revision identifier 41263439dc17
-  [255]
+  copy_of_original
+  original
   $ rhg cat -r 41263439dc17 original
-  abort: invalid revision identifier 41263439dc17
-  [255]
+  original content
 
 Requirements
   $ rhg debugrequirements
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
@@ -96,7 +96,7 @@ 
         for rev in (0..self.len() as Revision).rev() {
             let index_entry =
                 self.index.get_entry(rev).ok_or(RevlogError::Corrupted)?;
-            if node == index_entry.hash() {
+            if index_entry.hash().starts_with(node) {
                 return Ok(rev);
             }
         }