Mercurial > hg
view rust/rhg/Cargo.toml @ 48454:473af5cbc209
rhg: Add support for `rhg status --copies`
Copy sources are collected during `status()` rather than after the fact like
in Python, because `status()` takes a `&mut` exclusive reference to the dirstate map
(in order to potentially mutate it for directory mtimes) and returns `Cow<'_, HgPath>`
that borrow the dirstate map.
Even though with `Cow` only some shared borrows remain, the still extend the same
lifetime of the initial `&mut` so the dirstate map cannot be borrowed again
to access copy sources after the fact:
https://doc.rust-lang.org/nomicon/lifetime-mismatch.html#limits-of-lifetimes
Additionally, collecting copy sources during the dirstate tree traversal that
`status()` already does avoids the cost of another traversal or other lookups
(though I haven’t benchmarked that cost).
Differential Revision: https://phab.mercurial-scm.org/D11899
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Fri, 10 Dec 2021 16:18:58 +0100 |
parents | ebdef6283798 |
children | d3ec82016104 |
line wrap: on
line source
[package] name = "rhg" version = "0.1.0" authors = [ "Antoine Cezar <antoine.cezar@octobus.net>", "Raphaël Gomès <raphael.gomes@octobus.net>", ] edition = "2018" [dependencies] hg-core = { path = "../hg-core"} chrono = "0.4.19" clap = "2.33.1" derive_more = "0.99" home = "0.5.3" lazy_static = "1.4.0" log = "0.4.11" micro-timer = "0.3.1" regex = "1.3.9" env_logger = "0.7.1" format-bytes = "0.2.1" users = "0.11.0"