Patchwork D11580: dirstatemap: fix copymap.pop in Rust to return the value it pops

login
register
mail settings
Submitter phabricator
Date Oct. 2, 2021, 3:06 p.m.
Message ID <differential-rev-PHID-DREV-nbx7uroqs3gyzzljzjah-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49904/
State Superseded
Headers show

Comments

phabricator - Oct. 2, 2021, 3:06 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I guess this was overlooked in the initial implementation?
  
  Without this, the next patch would, loose copy information in setparent.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11580

AFFECTED FILES
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -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),
         }
     }