Show More
@@ -901,8 +901,6 b' class revlog(object):' | |||||
901 | common = [nullrev] |
|
901 | common = [nullrev] | |
902 |
|
902 | |||
903 | if rustext is not None: |
|
903 | if rustext is not None: | |
904 | # TODO: WdirUnsupported should be raised instead of GraphError |
|
|||
905 | # if common includes wdirrev |
|
|||
906 | return rustext.ancestor.MissingAncestors(self.index, common) |
|
904 | return rustext.ancestor.MissingAncestors(self.index, common) | |
907 | return ancestor.incrementalmissingancestors(self.parentrevs, common) |
|
905 | return ancestor.incrementalmissingancestors(self.parentrevs, common) | |
908 |
|
906 |
@@ -16,7 +16,7 b' extern crate python3_sys as python_sys;' | |||||
16 |
|
16 | |||
17 | use self::python_sys::PyCapsule_Import; |
|
17 | use self::python_sys::PyCapsule_Import; | |
18 | use cpython::{PyClone, PyErr, PyObject, PyResult, Python}; |
|
18 | use cpython::{PyClone, PyErr, PyObject, PyResult, Python}; | |
19 | use hg::{Graph, GraphError, Revision}; |
|
19 | use hg::{Graph, GraphError, Revision, WORKING_DIRECTORY_REVISION}; | |
20 | use libc::c_int; |
|
20 | use libc::c_int; | |
21 | use std::ffi::CStr; |
|
21 | use std::ffi::CStr; | |
22 | use std::mem::transmute; |
|
22 | use std::mem::transmute; | |
@@ -86,6 +86,9 b' impl Clone for Index {' | |||||
86 | impl Graph for Index { |
|
86 | impl Graph for Index { | |
87 | /// wrap a call to the C extern parents function |
|
87 | /// wrap a call to the C extern parents function | |
88 | fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError> { |
|
88 | fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError> { | |
|
89 | if rev == WORKING_DIRECTORY_REVISION { | |||
|
90 | return Err(GraphError::WorkingDirectoryUnsupported); | |||
|
91 | } | |||
89 | let mut res: [c_int; 2] = [0; 2]; |
|
92 | let mut res: [c_int; 2] = [0; 2]; | |
90 | let code = unsafe { |
|
93 | let code = unsafe { | |
91 | (self.parents)( |
|
94 | (self.parents)( |
@@ -2,6 +2,11 b' from __future__ import absolute_import' | |||||
2 | import sys |
|
2 | import sys | |
3 | import unittest |
|
3 | import unittest | |
4 |
|
4 | |||
|
5 | from mercurial import ( | |||
|
6 | error, | |||
|
7 | node, | |||
|
8 | ) | |||
|
9 | ||||
5 | try: |
|
10 | try: | |
6 | from mercurial import rustext |
|
11 | from mercurial import rustext | |
7 | rustext.__name__ # trigger immediate actual import |
|
12 | rustext.__name__ # trigger immediate actual import | |
@@ -153,6 +158,12 b' class rustancestorstest(unittest.TestCas' | |||||
153 | # rust-cpython issues appropriate str instances for Python 2 and 3 |
|
158 | # rust-cpython issues appropriate str instances for Python 2 and 3 | |
154 | self.assertEqual(exc.args, ('ParentOutOfRange', 1)) |
|
159 | self.assertEqual(exc.args, ('ParentOutOfRange', 1)) | |
155 |
|
160 | |||
|
161 | def testwdirunsupported(self): | |||
|
162 | # trying to access ancestors of the working directory raises | |||
|
163 | # WdirUnsupported directly | |||
|
164 | idx = self.parseindex() | |||
|
165 | with self.assertRaises(error.WdirUnsupported): | |||
|
166 | list(AncestorsIterator(idx, [node.wdirrev], -1, False)) | |||
156 |
|
167 | |||
157 | if __name__ == '__main__': |
|
168 | if __name__ == '__main__': | |
158 | import silenttestrunner |
|
169 | import silenttestrunner |
General Comments 0
You need to be logged in to leave comments.
Login now