Show More
@@ -962,32 +962,29 b' def debugstate(ui, repo, **opts):' | |||
|
962 | 962 | datesort = opts.get('datesort') |
|
963 | 963 | |
|
964 | 964 | if datesort: |
|
965 | keyfunc = lambda x: ( | |
|
966 | x[1].v1_mtime(), | |
|
967 | x[0], | |
|
968 |
) |
|
|
965 | ||
|
966 | def keyfunc(entry): | |
|
967 | filename, _state, _mode, _size, mtime = entry | |
|
968 | return (mtime, filename) | |
|
969 | ||
|
969 | 970 | else: |
|
970 | 971 | keyfunc = None # sort by filename |
|
971 | 972 | entries = list(repo.dirstate._map.debug_iter(all=opts['all'])) |
|
972 | 973 | entries.sort(key=keyfunc) |
|
973 |
for |
|
|
974 | if ent.v1_mtime() == -1: | |
|
974 | for entry in entries: | |
|
975 | filename, state, mode, size, mtime = entry | |
|
976 | if mtime == -1: | |
|
975 | 977 | timestr = b'unset ' |
|
976 | 978 | elif nodates: |
|
977 | 979 | timestr = b'set ' |
|
978 | 980 | else: |
|
979 | timestr = time.strftime( | |
|
980 | "%Y-%m-%d %H:%M:%S ", time.localtime(ent.v1_mtime()) | |
|
981 | ) | |
|
981 | timestr = time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(mtime)) | |
|
982 | 982 | timestr = encoding.strtolocal(timestr) |
|
983 |
if |
|
|
983 | if mode & 0o20000: | |
|
984 | 984 | mode = b'lnk' |
|
985 | 985 | else: |
|
986 |
mode = b'%3o' % ( |
|
|
987 | ui.write( | |
|
988 | b"%c %s %10d %s%s\n" | |
|
989 | % (ent.v1_state(), mode, ent.v1_size(), timestr, file_) | |
|
990 | ) | |
|
986 | mode = b'%3o' % (mode & 0o777 & ~util.umask) | |
|
987 | ui.write(b"%c %s %10d %s%s\n" % (state, mode, size, timestr, filename)) | |
|
991 | 988 | for f in repo.dirstate.copies(): |
|
992 | 989 | ui.write(_(b"copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
|
993 | 990 |
@@ -120,9 +120,12 b' class dirstatemap(object):' | |||
|
120 | 120 | |
|
121 | 121 | def debug_iter(self, all): |
|
122 | 122 | """ |
|
123 | Return an iterator of (filename, state, mode, size, mtime) tuples | |
|
124 | ||
|
123 | 125 | `all` is unused when Rust is not enabled |
|
124 | 126 | """ |
|
125 |
|
|
|
127 | for (filename, item) in self.items(): | |
|
128 | yield (filename, item.state, item.mode, item.size, item.mtime) | |
|
126 | 129 | |
|
127 | 130 | def __len__(self): |
|
128 | 131 | return len(self._map) |
@@ -705,6 +708,13 b' if rustmod is not None:' | |||
|
705 | 708 | return self._rustmap.copymap() |
|
706 | 709 | |
|
707 | 710 | def debug_iter(self, all): |
|
711 | """ | |
|
712 | Return an iterator of (filename, state, mode, size, mtime) tuples | |
|
713 | ||
|
714 | `all`: also include with `state == b' '` dirstate tree nodes that | |
|
715 | don't have an associated `DirstateItem`. | |
|
716 | ||
|
717 | """ | |
|
708 | 718 | return self._rustmap.debug_iter(all) |
|
709 | 719 | |
|
710 | 720 | def preload(self): |
@@ -20,7 +20,6 b' use cpython::{' | |||
|
20 | 20 | use crate::{ |
|
21 | 21 | dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator}, |
|
22 | 22 | dirstate::make_dirstate_item, |
|
23 | dirstate::make_dirstate_item_raw, | |
|
24 | 23 | dirstate::non_normal_entries::{ |
|
25 | 24 | NonNormalEntries, NonNormalEntriesIterator, |
|
26 | 25 | }, |
@@ -612,8 +611,8 b' py_class!(pub class DirstateMap |py| {' | |||
|
612 | 611 | let (path, (state, mode, size, mtime)) = |
|
613 | 612 | item.map_err(|e| v2_error(py, e))?; |
|
614 | 613 | let path = PyBytes::new(py, path.as_bytes()); |
|
615 |
let item = |
|
|
616 |
dirs.append(py, |
|
|
614 | let item = (path, state, mode, size, mtime); | |
|
615 | dirs.append(py, item.to_py_object(py).into_object()) | |
|
617 | 616 | } |
|
618 | 617 | Ok(dirs) |
|
619 | 618 | } |
General Comments 0
You need to be logged in to leave comments.
Login now