diff rust/hg-core/src/revlog/node.rs @ 48421:2097f63575a5

rhg: Add Repo::write_dirstate This method is not used yet. It saves to disk any mutation that was done to the `Repo`’s dirstate through `Repo::dirstate_map_mut`. It takes care of dirstate-v1 v.s. dirstate-v2, dockets, data files, appending when possible, etc. Differential Revision: https://phab.mercurial-scm.org/D11839
author Simon Sapin <simon.sapin@octobus.net>
date Thu, 02 Dec 2021 15:10:03 +0100
parents b1f2c2b336ec
children 34decbaf4da3
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/node.rs	Thu Dec 02 12:05:36 2021 +0100
+++ b/rust/hg-core/src/revlog/node.rs	Thu Dec 02 15:10:03 2021 +0100
@@ -174,6 +174,12 @@
             data: self.data,
         }
     }
+
+    pub fn pad_to_256_bits(&self) -> [u8; 32] {
+        let mut bits = [0; 32];
+        bits[..NODE_BYTES_LENGTH].copy_from_slice(&self.data);
+        bits
+    }
 }
 
 /// The beginning of a binary revision SHA.