Mercurial > hg
comparison rust/hg-cpython/src/dirstate/dirstate_map.rs @ 47567:7a15dea6d303
dirstate-item: also build DistateItem in dirstate.directories()
The rust code was building tuple.
Differential Revision: https://phab.mercurial-scm.org/D10983
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 05 Jul 2021 10:32:49 +0200 |
parents | 84391ddf4c78 |
children | ff97e793ed36 |
comparison
equal
deleted
inserted
replaced
47566:3df817387ea3 | 47567:7a15dea6d303 |
---|---|
17 UnsafePyLeaked, | 17 UnsafePyLeaked, |
18 }; | 18 }; |
19 | 19 |
20 use crate::{ | 20 use crate::{ |
21 dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator}, | 21 dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator}, |
22 dirstate::make_directory_item, | |
22 dirstate::make_dirstate_item, | 23 dirstate::make_dirstate_item, |
23 dirstate::non_normal_entries::{ | 24 dirstate::non_normal_entries::{ |
24 NonNormalEntries, NonNormalEntriesIterator, | 25 NonNormalEntries, NonNormalEntriesIterator, |
25 }, | 26 }, |
26 dirstate::owning::OwningDirstateMap, | 27 dirstate::owning::OwningDirstateMap, |
517 let dirs = PyList::new(py, &[]); | 518 let dirs = PyList::new(py, &[]); |
518 for item in self.inner(py).borrow().iter_directories() { | 519 for item in self.inner(py).borrow().iter_directories() { |
519 let (path, mtime) = item.map_err(|e| v2_error(py, e))?; | 520 let (path, mtime) = item.map_err(|e| v2_error(py, e))?; |
520 let path = PyBytes::new(py, path.as_bytes()); | 521 let path = PyBytes::new(py, path.as_bytes()); |
521 let mtime = mtime.map(|t| t.0).unwrap_or(-1); | 522 let mtime = mtime.map(|t| t.0).unwrap_or(-1); |
522 let tuple = (path, (b'd', 0, 0, mtime)); | 523 let item = make_directory_item(py, mtime as i32)?; |
524 let tuple = (path, item); | |
523 dirs.append(py, tuple.to_py_object(py).into_object()) | 525 dirs.append(py, tuple.to_py_object(py).into_object()) |
524 } | 526 } |
525 Ok(dirs) | 527 Ok(dirs) |
526 } | 528 } |
527 | 529 |