pub trait ChangeIdIndex: Send + Sync {
    // Required methods
    fn resolve_prefix(
        &self,
        prefix: &HexPrefix
    ) -> PrefixResolution<Vec<CommitId>>;
    fn shortest_unique_prefix_len(&self, change_id: &ChangeId) -> usize;
}

Required Methods§

source

fn resolve_prefix(&self, prefix: &HexPrefix) -> PrefixResolution<Vec<CommitId>>

Resolve an unambiguous change ID prefix to the commit IDs in the revset.

source

fn shortest_unique_prefix_len(&self, change_id: &ChangeId) -> usize

This function returns the shortest length of a prefix of key that disambiguates it from every other key in the index.

The length to be returned is a number of hexadecimal digits.

This has some properties that we do not currently make much use of:

  • The algorithm works even if key itself is not in the index.

  • In the special case when there are keys in the trie for which our key is an exact prefix, returns key.len() + 1. Conceptually, in order to disambiguate, you need every letter of the key and the additional fact that it’s the entire key). This case is extremely unlikely for hashes with 12+ hexadecimal characters.

Implementors§