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,
)
| 1130 | /// |
| 1131 | /// Returns `None` if the file is not tracked or has no graph position. |
| 1132 | pub fn get_inode_and_position( |
| 1133 | &self, |
| 1134 | path: &str, |
| 1135 | ) -> Result<Option<(Inode, Position<NodeId>)>, RepositoryError> { |
| 1136 | use atomic_core::pristine::TreeTxnT; |
| 1137 | |
| 1138 | let txn = self |
| 1139 | .pristine |
| 1140 | .read_txn() |
| 1141 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 1142 | |
| 1143 | let inode = match txn |
| 1144 | .get_inode(path) |
| 1145 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 1146 | { |
| 1147 | Some(i) => i, |
| 1148 | None => return Ok(None), |
| 1149 | }; |
| 1150 | |
| 1151 | let position = match txn |
| 1152 | .inode_position(inode) |
| 1153 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 1154 | { |
| 1155 | Some(p) => p, |
| 1156 | None => return Ok(None), |
| 1157 | }; |
| 1158 | |
| 1159 | Ok(Some((inode, position))) |
| 1160 | } |
| 1161 | |
| 1162 | /// Record all changes with a message. |
| 1163 | /// |