rust/hg-cpython/src/cindex.rs
branchstable
changeset 41350 ab0d762d89ef
parent 41054 ef54bd33b476
child 42609 326fdce22fb2
--- a/rust/hg-cpython/src/cindex.rs	Wed Jan 23 07:47:04 2019 -0500
+++ b/rust/hg-cpython/src/cindex.rs	Wed Jan 23 07:49:36 2019 -0500
@@ -16,7 +16,7 @@
 
 use self::python_sys::PyCapsule_Import;
 use cpython::{PyClone, PyErr, PyObject, PyResult, Python};
-use hg::{Graph, GraphError, Revision};
+use hg::{Graph, GraphError, Revision, WORKING_DIRECTORY_REVISION};
 use libc::c_int;
 use std::ffi::CStr;
 use std::mem::transmute;
@@ -86,6 +86,9 @@
 impl Graph for Index {
     /// wrap a call to the C extern parents function
     fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError> {
+        if rev == WORKING_DIRECTORY_REVISION {
+            return Err(GraphError::WorkingDirectoryUnsupported);
+        }
         let mut res: [c_int; 2] = [0; 2];
         let code = unsafe {
             (self.parents)(