Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | rust/hg-core/src/filepatterns.rs (9 lines) | |||
M | rust/hg-core/src/utils/files.rs (11 lines) | |||
M | rust/hg-core/src/utils/mod.rs (9 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Raphaël Gomès | Jul 9 2019, 8:53 AM |
// filepatterns.rs | |||||
// | |||||
// Copyright 2019 Raphaël Gomès <rgomes@octobus.net> | |||||
// | |||||
// This software may be used and distributed according to the terms of the | |||||
// GNU General Public License version 2 or any later version. | |||||
//! Handling of Mercurial-specific patterns. | |||||
use crate::{LineNumber, PatternError, PatternFileError}; | use crate::{LineNumber, PatternError, PatternFileError}; | ||||
use regex::bytes::Regex; | use regex::bytes::Regex; | ||||
use std::collections::HashMap; | use std::collections::HashMap; | ||||
use std::fs::File; | use std::fs::File; | ||||
use std::io::Read; | use std::io::Read; | ||||
use std::vec::Vec; | use std::vec::Vec; | ||||
use utils::files::get_path_from_bytes; | use utils::files::get_path_from_bytes; | ||||
use utils::{replace_slice, SliceExt}; | use utils::{replace_slice, SliceExt}; |
// files.rs | |||||
// | |||||
// Copyright 2019 | |||||
// Raphaël Gomès <rgomes@octobus.net>, | |||||
// Yuya Nishihara <yuya@tcha.org> | |||||
// | |||||
// This software may be used and distributed according to the terms of the | |||||
// GNU General Public License version 2 or any later version. | |||||
//! Functions for fiddling with files. | |||||
use std::iter::FusedIterator; | use std::iter::FusedIterator; | ||||
use std::path::Path; | use std::path::Path; | ||||
pub fn get_path_from_bytes(bytes: &[u8]) -> &Path { | pub fn get_path_from_bytes(bytes: &[u8]) -> &Path { | ||||
let os_str; | let os_str; | ||||
#[cfg(unix)] | #[cfg(unix)] | ||||
{ | { | ||||
use std::os::unix::ffi::OsStrExt; | use std::os::unix::ffi::OsStrExt; |
// utils module | |||||
// | |||||
// Copyright 2019 Raphaël Gomès <rgomes@octobus.net> | |||||
// | |||||
// This software may be used and distributed according to the terms of the | |||||
// GNU General Public License version 2 or any later version. | |||||
//! Contains useful functions, traits, structs, etc. for use in core. | |||||
pub mod files; | pub mod files; | ||||
pub fn replace_slice<T>(buf: &mut [T], from: &[T], to: &[T]) | pub fn replace_slice<T>(buf: &mut [T], from: &[T], to: &[T]) | ||||
where | where | ||||
T: Clone + PartialEq, | T: Clone + PartialEq, | ||||
{ | { | ||||
if buf.len() < from.len() || from.len() != to.len() { | if buf.len() < from.len() || from.len() != to.len() { | ||||
return; | return; |