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,
)
| 956 | /// |
| 957 | /// Returns `None` if the file is not tracked or has no graph position. |
| 958 | pub fn get_inode_and_position( |
| 959 | &self, |
| 960 | path: &str, |
| 961 | ) -> Result<Option<(Inode, Position<NodeId>)>, RepositoryError> { |
| 962 | use atomic_core::pristine::TreeTxnT; |
| 963 | |
| 964 | let txn = self |
| 965 | .pristine |
| 966 | .read_txn() |
| 967 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 968 | |
| 969 | let inode = match txn |
| 970 | .get_inode(path) |
| 971 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 972 | { |
| 973 | Some(i) => i, |
| 974 | None => return Ok(None), |
| 975 | }; |
| 976 | |
| 977 | let position = match txn |
| 978 | .inode_position(inode) |
| 979 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 980 | { |
| 981 | Some(p) => p, |
| 982 | None => return Ok(None), |
| 983 | }; |
| 984 | |
| 985 | Ok(Some((inode, position))) |
| 986 | } |
| 987 | |
| 988 | /// Record all changes with a message. |
| 989 | /// |