Let's use the new API
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
( )
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | rust/hg-cpython/src/dirstate/dirstate_map.rs (4 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
e63d1203a7b5 | 57ea44643c5b | Raphaël Gomès | Tue, Apr 12, 11:25 AM |
Status | Author | Revision | |
---|---|---|---|
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare |
dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator}, | dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator}, | ||||
dirstate::item::DirstateItem, | dirstate::item::DirstateItem, | ||||
pybytes_deref::PyBytesDeref, | pybytes_deref::PyBytesDeref, | ||||
}; | }; | ||||
use hg::{ | use hg::{ | ||||
dirstate::StateMapIter, dirstate_tree::on_disk::DirstateV2ParseError, | dirstate::StateMapIter, dirstate_tree::on_disk::DirstateV2ParseError, | ||||
dirstate_tree::owning::OwningDirstateMap, revlog::Node, | dirstate_tree::owning::OwningDirstateMap, revlog::Node, | ||||
utils::files::normalize_case, utils::hg_path::HgPath, DirstateEntry, | utils::files::normalize_case, utils::hg_path::HgPath, DirstateEntry, | ||||
DirstateError, DirstateParents, EntryState, | DirstateError, DirstateParents, | ||||
}; | }; | ||||
// TODO | // TODO | ||||
// This object needs to share references to multiple members of its Rust | // This object needs to share references to multiple members of its Rust | ||||
// inner struct, namely `copy_map`, `dirs` and `all_dirs`. | // inner struct, namely `copy_map`, `dirs` and `all_dirs`. | ||||
// Right now `CopyMap` is done, but it needs to have an explicit reference | // Right now `CopyMap` is done, but it needs to have an explicit reference | ||||
// to `RustDirstateMap` which itself needs to have an encapsulation for | // to `RustDirstateMap` which itself needs to have an encapsulation for | ||||
// every method in `CopyMap` (copymapcopy, etc.). | // every method in `CopyMap` (copymapcopy, etc.). | ||||
)), | )), | ||||
} | } | ||||
} | } | ||||
def filefoldmapasdict(&self) -> PyResult<PyDict> { | def filefoldmapasdict(&self) -> PyResult<PyDict> { | ||||
let dict = PyDict::new(py); | let dict = PyDict::new(py); | ||||
for item in self.inner(py).borrow_mut().iter() { | for item in self.inner(py).borrow_mut().iter() { | ||||
let (path, entry) = item.map_err(|e| v2_error(py, e))?; | let (path, entry) = item.map_err(|e| v2_error(py, e))?; | ||||
if entry.state() != EntryState::Removed { | if !entry.removed() { | ||||
let key = normalize_case(path); | let key = normalize_case(path); | ||||
let value = path; | let value = path; | ||||
dict.set_item( | dict.set_item( | ||||
py, | py, | ||||
PyBytes::new(py, key.as_bytes()).into_object(), | PyBytes::new(py, key.as_bytes()).into_object(), | ||||
PyBytes::new(py, value.as_bytes()).into_object(), | PyBytes::new(py, value.as_bytes()).into_object(), | ||||
)?; | )?; | ||||
} | } |