Look up a file's inode and graph position from the pristine. Returns `None` if the file is not tracked or has no graph position.
(
&self,
path: &str,
)
| 935 | /// |
| 936 | /// Returns `None` if the file is not tracked or has no graph position. |
| 937 | pub fn get_inode_and_position( |
| 938 | &self, |
| 939 | path: &str, |
| 940 | ) -> Result<Option<(Inode, Position<NodeId>)>, RepositoryError> { |
| 941 | use atomic_core::pristine::TreeTxnT; |
| 942 | |
| 943 | let txn = self |
| 944 | .pristine |
| 945 | .read_txn() |
| 946 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 947 | |
| 948 | let inode = match txn |
| 949 | .get_inode(path) |
| 950 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 951 | { |
| 952 | Some(i) => i, |
| 953 | None => return Ok(None), |
| 954 | }; |
| 955 | |
| 956 | let position = match txn |
| 957 | .inode_position(inode) |
| 958 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 959 | { |
| 960 | Some(p) => p, |
| 961 | None => return Ok(None), |
| 962 | }; |
| 963 | |
| 964 | Ok(Some((inode, position))) |
| 965 | } |
| 966 | |
| 967 | /// Record all changes with a message. |
| 968 | /// |