dirstatemap: fix copymap.pop in Rust to return the value it pops
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sat, 02 Oct 2021 00:44:17 +0200
changeset 48135 bd5f7c61d69d
parent 48134 3c7db97ce541
child 48136 bda85920de6b
dirstatemap: fix copymap.pop in Rust to return the value it pops I guess this was overlooked in the initial implementation? Without this, the next patch would, loose copy information in setparent. Differential Revision: https://phab.mercurial-scm.org/D11580
rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs	Sat Oct 02 00:14:32 2021 +0200
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs	Sat Oct 02 00:44:17 2021 +0200
@@ -401,7 +401,9 @@
             .copy_map_remove(HgPath::new(key.data(py)))
             .map_err(|e| v2_error(py, e))?
         {
-            Some(_) => Ok(None),
+            Some(copy) => Ok(Some(
+                PyBytes::new(py, copy.as_bytes()).into_object(),
+            )),
             None => Ok(default),
         }
     }