rust/hg-core/src/filepatterns.rs
changeset 43826 5ac243a92e37
parent 42957 7a01778bc7b7
child 44303 d42eea9a0494
equal deleted inserted replaced
43825:8f26dd09aa78 43826:5ac243a92e37
     5 // This software may be used and distributed according to the terms of the
     5 // This software may be used and distributed according to the terms of the
     6 // GNU General Public License version 2 or any later version.
     6 // GNU General Public License version 2 or any later version.
     7 
     7 
     8 //! Handling of Mercurial-specific patterns.
     8 //! Handling of Mercurial-specific patterns.
     9 
     9 
    10 use crate::{utils::SliceExt, LineNumber, PatternError, PatternFileError};
    10 use crate::{
       
    11     utils::SliceExt, FastHashMap, LineNumber, PatternError, PatternFileError,
       
    12 };
    11 use lazy_static::lazy_static;
    13 use lazy_static::lazy_static;
    12 use regex::bytes::{NoExpand, Regex};
    14 use regex::bytes::{NoExpand, Regex};
    13 use std::collections::HashMap;
       
    14 use std::fs::File;
    15 use std::fs::File;
    15 use std::io::Read;
    16 use std::io::Read;
    16 use std::path::{Path, PathBuf};
    17 use std::path::{Path, PathBuf};
    17 use std::vec::Vec;
    18 use std::vec::Vec;
    18 
    19 
   212         Ok(_build_single_regex(enum_kind, pat, globsuffix))
   213         Ok(_build_single_regex(enum_kind, pat, globsuffix))
   213     }
   214     }
   214 }
   215 }
   215 
   216 
   216 lazy_static! {
   217 lazy_static! {
   217     static ref SYNTAXES: HashMap<&'static [u8], &'static [u8]> = {
   218     static ref SYNTAXES: FastHashMap<&'static [u8], &'static [u8]> = {
   218         let mut m = HashMap::new();
   219         let mut m = FastHashMap::default();
   219 
   220 
   220         m.insert(b"re".as_ref(), b"relre:".as_ref());
   221         m.insert(b"re".as_ref(), b"relre:".as_ref());
   221         m.insert(b"regexp".as_ref(), b"relre:".as_ref());
   222         m.insert(b"regexp".as_ref(), b"relre:".as_ref());
   222         m.insert(b"glob".as_ref(), b"relglob:".as_ref());
   223         m.insert(b"glob".as_ref(), b"relglob:".as_ref());
   223         m.insert(b"rootglob".as_ref(), b"rootglob:".as_ref());
   224         m.insert(b"rootglob".as_ref(), b"rootglob:".as_ref());