Mercurial > hg-stable
diff tests/test-status.t @ 48493: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 | c12ed33558cb |
children | 04d756b7c0b5 |
line wrap: on
line diff
--- a/tests/test-status.t Fri Dec 10 16:57:39 2021 +0100 +++ b/tests/test-status.t Fri Dec 10 16:18:58 2021 +0100 @@ -9,10 +9,6 @@ > EOF #endif -TODO: fix rhg bugs that make this test fail when status is enabled - $ unset RHG_STATUS - - $ hg init repo1 $ cd repo1 $ mkdir a b a/1 b/1 b/2 @@ -223,7 +219,7 @@ ? unknown hg status -n: - $ env RHG_STATUS=1 RHG_ON_UNSUPPORTED=abort hg status -n + $ env RHG_ON_UNSUPPORTED=abort hg status -n added removed deleted