1
/* Generated by Cython 0.14.1 on Mon Jan 16 15:59:27 2012 */
3
#define PY_SSIZE_T_CLEAN
6
#error Python headers needed to compile C extensions, please install development version of Python.
9
#include <stddef.h> /* For offsetof */
11
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14
#if !defined(WIN32) && !defined(MS_WINDOWS)
27
#define DL_IMPORT(t) t
30
#define DL_EXPORT(t) t
34
#define PY_LONG_LONG LONG_LONG
37
#if PY_VERSION_HEX < 0x02040000
38
#define METH_COEXIST 0
39
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
40
#define PyDict_Contains(d,o) PySequence_Contains(d,o)
43
#if PY_VERSION_HEX < 0x02050000
44
typedef int Py_ssize_t;
45
#define PY_SSIZE_T_MAX INT_MAX
46
#define PY_SSIZE_T_MIN INT_MIN
47
#define PY_FORMAT_SIZE_T ""
48
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
49
#define PyInt_AsSsize_t(o) PyInt_AsLong(o)
50
#define PyNumber_Index(o) PyNumber_Int(o)
51
#define PyIndex_Check(o) PyNumber_Check(o)
52
#define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
55
#if PY_VERSION_HEX < 0x02060000
56
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
57
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
58
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
59
#define PyVarObject_HEAD_INIT(type, size) \
60
PyObject_HEAD_INIT(type) size,
61
#define PyType_Modified(t)
73
Py_ssize_t *suboffsets;
77
#define PyBUF_SIMPLE 0
78
#define PyBUF_WRITABLE 0x0001
79
#define PyBUF_FORMAT 0x0004
80
#define PyBUF_ND 0x0008
81
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
82
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
83
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
84
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
85
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
89
#if PY_MAJOR_VERSION < 3
90
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
92
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
95
#if PY_MAJOR_VERSION >= 3
96
#define Py_TPFLAGS_CHECKTYPES 0
97
#define Py_TPFLAGS_HAVE_INDEX 0
100
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
101
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
104
#if PY_MAJOR_VERSION >= 3
105
#define PyBaseString_Type PyUnicode_Type
106
#define PyStringObject PyUnicodeObject
107
#define PyString_Type PyUnicode_Type
108
#define PyString_Check PyUnicode_Check
109
#define PyString_CheckExact PyUnicode_CheckExact
112
#if PY_VERSION_HEX < 0x02060000
113
#define PyBytesObject PyStringObject
114
#define PyBytes_Type PyString_Type
115
#define PyBytes_Check PyString_Check
116
#define PyBytes_CheckExact PyString_CheckExact
117
#define PyBytes_FromString PyString_FromString
118
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
119
#define PyBytes_FromFormat PyString_FromFormat
120
#define PyBytes_DecodeEscape PyString_DecodeEscape
121
#define PyBytes_AsString PyString_AsString
122
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
123
#define PyBytes_Size PyString_Size
124
#define PyBytes_AS_STRING PyString_AS_STRING
125
#define PyBytes_GET_SIZE PyString_GET_SIZE
126
#define PyBytes_Repr PyString_Repr
127
#define PyBytes_Concat PyString_Concat
128
#define PyBytes_ConcatAndDel PyString_ConcatAndDel
131
#if PY_VERSION_HEX < 0x02060000
132
#define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
133
#define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
135
#ifndef PySet_CheckExact
136
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
139
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
141
#if PY_MAJOR_VERSION >= 3
142
#define PyIntObject PyLongObject
143
#define PyInt_Type PyLong_Type
144
#define PyInt_Check(op) PyLong_Check(op)
145
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
146
#define PyInt_FromString PyLong_FromString
147
#define PyInt_FromUnicode PyLong_FromUnicode
148
#define PyInt_FromLong PyLong_FromLong
149
#define PyInt_FromSize_t PyLong_FromSize_t
150
#define PyInt_FromSsize_t PyLong_FromSsize_t
151
#define PyInt_AsLong PyLong_AsLong
152
#define PyInt_AS_LONG PyLong_AS_LONG
153
#define PyInt_AsSsize_t PyLong_AsSsize_t
154
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
155
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
158
#if PY_MAJOR_VERSION >= 3
159
#define PyBoolObject PyLongObject
163
#if PY_MAJOR_VERSION >= 3
164
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
165
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
167
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
168
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
171
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
172
#define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
173
#define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
174
#define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
176
#define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
177
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
178
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
179
(PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
180
#define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
181
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
182
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
183
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
184
#define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
185
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
186
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
187
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
190
#if PY_MAJOR_VERSION >= 3
191
#define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
194
#if PY_VERSION_HEX < 0x02050000
195
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
196
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
197
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
199
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
200
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
201
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
204
#if PY_VERSION_HEX < 0x02050000
205
#define __Pyx_NAMESTR(n) ((char *)(n))
206
#define __Pyx_DOCSTR(n) ((char *)(n))
208
#define __Pyx_NAMESTR(n) (n)
209
#define __Pyx_DOCSTR(n) (n)
213
#define __PYX_EXTERN_C extern "C"
215
#define __PYX_EXTERN_C extern
218
#if defined(WIN32) || defined(MS_WINDOWS)
219
#define _USE_MATH_DEFINES
222
#define __PYX_HAVE_API__bzrlib___known_graph_pyx
223
#include "python-compat.h"
225
#ifdef PYREX_WITHOUT_ASSERTIONS
226
#define CYTHON_WITHOUT_ASSERTIONS
230
/* inline attribute */
231
#ifndef CYTHON_INLINE
232
#if defined(__GNUC__)
233
#define CYTHON_INLINE __inline__
234
#elif defined(_MSC_VER)
235
#define CYTHON_INLINE __inline
236
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
237
#define CYTHON_INLINE inline
239
#define CYTHON_INLINE
243
/* unused attribute */
244
#ifndef CYTHON_UNUSED
245
# if defined(__GNUC__)
246
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
247
# define CYTHON_UNUSED __attribute__ ((__unused__))
249
# define CYTHON_UNUSED
251
# elif defined(__ICC) || defined(__INTEL_COMPILER)
252
# define CYTHON_UNUSED __attribute__ ((__unused__))
254
# define CYTHON_UNUSED
258
typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
261
/* Type Conversion Predeclarations */
263
#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
264
#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
266
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
267
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
268
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
270
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
271
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
272
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
274
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
278
/* Test for GCC > 2.95 */
279
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
280
#define likely(x) __builtin_expect(!!(x), 1)
281
#define unlikely(x) __builtin_expect(!!(x), 0)
282
#else /* __GNUC__ > 2 ... */
283
#define likely(x) (x)
284
#define unlikely(x) (x)
285
#endif /* __GNUC__ > 2 ... */
287
#define likely(x) (x)
288
#define unlikely(x) (x)
289
#endif /* __GNUC__ */
291
static PyObject *__pyx_m;
292
static PyObject *__pyx_b;
293
static PyObject *__pyx_empty_tuple;
294
static PyObject *__pyx_empty_bytes;
295
static int __pyx_lineno;
296
static int __pyx_clineno = 0;
297
static const char * __pyx_cfilenm= __FILE__;
298
static const char *__pyx_filename;
301
static const char *__pyx_f[] = {
302
"_known_graph_pyx.pyx",
305
/* Type declarations */
307
/* "bzrlib/_known_graph_pyx.pyx":666
310
* cdef class _MergeSortNode: # <<<<<<<<<<<<<<
311
* """Tracks information about a node during the merge_sort operation."""
315
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode {
317
struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_vtab;
320
PyObject *end_of_merge;
321
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *left_parent;
322
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *left_pending_parent;
323
PyObject *pending_parents;
332
/* "bzrlib/_known_graph_pyx.pyx":192
333
* cdef class _MergeSorter
335
* cdef class KnownGraph: # <<<<<<<<<<<<<<
336
* """This is a class which assumes we already know the full graph."""
340
struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph {
342
struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx_KnownGraph *__pyx_vtab;
344
PyObject *_known_heads;
348
/* "bzrlib/_known_graph_pyx.pyx":63
351
* cdef class _KnownGraphNode: # <<<<<<<<<<<<<<
352
* """Represents a single object in the known graph."""
356
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode {
358
struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_vtab;
367
/* "bzrlib/_known_graph_pyx.pyx":190
370
* cdef class _MergeSorter # <<<<<<<<<<<<<<
372
* cdef class KnownGraph:
375
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter {
377
struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSorter *__pyx_vtab;
378
struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *graph;
379
PyObject *_depth_first_stack;
380
Py_ssize_t _last_stack_item;
381
PyObject *_revno_to_branch_count;
382
PyObject *_scheduled_nodes;
386
/* "bzrlib/_known_graph_pyx.pyx":724
389
* cdef class _MergeSorter: # <<<<<<<<<<<<<<
390
* """This class does the work of computing the merge_sort ordering.
394
struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSorter {
395
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *(*_get_ms_node)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *, struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *);
396
PyObject *(*_push_node)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *, struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *, long);
397
PyObject *(*_pop_node)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *);
398
PyObject *(*_schedule_stack)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *);
399
PyObject *(*topo_order)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *);
401
static struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSorter *__pyx_vtabptr_6bzrlib_16_known_graph_pyx__MergeSorter;
404
/* "bzrlib/_known_graph_pyx.pyx":63
407
* cdef class _KnownGraphNode: # <<<<<<<<<<<<<<
408
* """Represents a single object in the known graph."""
412
struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__KnownGraphNode {
413
PyObject *(*clear_references)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *);
415
static struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_vtabptr_6bzrlib_16_known_graph_pyx__KnownGraphNode;
418
/* "bzrlib/_known_graph_pyx.pyx":666
421
* cdef class _MergeSortNode: # <<<<<<<<<<<<<<
422
* """Tracks information about a node during the merge_sort operation."""
426
struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSortNode {
427
int (*has_pending_parents)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *);
428
PyObject *(*_revno)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *);
430
static struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_vtabptr_6bzrlib_16_known_graph_pyx__MergeSortNode;
433
/* "bzrlib/_known_graph_pyx.pyx":192
434
* cdef class _MergeSorter
436
* cdef class KnownGraph: # <<<<<<<<<<<<<<
437
* """This is a class which assumes we already know the full graph."""
441
struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx_KnownGraph {
442
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *(*_get_or_create_node)(struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *, PyObject *);
443
PyObject *(*_populate_parents)(struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *, struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *, PyObject *);
445
static struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx_KnownGraph *__pyx_vtabptr_6bzrlib_16_known_graph_pyx_KnownGraph;
447
#ifndef CYTHON_REFNANNY
448
#define CYTHON_REFNANNY 0
453
void (*INCREF)(void*, PyObject*, int);
454
void (*DECREF)(void*, PyObject*, int);
455
void (*GOTREF)(void*, PyObject*, int);
456
void (*GIVEREF)(void*, PyObject*, int);
457
void* (*SetupContext)(const char*, int, const char*);
458
void (*FinishContext)(void**);
459
} __Pyx_RefNannyAPIStruct;
460
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
461
static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
462
PyObject *m = NULL, *p = NULL;
464
m = PyImport_ImportModule((char *)modname);
466
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
468
r = PyLong_AsVoidPtr(p);
472
return (__Pyx_RefNannyAPIStruct *)r;
474
#define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
475
#define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
476
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
477
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
478
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
479
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
480
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
482
#define __Pyx_RefNannySetupContext(name)
483
#define __Pyx_RefNannyFinishContext()
484
#define __Pyx_INCREF(r) Py_INCREF(r)
485
#define __Pyx_DECREF(r) Py_DECREF(r)
486
#define __Pyx_GOTREF(r)
487
#define __Pyx_GIVEREF(r)
488
#define __Pyx_XDECREF(r) Py_XDECREF(r)
489
#endif /* CYTHON_REFNANNY */
490
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
491
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
493
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
495
static void __Pyx_RaiseDoubleKeywordsError(
496
const char* func_name, PyObject* kw_name); /*proto*/
498
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
500
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
501
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
503
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
505
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
506
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
508
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
511
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
514
r = PyObject_GetItem(o, j);
520
#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
521
__Pyx_GetItemInt_List_Fast(o, i) : \
522
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
524
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
525
if (likely(o != Py_None)) {
526
if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
527
PyObject *r = PyList_GET_ITEM(o, i);
531
else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
532
PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
537
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
540
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
541
__Pyx_GetItemInt_Tuple_Fast(o, i) : \
542
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
544
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
545
if (likely(o != Py_None)) {
546
if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
547
PyObject *r = PyTuple_GET_ITEM(o, i);
551
else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
552
PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
557
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
561
#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
562
__Pyx_GetItemInt_Fast(o, i) : \
563
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
565
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
567
if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
568
r = PyList_GET_ITEM(o, i);
571
else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
572
r = PyTuple_GET_ITEM(o, i);
575
else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
576
r = PySequence_GetItem(o, i);
579
r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
584
static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; }
585
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
586
return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
589
static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) {
591
#if PY_VERSION_HEX >= 0x02040000
592
if (likely(PyList_CheckExact(L))
593
/* Check that both the size is positive and no reallocation shrinking needs to be done. */
594
&& likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
596
return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
599
m = __Pyx_GetAttrString(L, "pop");
601
r = PyObject_CallObject(m, NULL);
606
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
608
#if PY_VERSION_HEX < 0x02050000
609
#ifndef PyAnySet_CheckExact
611
#define PyAnySet_CheckExact(ob) \
612
((ob)->ob_type == &PySet_Type || \
613
(ob)->ob_type == &PyFrozenSet_Type)
615
#define PySet_New(iterable) \
616
PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL)
618
#define Pyx_PyFrozenSet_New(iterable) \
619
PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL)
621
#define PySet_Size(anyset) \
622
PyObject_Size((anyset))
624
#define PySet_Contains(anyset, key) \
625
PySequence_Contains((anyset), (key))
627
#define PySet_Pop(set) \
628
PyObject_CallMethod(set, (char *)"pop", NULL)
630
static CYTHON_INLINE int PySet_Clear(PyObject *set) {
631
PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL);
633
Py_DECREF(ret); return 0;
636
static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) {
637
PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key);
639
Py_DECREF(ret); return 0;
642
static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) {
643
PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key);
645
Py_DECREF(ret); return 0;
648
#endif /* PyAnySet_CheckExact (<= Py2.4) */
650
#if PY_VERSION_HEX < 0x02040000
651
#ifndef Py_SETOBJECT_H
652
#define Py_SETOBJECT_H
654
static PyTypeObject *__Pyx_PySet_Type = NULL;
655
static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL;
657
#define PySet_Type (*__Pyx_PySet_Type)
658
#define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type)
660
#define PyAnySet_Check(ob) \
661
(PyAnySet_CheckExact(ob) || \
662
PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \
663
PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))
665
#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)
667
static int __Pyx_Py23SetsImport(void) {
668
PyObject *sets=0, *Set=0, *ImmutableSet=0;
670
sets = PyImport_ImportModule((char *)"sets");
672
Set = PyObject_GetAttrString(sets, (char *)"Set");
674
ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet");
675
if (!ImmutableSet) goto bad;
678
__Pyx_PySet_Type = (PyTypeObject*) Set;
679
__Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet;
686
Py_XDECREF(ImmutableSet);
691
static int __Pyx_Py23SetsImport(void) { return 0; }
692
#endif /* !Py_SETOBJECT_H */
696
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
698
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
700
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
702
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
704
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
706
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
708
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
710
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
712
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
714
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
716
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
718
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
720
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
722
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
724
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
726
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
728
static void __Pyx_WriteUnraisable(const char *name); /*proto*/
730
static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
732
static void __Pyx_AddTraceback(const char *funcname); /*proto*/
734
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
735
/* Module declarations from bzrlib._known_graph_pyx */
737
static PyTypeObject *__pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode = 0;
738
static PyTypeObject *__pyx_ptype_6bzrlib_16_known_graph_pyx__MergeSorter = 0;
739
static PyTypeObject *__pyx_ptype_6bzrlib_16_known_graph_pyx_KnownGraph = 0;
740
static PyTypeObject *__pyx_ptype_6bzrlib_16_known_graph_pyx__MergeSortNode = 0;
741
static PyObject *__pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION = 0;
742
static struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(PyObject *, Py_ssize_t); /*proto*/
743
static struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_f_6bzrlib_16_known_graph_pyx__get_tuple_node(PyObject *, Py_ssize_t); /*proto*/
744
static PyObject *__pyx_f_6bzrlib_16_known_graph_pyx__sort_list_nodes(PyObject *, int); /*proto*/
745
#define __Pyx_MODULE_NAME "bzrlib._known_graph_pyx"
746
static int __pyx_module_is_main_bzrlib___known_graph_pyx = 0;
748
/* Implementation of bzrlib._known_graph_pyx */
749
static PyObject *__pyx_builtin_TypeError;
750
static PyObject *__pyx_builtin_ValueError;
751
static PyObject *__pyx_builtin_KeyError;
752
static PyObject *__pyx_builtin_sorted;
753
static PyObject *__pyx_builtin_RuntimeError;
754
static char __pyx_k_1[] = "%s(%s gdfo:%s par:%s child:%s)";
755
static char __pyx_k_2[] = "lst_or_tpl must be a list or tuple.";
756
static char __pyx_k_5[] = "parent_map should be a dict of {key:parent_keys}";
757
static char __pyx_k_7[] = "Parent key mismatch, existing node %s has parents of %s not %s";
758
static char __pyx_k_8[] = "key %s not in nodes";
759
static char __pyx_k_9[] = "";
760
static char __pyx_k_10[] = "%s(%s depth:%s rev:%s,%s,%s first:%s seen:%s)";
761
static char __pyx_k_11[] = "Something wrong with: %s";
762
static char __pyx_k_12[] = "_revno_to_branch_count";
763
static char __pyx_k_13[] = "ghost nodes should not be pushed onto the stack: %s";
764
static char __pyx_k_14[] = "Implementation of Graph algorithms when we have already loaded everything.\n";
765
static char __pyx_k_15[] = "bzrlib._known_graph_pyx";
766
static char __pyx_k__gc[] = "gc";
767
static char __pyx_k__key[] = "key";
768
static char __pyx_k__pop[] = "pop";
769
static char __pyx_k__gdfo[] = "gdfo";
770
static char __pyx_k__seen[] = "seen";
771
static char __pyx_k__sort[] = "sort";
772
static char __pyx_k__clear[] = "clear";
773
static char __pyx_k__deque[] = "deque";
774
static char __pyx_k__extra[] = "extra";
775
static char __pyx_k__graph[] = "graph";
776
static char __pyx_k___nodes[] = "_nodes";
777
static char __pyx_k___revno[] = "_revno";
778
static char __pyx_k__append[] = "append";
779
static char __pyx_k__bzrlib[] = "bzrlib";
780
static char __pyx_k__errors[] = "errors";
781
static char __pyx_k__extend[] = "extend";
782
static char __pyx_k__sorted[] = "sorted";
783
static char __pyx_k__get_key[] = "get_key";
784
static char __pyx_k__parents[] = "parents";
785
static char __pyx_k__popleft[] = "popleft";
786
static char __pyx_k__reverse[] = "reverse";
787
static char __pyx_k__tip_key[] = "tip_key";
788
static char __pyx_k__KeyError[] = "KeyError";
789
static char __pyx_k____main__[] = "__main__";
790
static char __pyx_k____name__[] = "__name__";
791
static char __pyx_k____test__[] = "__test__";
792
static char __pyx_k__children[] = "children";
793
static char __pyx_k__do_cache[] = "do_cache";
794
static char __pyx_k__revision[] = "revision";
795
static char __pyx_k__TypeError[] = "TypeError";
796
static char __pyx_k____class__[] = "__class__";
797
static char __pyx_k___pop_node[] = "_pop_node";
798
static char __pyx_k__completed[] = "completed";
799
static char __pyx_k__ValueError[] = "ValueError";
800
static char __pyx_k___find_gdfo[] = "_find_gdfo";
801
static char __pyx_k___find_tips[] = "_find_tips";
802
static char __pyx_k___push_node[] = "_push_node";
803
static char __pyx_k__child_keys[] = "child_keys";
804
static char __pyx_k__parent_map[] = "parent_map";
805
static char __pyx_k__topo_order[] = "topo_order";
806
static char __pyx_k___find_tails[] = "_find_tails";
807
static char __pyx_k___revno_last[] = "_revno_last";
808
static char __pyx_k__collections[] = "collections";
809
static char __pyx_k__known_graph[] = "known_graph";
810
static char __pyx_k__left_parent[] = "left_parent";
811
static char __pyx_k__merge_depth[] = "merge_depth";
812
static char __pyx_k__parent_keys[] = "parent_keys";
813
static char __pyx_k__RuntimeError[] = "RuntimeError";
814
static char __pyx_k___get_ms_node[] = "_get_ms_node";
815
static char __pyx_k___known_heads[] = "_known_heads";
816
static char __pyx_k___revno_first[] = "_revno_first";
817
static char __pyx_k__end_of_merge[] = "end_of_merge";
818
static char __pyx_k__NULL_REVISION[] = "NULL_REVISION";
819
static char __pyx_k___revno_second[] = "_revno_second";
820
static char __pyx_k__seen_by_child[] = "seen_by_child";
821
static char __pyx_k__is_first_child[] = "is_first_child";
822
static char __pyx_k__GraphCycleError[] = "GraphCycleError";
823
static char __pyx_k___schedule_stack[] = "_schedule_stack";
824
static char __pyx_k__pending_parents[] = "pending_parents";
825
static char __pyx_k___last_stack_item[] = "_last_stack_item";
826
static char __pyx_k___scheduled_nodes[] = "_scheduled_nodes";
827
static char __pyx_k__clear_references[] = "clear_references";
828
static char __pyx_k___initialize_nodes[] = "_initialize_nodes";
829
static char __pyx_k___populate_parents[] = "_populate_parents";
830
static char __pyx_k___depth_first_stack[] = "_depth_first_stack";
831
static char __pyx_k___get_or_create_node[] = "_get_or_create_node";
832
static char __pyx_k__has_pending_parents[] = "has_pending_parents";
833
static char __pyx_k__left_pending_parent[] = "left_pending_parent";
834
static PyObject *__pyx_kp_s_1;
835
static PyObject *__pyx_kp_s_10;
836
static PyObject *__pyx_kp_s_11;
837
static PyObject *__pyx_n_s_12;
838
static PyObject *__pyx_kp_s_13;
839
static PyObject *__pyx_n_s_15;
840
static PyObject *__pyx_kp_s_2;
841
static PyObject *__pyx_kp_s_5;
842
static PyObject *__pyx_kp_s_7;
843
static PyObject *__pyx_kp_s_8;
844
static PyObject *__pyx_kp_s_9;
845
static PyObject *__pyx_n_s__GraphCycleError;
846
static PyObject *__pyx_n_s__KeyError;
847
static PyObject *__pyx_n_s__NULL_REVISION;
848
static PyObject *__pyx_n_s__RuntimeError;
849
static PyObject *__pyx_n_s__TypeError;
850
static PyObject *__pyx_n_s__ValueError;
851
static PyObject *__pyx_n_s____class__;
852
static PyObject *__pyx_n_s____main__;
853
static PyObject *__pyx_n_s____name__;
854
static PyObject *__pyx_n_s____test__;
855
static PyObject *__pyx_n_s___depth_first_stack;
856
static PyObject *__pyx_n_s___find_gdfo;
857
static PyObject *__pyx_n_s___find_tails;
858
static PyObject *__pyx_n_s___find_tips;
859
static PyObject *__pyx_n_s___get_ms_node;
860
static PyObject *__pyx_n_s___get_or_create_node;
861
static PyObject *__pyx_n_s___initialize_nodes;
862
static PyObject *__pyx_n_s___known_heads;
863
static PyObject *__pyx_n_s___last_stack_item;
864
static PyObject *__pyx_n_s___nodes;
865
static PyObject *__pyx_n_s___pop_node;
866
static PyObject *__pyx_n_s___populate_parents;
867
static PyObject *__pyx_n_s___push_node;
868
static PyObject *__pyx_n_s___revno;
869
static PyObject *__pyx_n_s___revno_first;
870
static PyObject *__pyx_n_s___revno_last;
871
static PyObject *__pyx_n_s___revno_second;
872
static PyObject *__pyx_n_s___schedule_stack;
873
static PyObject *__pyx_n_s___scheduled_nodes;
874
static PyObject *__pyx_n_s__append;
875
static PyObject *__pyx_n_s__bzrlib;
876
static PyObject *__pyx_n_s__child_keys;
877
static PyObject *__pyx_n_s__children;
878
static PyObject *__pyx_n_s__clear;
879
static PyObject *__pyx_n_s__clear_references;
880
static PyObject *__pyx_n_s__collections;
881
static PyObject *__pyx_n_s__completed;
882
static PyObject *__pyx_n_s__deque;
883
static PyObject *__pyx_n_s__do_cache;
884
static PyObject *__pyx_n_s__end_of_merge;
885
static PyObject *__pyx_n_s__errors;
886
static PyObject *__pyx_n_s__extend;
887
static PyObject *__pyx_n_s__extra;
888
static PyObject *__pyx_n_s__gc;
889
static PyObject *__pyx_n_s__gdfo;
890
static PyObject *__pyx_n_s__get_key;
891
static PyObject *__pyx_n_s__graph;
892
static PyObject *__pyx_n_s__has_pending_parents;
893
static PyObject *__pyx_n_s__is_first_child;
894
static PyObject *__pyx_n_s__key;
895
static PyObject *__pyx_n_s__known_graph;
896
static PyObject *__pyx_n_s__left_parent;
897
static PyObject *__pyx_n_s__left_pending_parent;
898
static PyObject *__pyx_n_s__merge_depth;
899
static PyObject *__pyx_n_s__parent_keys;
900
static PyObject *__pyx_n_s__parent_map;
901
static PyObject *__pyx_n_s__parents;
902
static PyObject *__pyx_n_s__pending_parents;
903
static PyObject *__pyx_n_s__pop;
904
static PyObject *__pyx_n_s__popleft;
905
static PyObject *__pyx_n_s__reverse;
906
static PyObject *__pyx_n_s__revision;
907
static PyObject *__pyx_n_s__seen;
908
static PyObject *__pyx_n_s__seen_by_child;
909
static PyObject *__pyx_n_s__sort;
910
static PyObject *__pyx_n_s__sorted;
911
static PyObject *__pyx_n_s__tip_key;
912
static PyObject *__pyx_n_s__topo_order;
913
static PyObject *__pyx_int_0;
914
static PyObject *__pyx_int_1;
915
static PyObject *__pyx_k_4;
916
static PyObject *__pyx_k_tuple_3;
917
static PyObject *__pyx_k_tuple_6;
919
/* "bzrlib/_known_graph_pyx.pyx":73
922
* def __init__(self, key): # <<<<<<<<<<<<<<
924
* self.parents = None
927
static int __pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
928
static int __pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
929
PyObject *__pyx_v_key = 0;
931
PyObject *__pyx_t_1 = NULL;
932
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,0};
933
__Pyx_RefNannySetupContext("__init__");
934
if (unlikely(__pyx_kwds)) {
935
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
936
PyObject* values[1] = {0};
937
switch (PyTuple_GET_SIZE(__pyx_args)) {
938
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
940
default: goto __pyx_L5_argtuple_error;
942
switch (PyTuple_GET_SIZE(__pyx_args)) {
944
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
945
if (likely(values[0])) kw_args--;
946
else goto __pyx_L5_argtuple_error;
948
if (unlikely(kw_args > 0)) {
949
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
951
__pyx_v_key = values[0];
952
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
953
goto __pyx_L5_argtuple_error;
955
__pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
957
goto __pyx_L4_argument_unpacking_done;
958
__pyx_L5_argtuple_error:;
959
__Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
961
__Pyx_AddTraceback("bzrlib._known_graph_pyx._KnownGraphNode.__init__");
962
__Pyx_RefNannyFinishContext();
964
__pyx_L4_argument_unpacking_done:;
966
/* "bzrlib/_known_graph_pyx.pyx":74
968
* def __init__(self, key):
969
* self.key = key # <<<<<<<<<<<<<<
970
* self.parents = None
973
__Pyx_INCREF(__pyx_v_key);
974
__Pyx_GIVEREF(__pyx_v_key);
975
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->key);
976
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->key);
977
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->key = __pyx_v_key;
979
/* "bzrlib/_known_graph_pyx.pyx":75
980
* def __init__(self, key):
982
* self.parents = None # <<<<<<<<<<<<<<
986
__Pyx_INCREF(Py_None);
987
__Pyx_GIVEREF(Py_None);
988
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents);
989
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents);
990
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents = Py_None;
992
/* "bzrlib/_known_graph_pyx.pyx":77
993
* self.parents = None
995
* self.children = [] # <<<<<<<<<<<<<<
996
* # Greatest distance from origin
999
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1000
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
1001
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
1002
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->children);
1003
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->children);
1004
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->children = ((PyObject *)__pyx_t_1);
1007
/* "bzrlib/_known_graph_pyx.pyx":79
1008
* self.children = []
1009
* # Greatest distance from origin
1010
* self.gdfo = -1 # <<<<<<<<<<<<<<
1014
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->gdfo = -1;
1016
/* "bzrlib/_known_graph_pyx.pyx":80
1017
* # Greatest distance from origin
1019
* self.seen = 0 # <<<<<<<<<<<<<<
1023
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->seen = 0;
1025
/* "bzrlib/_known_graph_pyx.pyx":81
1028
* self.extra = None # <<<<<<<<<<<<<<
1030
* property child_keys:
1032
__Pyx_INCREF(Py_None);
1033
__Pyx_GIVEREF(Py_None);
1034
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->extra);
1035
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->extra);
1036
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->extra = Py_None;
1041
__Pyx_XDECREF(__pyx_t_1);
1042
__Pyx_AddTraceback("bzrlib._known_graph_pyx._KnownGraphNode.__init__");
1045
__Pyx_RefNannyFinishContext();
1049
/* "bzrlib/_known_graph_pyx.pyx":84
1051
* property child_keys:
1052
* def __get__(self): # <<<<<<<<<<<<<<
1053
* cdef _KnownGraphNode child
1057
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_10child_keys___get__(PyObject *__pyx_v_self); /*proto*/
1058
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_10child_keys___get__(PyObject *__pyx_v_self) {
1059
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_child;
1060
PyObject *__pyx_v_keys;
1061
PyObject *__pyx_r = NULL;
1062
PyObject *__pyx_t_1 = NULL;
1063
Py_ssize_t __pyx_t_2;
1064
PyObject *__pyx_t_3 = NULL;
1066
__Pyx_RefNannySetupContext("__get__");
1067
__pyx_v_child = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
1068
__pyx_v_keys = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
1070
/* "bzrlib/_known_graph_pyx.pyx":87
1071
* cdef _KnownGraphNode child
1073
* keys = [] # <<<<<<<<<<<<<<
1074
* for child in self.children:
1075
* PyList_Append(keys, child.key)
1077
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1078
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
1079
__Pyx_DECREF(((PyObject *)__pyx_v_keys));
1080
__pyx_v_keys = __pyx_t_1;
1083
/* "bzrlib/_known_graph_pyx.pyx":88
1086
* for child in self.children: # <<<<<<<<<<<<<<
1087
* PyList_Append(keys, child.key)
1090
if (PyList_CheckExact(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->children) || PyTuple_CheckExact(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->children)) {
1091
__pyx_t_2 = 0; __pyx_t_1 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->children; __Pyx_INCREF(__pyx_t_1);
1093
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1094
__Pyx_GOTREF(__pyx_t_1);
1097
if (likely(PyList_CheckExact(__pyx_t_1))) {
1098
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
1099
__pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
1100
} else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
1101
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
1102
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
1104
__pyx_t_3 = PyIter_Next(__pyx_t_1);
1106
if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1109
__Pyx_GOTREF(__pyx_t_3);
1111
if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1112
__Pyx_DECREF(((PyObject *)__pyx_v_child));
1113
__pyx_v_child = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_3);
1116
/* "bzrlib/_known_graph_pyx.pyx":89
1118
* for child in self.children:
1119
* PyList_Append(keys, child.key) # <<<<<<<<<<<<<<
1123
__pyx_t_3 = __pyx_v_child->key;
1124
__Pyx_INCREF(__pyx_t_3);
1125
__pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_keys), __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1126
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1128
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1130
/* "bzrlib/_known_graph_pyx.pyx":90
1131
* for child in self.children:
1132
* PyList_Append(keys, child.key)
1133
* return keys # <<<<<<<<<<<<<<
1135
* property parent_keys:
1137
__Pyx_XDECREF(__pyx_r);
1138
__Pyx_INCREF(((PyObject *)__pyx_v_keys));
1139
__pyx_r = ((PyObject *)__pyx_v_keys);
1142
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1145
__Pyx_XDECREF(__pyx_t_1);
1146
__Pyx_XDECREF(__pyx_t_3);
1147
__Pyx_AddTraceback("bzrlib._known_graph_pyx._KnownGraphNode.child_keys.__get__");
1150
__Pyx_DECREF((PyObject *)__pyx_v_child);
1151
__Pyx_DECREF(__pyx_v_keys);
1152
__Pyx_XGIVEREF(__pyx_r);
1153
__Pyx_RefNannyFinishContext();
1157
/* "bzrlib/_known_graph_pyx.pyx":93
1159
* property parent_keys:
1160
* def __get__(self): # <<<<<<<<<<<<<<
1161
* if self.parents is None:
1165
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_11parent_keys___get__(PyObject *__pyx_v_self); /*proto*/
1166
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_11parent_keys___get__(PyObject *__pyx_v_self) {
1167
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_parent;
1168
PyObject *__pyx_v_keys;
1169
PyObject *__pyx_r = NULL;
1171
PyObject *__pyx_t_2 = NULL;
1172
Py_ssize_t __pyx_t_3;
1173
PyObject *__pyx_t_4 = NULL;
1175
__Pyx_RefNannySetupContext("__get__");
1176
__pyx_v_parent = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
1177
__pyx_v_keys = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
1179
/* "bzrlib/_known_graph_pyx.pyx":94
1180
* property parent_keys:
1181
* def __get__(self):
1182
* if self.parents is None: # <<<<<<<<<<<<<<
1186
__pyx_t_1 = (((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents == Py_None);
1189
/* "bzrlib/_known_graph_pyx.pyx":95
1190
* def __get__(self):
1191
* if self.parents is None:
1192
* return None # <<<<<<<<<<<<<<
1194
* cdef _KnownGraphNode parent
1196
__Pyx_XDECREF(__pyx_r);
1197
__Pyx_INCREF(Py_None);
1204
/* "bzrlib/_known_graph_pyx.pyx":99
1205
* cdef _KnownGraphNode parent
1207
* keys = [] # <<<<<<<<<<<<<<
1208
* for parent in self.parents:
1209
* PyList_Append(keys, parent.key)
1211
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1212
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
1213
__Pyx_DECREF(((PyObject *)__pyx_v_keys));
1214
__pyx_v_keys = __pyx_t_2;
1217
/* "bzrlib/_known_graph_pyx.pyx":100
1220
* for parent in self.parents: # <<<<<<<<<<<<<<
1221
* PyList_Append(keys, parent.key)
1224
if (PyList_CheckExact(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents) || PyTuple_CheckExact(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents)) {
1225
__pyx_t_3 = 0; __pyx_t_2 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents; __Pyx_INCREF(__pyx_t_2);
1227
__pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1228
__Pyx_GOTREF(__pyx_t_2);
1231
if (likely(PyList_CheckExact(__pyx_t_2))) {
1232
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
1233
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
1234
} else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
1235
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
1236
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
1238
__pyx_t_4 = PyIter_Next(__pyx_t_2);
1240
if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1243
__Pyx_GOTREF(__pyx_t_4);
1245
if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1246
__Pyx_DECREF(((PyObject *)__pyx_v_parent));
1247
__pyx_v_parent = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_4);
1250
/* "bzrlib/_known_graph_pyx.pyx":101
1252
* for parent in self.parents:
1253
* PyList_Append(keys, parent.key) # <<<<<<<<<<<<<<
1257
__pyx_t_4 = __pyx_v_parent->key;
1258
__Pyx_INCREF(__pyx_t_4);
1259
__pyx_t_5 = PyList_Append(((PyObject *)__pyx_v_keys), __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1260
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1262
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1264
/* "bzrlib/_known_graph_pyx.pyx":102
1265
* for parent in self.parents:
1266
* PyList_Append(keys, parent.key)
1267
* return keys # <<<<<<<<<<<<<<
1269
* cdef clear_references(self):
1271
__Pyx_XDECREF(__pyx_r);
1272
__Pyx_INCREF(((PyObject *)__pyx_v_keys));
1273
__pyx_r = ((PyObject *)__pyx_v_keys);
1276
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1279
__Pyx_XDECREF(__pyx_t_2);
1280
__Pyx_XDECREF(__pyx_t_4);
1281
__Pyx_AddTraceback("bzrlib._known_graph_pyx._KnownGraphNode.parent_keys.__get__");
1284
__Pyx_DECREF((PyObject *)__pyx_v_parent);
1285
__Pyx_DECREF(__pyx_v_keys);
1286
__Pyx_XGIVEREF(__pyx_r);
1287
__Pyx_RefNannyFinishContext();
1291
/* "bzrlib/_known_graph_pyx.pyx":104
1294
* cdef clear_references(self): # <<<<<<<<<<<<<<
1295
* self.parents = None
1296
* self.children = None
1299
static PyObject *__pyx_f_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_clear_references(struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_self) {
1300
PyObject *__pyx_r = NULL;
1301
__Pyx_RefNannySetupContext("clear_references");
1303
/* "bzrlib/_known_graph_pyx.pyx":105
1305
* cdef clear_references(self):
1306
* self.parents = None # <<<<<<<<<<<<<<
1307
* self.children = None
1310
__Pyx_INCREF(Py_None);
1311
__Pyx_GIVEREF(Py_None);
1312
__Pyx_GOTREF(__pyx_v_self->parents);
1313
__Pyx_DECREF(__pyx_v_self->parents);
1314
__pyx_v_self->parents = Py_None;
1316
/* "bzrlib/_known_graph_pyx.pyx":106
1317
* cdef clear_references(self):
1318
* self.parents = None
1319
* self.children = None # <<<<<<<<<<<<<<
1321
* def __repr__(self):
1323
__Pyx_INCREF(Py_None);
1324
__Pyx_GIVEREF(Py_None);
1325
__Pyx_GOTREF(__pyx_v_self->children);
1326
__Pyx_DECREF(__pyx_v_self->children);
1327
__pyx_v_self->children = Py_None;
1329
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1330
__Pyx_XGIVEREF(__pyx_r);
1331
__Pyx_RefNannyFinishContext();
1335
/* "bzrlib/_known_graph_pyx.pyx":108
1336
* self.children = None
1338
* def __repr__(self): # <<<<<<<<<<<<<<
1339
* cdef _KnownGraphNode node
1343
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_1__repr__(PyObject *__pyx_v_self); /*proto*/
1344
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_1__repr__(PyObject *__pyx_v_self) {
1345
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
1346
PyObject *__pyx_v_parent_keys;
1347
PyObject *__pyx_v_child_keys;
1348
PyObject *__pyx_r = NULL;
1349
PyObject *__pyx_t_1 = NULL;
1351
Py_ssize_t __pyx_t_3;
1352
PyObject *__pyx_t_4 = NULL;
1354
PyObject *__pyx_t_6 = NULL;
1355
__Pyx_RefNannySetupContext("__repr__");
1356
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
1357
__pyx_v_parent_keys = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
1358
__pyx_v_child_keys = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
1360
/* "bzrlib/_known_graph_pyx.pyx":111
1361
* cdef _KnownGraphNode node
1363
* parent_keys = [] # <<<<<<<<<<<<<<
1364
* if self.parents is not None:
1365
* for node in self.parents:
1367
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1368
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
1369
__Pyx_DECREF(((PyObject *)__pyx_v_parent_keys));
1370
__pyx_v_parent_keys = __pyx_t_1;
1373
/* "bzrlib/_known_graph_pyx.pyx":112
1376
* if self.parents is not None: # <<<<<<<<<<<<<<
1377
* for node in self.parents:
1378
* parent_keys.append(node.key)
1380
__pyx_t_2 = (((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents != Py_None);
1383
/* "bzrlib/_known_graph_pyx.pyx":113
1385
* if self.parents is not None:
1386
* for node in self.parents: # <<<<<<<<<<<<<<
1387
* parent_keys.append(node.key)
1390
if (PyList_CheckExact(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents) || PyTuple_CheckExact(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents)) {
1391
__pyx_t_3 = 0; __pyx_t_1 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents; __Pyx_INCREF(__pyx_t_1);
1393
__pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->parents); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1394
__Pyx_GOTREF(__pyx_t_1);
1397
if (likely(PyList_CheckExact(__pyx_t_1))) {
1398
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
1399
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
1400
} else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
1401
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
1402
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
1404
__pyx_t_4 = PyIter_Next(__pyx_t_1);
1406
if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1409
__Pyx_GOTREF(__pyx_t_4);
1411
if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1412
__Pyx_DECREF(((PyObject *)__pyx_v_node));
1413
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_4);
1416
/* "bzrlib/_known_graph_pyx.pyx":114
1417
* if self.parents is not None:
1418
* for node in self.parents:
1419
* parent_keys.append(node.key) # <<<<<<<<<<<<<<
1421
* if self.children is not None:
1423
if (unlikely(__pyx_v_parent_keys == Py_None)) {
1424
PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1426
__pyx_t_4 = __pyx_v_node->key;
1427
__Pyx_INCREF(__pyx_t_4);
1428
__pyx_t_5 = PyList_Append(__pyx_v_parent_keys, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1429
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1431
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1436
/* "bzrlib/_known_graph_pyx.pyx":115
1437
* for node in self.parents:
1438
* parent_keys.append(node.key)
1439
* child_keys = [] # <<<<<<<<<<<<<<
1440
* if self.children is not None:
1441
* for node in self.children:
1443
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1444
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
1445
__Pyx_DECREF(((PyObject *)__pyx_v_child_keys));
1446
__pyx_v_child_keys = __pyx_t_1;
1449
/* "bzrlib/_known_graph_pyx.pyx":116
1450
* parent_keys.append(node.key)
1452
* if self.children is not None: # <<<<<<<<<<<<<<
1453
* for node in self.children:
1454
* child_keys.append(node.key)
1456
__pyx_t_2 = (((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->children != Py_None);
1459
/* "bzrlib/_known_graph_pyx.pyx":117
1461
* if self.children is not None:
1462
* for node in self.children: # <<<<<<<<<<<<<<
1463
* child_keys.append(node.key)
1464
* return '%s(%s gdfo:%s par:%s child:%s)' % (
1466
if (PyList_CheckExact(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->children) || PyTuple_CheckExact(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->children)) {
1467
__pyx_t_3 = 0; __pyx_t_1 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->children; __Pyx_INCREF(__pyx_t_1);
1469
__pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1470
__Pyx_GOTREF(__pyx_t_1);
1473
if (likely(PyList_CheckExact(__pyx_t_1))) {
1474
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
1475
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
1476
} else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
1477
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
1478
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
1480
__pyx_t_4 = PyIter_Next(__pyx_t_1);
1482
if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1485
__Pyx_GOTREF(__pyx_t_4);
1487
if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1488
__Pyx_DECREF(((PyObject *)__pyx_v_node));
1489
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_4);
1492
/* "bzrlib/_known_graph_pyx.pyx":118
1493
* if self.children is not None:
1494
* for node in self.children:
1495
* child_keys.append(node.key) # <<<<<<<<<<<<<<
1496
* return '%s(%s gdfo:%s par:%s child:%s)' % (
1497
* self.__class__.__name__, self.key, self.gdfo,
1499
if (unlikely(__pyx_v_child_keys == Py_None)) {
1500
PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1502
__pyx_t_4 = __pyx_v_node->key;
1503
__Pyx_INCREF(__pyx_t_4);
1504
__pyx_t_5 = PyList_Append(__pyx_v_child_keys, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1505
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1507
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1512
/* "bzrlib/_known_graph_pyx.pyx":119
1513
* for node in self.children:
1514
* child_keys.append(node.key)
1515
* return '%s(%s gdfo:%s par:%s child:%s)' % ( # <<<<<<<<<<<<<<
1516
* self.__class__.__name__, self.key, self.gdfo,
1517
* parent_keys, child_keys)
1519
__Pyx_XDECREF(__pyx_r);
1521
/* "bzrlib/_known_graph_pyx.pyx":120
1522
* child_keys.append(node.key)
1523
* return '%s(%s gdfo:%s par:%s child:%s)' % (
1524
* self.__class__.__name__, self.key, self.gdfo, # <<<<<<<<<<<<<<
1525
* parent_keys, child_keys)
1528
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1529
__Pyx_GOTREF(__pyx_t_1);
1530
__pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1531
__Pyx_GOTREF(__pyx_t_4);
1532
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1533
__pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->gdfo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1534
__Pyx_GOTREF(__pyx_t_1);
1536
/* "bzrlib/_known_graph_pyx.pyx":121
1537
* return '%s(%s gdfo:%s par:%s child:%s)' % (
1538
* self.__class__.__name__, self.key, self.gdfo,
1539
* parent_keys, child_keys) # <<<<<<<<<<<<<<
1543
__pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1544
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
1545
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
1546
__Pyx_GIVEREF(__pyx_t_4);
1547
__Pyx_INCREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->key);
1548
PyTuple_SET_ITEM(__pyx_t_6, 1, ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->key);
1549
__Pyx_GIVEREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->key);
1550
PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
1551
__Pyx_GIVEREF(__pyx_t_1);
1552
__Pyx_INCREF(((PyObject *)__pyx_v_parent_keys));
1553
PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_v_parent_keys));
1554
__Pyx_GIVEREF(((PyObject *)__pyx_v_parent_keys));
1555
__Pyx_INCREF(((PyObject *)__pyx_v_child_keys));
1556
PyTuple_SET_ITEM(__pyx_t_6, 4, ((PyObject *)__pyx_v_child_keys));
1557
__Pyx_GIVEREF(((PyObject *)__pyx_v_child_keys));
1560
__pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1561
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
1562
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
1563
__pyx_r = ((PyObject *)__pyx_t_1);
1567
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1570
__Pyx_XDECREF(__pyx_t_1);
1571
__Pyx_XDECREF(__pyx_t_4);
1572
__Pyx_XDECREF(__pyx_t_6);
1573
__Pyx_AddTraceback("bzrlib._known_graph_pyx._KnownGraphNode.__repr__");
1576
__Pyx_DECREF((PyObject *)__pyx_v_node);
1577
__Pyx_DECREF(__pyx_v_parent_keys);
1578
__Pyx_DECREF(__pyx_v_child_keys);
1579
__Pyx_XGIVEREF(__pyx_r);
1580
__Pyx_RefNannyFinishContext();
1584
/* "bzrlib/_known_graph_pyx.pyx":69
1585
* cdef object parents
1586
* cdef object children
1587
* cdef public long gdfo # <<<<<<<<<<<<<<
1592
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_4gdfo___get__(PyObject *__pyx_v_self); /*proto*/
1593
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_4gdfo___get__(PyObject *__pyx_v_self) {
1594
PyObject *__pyx_r = NULL;
1595
PyObject *__pyx_t_1 = NULL;
1596
__Pyx_RefNannySetupContext("__get__");
1597
__Pyx_XDECREF(__pyx_r);
1598
__pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->gdfo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1599
__Pyx_GOTREF(__pyx_t_1);
1600
__pyx_r = __pyx_t_1;
1604
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1607
__Pyx_XDECREF(__pyx_t_1);
1608
__Pyx_AddTraceback("bzrlib._known_graph_pyx._KnownGraphNode.gdfo.__get__");
1611
__Pyx_XGIVEREF(__pyx_r);
1612
__Pyx_RefNannyFinishContext();
1616
static int __pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_4gdfo_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
1617
static int __pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_4gdfo_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
1620
__Pyx_RefNannySetupContext("__set__");
1621
__pyx_t_1 = __Pyx_PyInt_AsLong(__pyx_v_value); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1622
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_self)->gdfo = __pyx_t_1;
1627
__Pyx_AddTraceback("bzrlib._known_graph_pyx._KnownGraphNode.gdfo.__set__");
1630
__Pyx_RefNannyFinishContext();
1634
/* "bzrlib/_known_graph_pyx.pyx":124
1637
* cdef _KnownGraphNode _get_list_node(lst, Py_ssize_t pos): # <<<<<<<<<<<<<<
1638
* cdef PyObject *temp_node
1642
static struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(PyObject *__pyx_v_lst, Py_ssize_t __pyx_v_pos) {
1643
PyObject *__pyx_v_temp_node;
1644
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_r = NULL;
1645
__Pyx_RefNannySetupContext("_get_list_node");
1647
/* "bzrlib/_known_graph_pyx.pyx":127
1648
* cdef PyObject *temp_node
1650
* temp_node = PyList_GET_ITEM(lst, pos) # <<<<<<<<<<<<<<
1651
* return <_KnownGraphNode>temp_node
1654
__pyx_v_temp_node = PyList_GET_ITEM(__pyx_v_lst, __pyx_v_pos);
1656
/* "bzrlib/_known_graph_pyx.pyx":128
1658
* temp_node = PyList_GET_ITEM(lst, pos)
1659
* return <_KnownGraphNode>temp_node # <<<<<<<<<<<<<<
1663
__Pyx_XDECREF(((PyObject *)__pyx_r));
1664
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node)));
1665
__pyx_r = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node);
1668
__pyx_r = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
1670
__Pyx_XGIVEREF((PyObject *)__pyx_r);
1671
__Pyx_RefNannyFinishContext();
1675
/* "bzrlib/_known_graph_pyx.pyx":131
1678
* cdef _KnownGraphNode _get_tuple_node(tpl, Py_ssize_t pos): # <<<<<<<<<<<<<<
1679
* cdef PyObject *temp_node
1683
static struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_f_6bzrlib_16_known_graph_pyx__get_tuple_node(PyObject *__pyx_v_tpl, Py_ssize_t __pyx_v_pos) {
1684
PyObject *__pyx_v_temp_node;
1685
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_r = NULL;
1686
__Pyx_RefNannySetupContext("_get_tuple_node");
1688
/* "bzrlib/_known_graph_pyx.pyx":134
1689
* cdef PyObject *temp_node
1691
* temp_node = PyTuple_GET_ITEM(tpl, pos) # <<<<<<<<<<<<<<
1692
* return <_KnownGraphNode>temp_node
1695
__pyx_v_temp_node = PyTuple_GET_ITEM(__pyx_v_tpl, __pyx_v_pos);
1697
/* "bzrlib/_known_graph_pyx.pyx":135
1699
* temp_node = PyTuple_GET_ITEM(tpl, pos)
1700
* return <_KnownGraphNode>temp_node # <<<<<<<<<<<<<<
1704
__Pyx_XDECREF(((PyObject *)__pyx_r));
1705
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node)));
1706
__pyx_r = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node);
1709
__pyx_r = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
1711
__Pyx_XGIVEREF((PyObject *)__pyx_r);
1712
__Pyx_RefNannyFinishContext();
1716
/* "bzrlib/_known_graph_pyx.pyx":138
1719
* def get_key(node): # <<<<<<<<<<<<<<
1720
* cdef _KnownGraphNode real_node
1724
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_get_key(PyObject *__pyx_self, PyObject *__pyx_v_node); /*proto*/
1725
static PyMethodDef __pyx_mdef_6bzrlib_16_known_graph_pyx_get_key = {__Pyx_NAMESTR("get_key"), (PyCFunction)__pyx_pf_6bzrlib_16_known_graph_pyx_get_key, METH_O, __Pyx_DOCSTR(0)};
1726
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_get_key(PyObject *__pyx_self, PyObject *__pyx_v_node) {
1727
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_real_node;
1728
PyObject *__pyx_r = NULL;
1729
__Pyx_RefNannySetupContext("get_key");
1730
__pyx_self = __pyx_self;
1731
__pyx_v_real_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
1733
/* "bzrlib/_known_graph_pyx.pyx":140
1734
* def get_key(node):
1735
* cdef _KnownGraphNode real_node
1736
* real_node = node # <<<<<<<<<<<<<<
1737
* return real_node.key
1740
if (!(likely(((__pyx_v_node) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_node, __pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1741
__Pyx_INCREF(__pyx_v_node);
1742
__Pyx_DECREF(((PyObject *)__pyx_v_real_node));
1743
__pyx_v_real_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_node);
1745
/* "bzrlib/_known_graph_pyx.pyx":141
1746
* cdef _KnownGraphNode real_node
1748
* return real_node.key # <<<<<<<<<<<<<<
1752
__Pyx_XDECREF(__pyx_r);
1753
__Pyx_INCREF(__pyx_v_real_node->key);
1754
__pyx_r = __pyx_v_real_node->key;
1757
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1760
__Pyx_AddTraceback("bzrlib._known_graph_pyx.get_key");
1763
__Pyx_DECREF((PyObject *)__pyx_v_real_node);
1764
__Pyx_XGIVEREF(__pyx_r);
1765
__Pyx_RefNannyFinishContext();
1769
/* "bzrlib/_known_graph_pyx.pyx":144
1772
* cdef object _sort_list_nodes(object lst_or_tpl, int reverse): # <<<<<<<<<<<<<<
1773
* """Sort a list of _KnownGraphNode objects.
1777
static PyObject *__pyx_f_6bzrlib_16_known_graph_pyx__sort_list_nodes(PyObject *__pyx_v_lst_or_tpl, int __pyx_v_reverse) {
1778
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node1;
1779
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node2;
1780
int __pyx_v_do_swap;
1781
int __pyx_v_is_tuple;
1782
Py_ssize_t __pyx_v_length;
1783
PyObject *__pyx_r = NULL;
1787
PyObject *__pyx_t_4 = NULL;
1788
Py_ssize_t __pyx_t_5;
1789
PyObject *__pyx_t_6 = NULL;
1790
PyObject *__pyx_t_7 = NULL;
1791
__Pyx_RefNannySetupContext("_sort_list_nodes");
1792
__Pyx_INCREF(__pyx_v_lst_or_tpl);
1793
__pyx_v_node1 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
1794
__pyx_v_node2 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
1796
/* "bzrlib/_known_graph_pyx.pyx":154
1797
* cdef Py_ssize_t length
1799
* is_tuple = PyTuple_CheckExact(lst_or_tpl) # <<<<<<<<<<<<<<
1800
* if not (is_tuple or PyList_CheckExact(lst_or_tpl)):
1801
* raise TypeError('lst_or_tpl must be a list or tuple.')
1803
__pyx_v_is_tuple = PyTuple_CheckExact(__pyx_v_lst_or_tpl);
1805
/* "bzrlib/_known_graph_pyx.pyx":155
1807
* is_tuple = PyTuple_CheckExact(lst_or_tpl)
1808
* if not (is_tuple or PyList_CheckExact(lst_or_tpl)): # <<<<<<<<<<<<<<
1809
* raise TypeError('lst_or_tpl must be a list or tuple.')
1810
* length = len(lst_or_tpl)
1812
if (!__pyx_v_is_tuple) {
1813
__pyx_t_1 = PyList_CheckExact(__pyx_v_lst_or_tpl);
1814
__pyx_t_2 = __pyx_t_1;
1816
__pyx_t_2 = __pyx_v_is_tuple;
1818
__pyx_t_3 = (!__pyx_t_2);
1821
/* "bzrlib/_known_graph_pyx.pyx":156
1822
* is_tuple = PyTuple_CheckExact(lst_or_tpl)
1823
* if not (is_tuple or PyList_CheckExact(lst_or_tpl)):
1824
* raise TypeError('lst_or_tpl must be a list or tuple.') # <<<<<<<<<<<<<<
1825
* length = len(lst_or_tpl)
1826
* if length == 0 or length == 1:
1828
__pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1829
__Pyx_GOTREF(__pyx_t_4);
1830
__Pyx_Raise(__pyx_t_4, 0, 0);
1831
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1832
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1837
/* "bzrlib/_known_graph_pyx.pyx":157
1838
* if not (is_tuple or PyList_CheckExact(lst_or_tpl)):
1839
* raise TypeError('lst_or_tpl must be a list or tuple.')
1840
* length = len(lst_or_tpl) # <<<<<<<<<<<<<<
1841
* if length == 0 or length == 1:
1844
__pyx_t_5 = PyObject_Length(__pyx_v_lst_or_tpl); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1845
__pyx_v_length = __pyx_t_5;
1847
/* "bzrlib/_known_graph_pyx.pyx":158
1848
* raise TypeError('lst_or_tpl must be a list or tuple.')
1849
* length = len(lst_or_tpl)
1850
* if length == 0 or length == 1: # <<<<<<<<<<<<<<
1854
switch (__pyx_v_length) {
1858
/* "bzrlib/_known_graph_pyx.pyx":159
1859
* length = len(lst_or_tpl)
1860
* if length == 0 or length == 1:
1861
* return lst_or_tpl # <<<<<<<<<<<<<<
1865
__Pyx_XDECREF(__pyx_r);
1866
__Pyx_INCREF(__pyx_v_lst_or_tpl);
1867
__pyx_r = __pyx_v_lst_or_tpl;
1872
/* "bzrlib/_known_graph_pyx.pyx":160
1873
* if length == 0 or length == 1:
1875
* if length == 2: # <<<<<<<<<<<<<<
1877
* node1 = _get_tuple_node(lst_or_tpl, 0)
1879
__pyx_t_3 = (__pyx_v_length == 2);
1882
/* "bzrlib/_known_graph_pyx.pyx":161
1885
* if is_tuple: # <<<<<<<<<<<<<<
1886
* node1 = _get_tuple_node(lst_or_tpl, 0)
1887
* node2 = _get_tuple_node(lst_or_tpl, 1)
1889
if (__pyx_v_is_tuple) {
1891
/* "bzrlib/_known_graph_pyx.pyx":162
1894
* node1 = _get_tuple_node(lst_or_tpl, 0) # <<<<<<<<<<<<<<
1895
* node2 = _get_tuple_node(lst_or_tpl, 1)
1898
__pyx_t_4 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_tuple_node(__pyx_v_lst_or_tpl, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1899
__Pyx_GOTREF(__pyx_t_4);
1900
__Pyx_DECREF(((PyObject *)__pyx_v_node1));
1901
__pyx_v_node1 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_4);
1904
/* "bzrlib/_known_graph_pyx.pyx":163
1906
* node1 = _get_tuple_node(lst_or_tpl, 0)
1907
* node2 = _get_tuple_node(lst_or_tpl, 1) # <<<<<<<<<<<<<<
1909
* node1 = _get_list_node(lst_or_tpl, 0)
1911
__pyx_t_4 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_tuple_node(__pyx_v_lst_or_tpl, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1912
__Pyx_GOTREF(__pyx_t_4);
1913
__Pyx_DECREF(((PyObject *)__pyx_v_node2));
1914
__pyx_v_node2 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_4);
1920
/* "bzrlib/_known_graph_pyx.pyx":165
1921
* node2 = _get_tuple_node(lst_or_tpl, 1)
1923
* node1 = _get_list_node(lst_or_tpl, 0) # <<<<<<<<<<<<<<
1924
* node2 = _get_list_node(lst_or_tpl, 1)
1927
__pyx_t_4 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_v_lst_or_tpl, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1928
__Pyx_GOTREF(__pyx_t_4);
1929
__Pyx_DECREF(((PyObject *)__pyx_v_node1));
1930
__pyx_v_node1 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_4);
1933
/* "bzrlib/_known_graph_pyx.pyx":166
1935
* node1 = _get_list_node(lst_or_tpl, 0)
1936
* node2 = _get_list_node(lst_or_tpl, 1) # <<<<<<<<<<<<<<
1938
* do_swap = PyObject_RichCompareBool(node1.key, node2.key, Py_LT)
1940
__pyx_t_4 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_v_lst_or_tpl, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1941
__Pyx_GOTREF(__pyx_t_4);
1942
__Pyx_DECREF(((PyObject *)__pyx_v_node2));
1943
__pyx_v_node2 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_4);
1948
/* "bzrlib/_known_graph_pyx.pyx":167
1949
* node1 = _get_list_node(lst_or_tpl, 0)
1950
* node2 = _get_list_node(lst_or_tpl, 1)
1951
* if reverse: # <<<<<<<<<<<<<<
1952
* do_swap = PyObject_RichCompareBool(node1.key, node2.key, Py_LT)
1955
if (__pyx_v_reverse) {
1957
/* "bzrlib/_known_graph_pyx.pyx":168
1958
* node2 = _get_list_node(lst_or_tpl, 1)
1960
* do_swap = PyObject_RichCompareBool(node1.key, node2.key, Py_LT) # <<<<<<<<<<<<<<
1962
* do_swap = PyObject_RichCompareBool(node2.key, node1.key, Py_LT)
1964
__pyx_t_4 = __pyx_v_node1->key;
1965
__Pyx_INCREF(__pyx_t_4);
1966
__pyx_t_6 = __pyx_v_node2->key;
1967
__Pyx_INCREF(__pyx_t_6);
1968
__pyx_v_do_swap = PyObject_RichCompareBool(__pyx_t_4, __pyx_t_6, Py_LT);
1969
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1970
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1975
/* "bzrlib/_known_graph_pyx.pyx":170
1976
* do_swap = PyObject_RichCompareBool(node1.key, node2.key, Py_LT)
1978
* do_swap = PyObject_RichCompareBool(node2.key, node1.key, Py_LT) # <<<<<<<<<<<<<<
1982
__pyx_t_6 = __pyx_v_node2->key;
1983
__Pyx_INCREF(__pyx_t_6);
1984
__pyx_t_4 = __pyx_v_node1->key;
1985
__Pyx_INCREF(__pyx_t_4);
1986
__pyx_v_do_swap = PyObject_RichCompareBool(__pyx_t_6, __pyx_t_4, Py_LT);
1987
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1988
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1992
/* "bzrlib/_known_graph_pyx.pyx":171
1994
* do_swap = PyObject_RichCompareBool(node2.key, node1.key, Py_LT)
1995
* if not do_swap: # <<<<<<<<<<<<<<
1999
__pyx_t_3 = (!__pyx_v_do_swap);
2002
/* "bzrlib/_known_graph_pyx.pyx":172
2003
* do_swap = PyObject_RichCompareBool(node2.key, node1.key, Py_LT)
2005
* return lst_or_tpl # <<<<<<<<<<<<<<
2007
* return (node2, node1)
2009
__Pyx_XDECREF(__pyx_r);
2010
__Pyx_INCREF(__pyx_v_lst_or_tpl);
2011
__pyx_r = __pyx_v_lst_or_tpl;
2017
/* "bzrlib/_known_graph_pyx.pyx":173
2020
* if is_tuple: # <<<<<<<<<<<<<<
2021
* return (node2, node1)
2024
if (__pyx_v_is_tuple) {
2026
/* "bzrlib/_known_graph_pyx.pyx":174
2029
* return (node2, node1) # <<<<<<<<<<<<<<
2031
* # Swap 'in-place', since lists are mutable
2033
__Pyx_XDECREF(__pyx_r);
2034
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2035
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
2036
__Pyx_INCREF(((PyObject *)__pyx_v_node2));
2037
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_node2));
2038
__Pyx_GIVEREF(((PyObject *)__pyx_v_node2));
2039
__Pyx_INCREF(((PyObject *)__pyx_v_node1));
2040
PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_node1));
2041
__Pyx_GIVEREF(((PyObject *)__pyx_v_node1));
2042
__pyx_r = ((PyObject *)__pyx_t_4);
2049
/* "bzrlib/_known_graph_pyx.pyx":177
2051
* # Swap 'in-place', since lists are mutable
2052
* Py_INCREF(node1) # <<<<<<<<<<<<<<
2053
* PyList_SetItem(lst_or_tpl, 1, node1)
2056
Py_INCREF(((PyObject *)__pyx_v_node1));
2058
/* "bzrlib/_known_graph_pyx.pyx":178
2059
* # Swap 'in-place', since lists are mutable
2061
* PyList_SetItem(lst_or_tpl, 1, node1) # <<<<<<<<<<<<<<
2063
* PyList_SetItem(lst_or_tpl, 0, node2)
2065
__pyx_t_1 = PyList_SetItem(__pyx_v_lst_or_tpl, 1, ((PyObject *)__pyx_v_node1)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2067
/* "bzrlib/_known_graph_pyx.pyx":179
2069
* PyList_SetItem(lst_or_tpl, 1, node1)
2070
* Py_INCREF(node2) # <<<<<<<<<<<<<<
2071
* PyList_SetItem(lst_or_tpl, 0, node2)
2074
Py_INCREF(((PyObject *)__pyx_v_node2));
2076
/* "bzrlib/_known_graph_pyx.pyx":180
2077
* PyList_SetItem(lst_or_tpl, 1, node1)
2079
* PyList_SetItem(lst_or_tpl, 0, node2) # <<<<<<<<<<<<<<
2081
* # For all other sizes, we just use 'sorted()'
2083
__pyx_t_1 = PyList_SetItem(__pyx_v_lst_or_tpl, 0, ((PyObject *)__pyx_v_node2)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2085
/* "bzrlib/_known_graph_pyx.pyx":181
2087
* PyList_SetItem(lst_or_tpl, 0, node2)
2088
* return lst_or_tpl # <<<<<<<<<<<<<<
2089
* # For all other sizes, we just use 'sorted()'
2092
__Pyx_XDECREF(__pyx_r);
2093
__Pyx_INCREF(__pyx_v_lst_or_tpl);
2094
__pyx_r = __pyx_v_lst_or_tpl;
2102
/* "bzrlib/_known_graph_pyx.pyx":183
2104
* # For all other sizes, we just use 'sorted()'
2105
* if is_tuple: # <<<<<<<<<<<<<<
2106
* # Note that sorted() is just list(iterable).sort()
2107
* lst_or_tpl = list(lst_or_tpl)
2109
if (__pyx_v_is_tuple) {
2111
/* "bzrlib/_known_graph_pyx.pyx":185
2113
* # Note that sorted() is just list(iterable).sort()
2114
* lst_or_tpl = list(lst_or_tpl) # <<<<<<<<<<<<<<
2115
* lst_or_tpl.sort(key=get_key, reverse=reverse)
2118
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2119
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
2120
__Pyx_INCREF(__pyx_v_lst_or_tpl);
2121
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lst_or_tpl);
2122
__Pyx_GIVEREF(__pyx_v_lst_or_tpl);
2123
__pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2124
__Pyx_GOTREF(__pyx_t_6);
2125
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
2126
__Pyx_DECREF(__pyx_v_lst_or_tpl);
2127
__pyx_v_lst_or_tpl = __pyx_t_6;
2133
/* "bzrlib/_known_graph_pyx.pyx":186
2134
* # Note that sorted() is just list(iterable).sort()
2135
* lst_or_tpl = list(lst_or_tpl)
2136
* lst_or_tpl.sort(key=get_key, reverse=reverse) # <<<<<<<<<<<<<<
2140
__pyx_t_6 = PyObject_GetAttr(__pyx_v_lst_or_tpl, __pyx_n_s__sort); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2141
__Pyx_GOTREF(__pyx_t_6);
2142
__pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2143
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
2144
__pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_key); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2145
__Pyx_GOTREF(__pyx_t_7);
2146
if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__key), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2147
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2148
__pyx_t_7 = PyInt_FromLong(__pyx_v_reverse); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2149
__Pyx_GOTREF(__pyx_t_7);
2150
if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__reverse), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2151
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2152
__pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2153
__Pyx_GOTREF(__pyx_t_7);
2154
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2155
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
2156
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2158
/* "bzrlib/_known_graph_pyx.pyx":187
2159
* lst_or_tpl = list(lst_or_tpl)
2160
* lst_or_tpl.sort(key=get_key, reverse=reverse)
2161
* return lst_or_tpl # <<<<<<<<<<<<<<
2165
__Pyx_XDECREF(__pyx_r);
2166
__Pyx_INCREF(__pyx_v_lst_or_tpl);
2167
__pyx_r = __pyx_v_lst_or_tpl;
2170
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2173
__Pyx_XDECREF(__pyx_t_4);
2174
__Pyx_XDECREF(__pyx_t_6);
2175
__Pyx_XDECREF(__pyx_t_7);
2176
__Pyx_AddTraceback("bzrlib._known_graph_pyx._sort_list_nodes");
2179
__Pyx_DECREF((PyObject *)__pyx_v_node1);
2180
__Pyx_DECREF((PyObject *)__pyx_v_node2);
2181
__Pyx_DECREF(__pyx_v_lst_or_tpl);
2182
__Pyx_XGIVEREF(__pyx_r);
2183
__Pyx_RefNannyFinishContext();
2187
/* "bzrlib/_known_graph_pyx.pyx":199
2188
* cdef public int do_cache
2190
* def __init__(self, parent_map, do_cache=True): # <<<<<<<<<<<<<<
2191
* """Create a new KnownGraph instance.
2195
static int __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2196
static char __pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph___init__[] = "Create a new KnownGraph instance.\n\n :param parent_map: A dictionary mapping key => parent_keys\n ";
2197
struct wrapperbase __pyx_wrapperbase_6bzrlib_16_known_graph_pyx_10KnownGraph___init__;
2198
static int __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2199
PyObject *__pyx_v_parent_map = 0;
2200
PyObject *__pyx_v_do_cache = 0;
2202
PyObject *__pyx_t_1 = NULL;
2203
PyObject *__pyx_t_2 = NULL;
2205
PyObject *__pyx_t_4 = NULL;
2206
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent_map,&__pyx_n_s__do_cache,0};
2207
__Pyx_RefNannySetupContext("__init__");
2208
if (unlikely(__pyx_kwds)) {
2209
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
2210
PyObject* values[2] = {0,0};
2211
values[1] = __pyx_k_4;
2212
switch (PyTuple_GET_SIZE(__pyx_args)) {
2213
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2214
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2216
default: goto __pyx_L5_argtuple_error;
2218
switch (PyTuple_GET_SIZE(__pyx_args)) {
2220
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parent_map);
2221
if (likely(values[0])) kw_args--;
2222
else goto __pyx_L5_argtuple_error;
2225
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__do_cache);
2226
if (value) { values[1] = value; kw_args--; }
2229
if (unlikely(kw_args > 0)) {
2230
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2232
__pyx_v_parent_map = values[0];
2233
__pyx_v_do_cache = values[1];
2235
__pyx_v_do_cache = __pyx_k_4;
2236
switch (PyTuple_GET_SIZE(__pyx_args)) {
2237
case 2: __pyx_v_do_cache = PyTuple_GET_ITEM(__pyx_args, 1);
2238
case 1: __pyx_v_parent_map = PyTuple_GET_ITEM(__pyx_args, 0);
2240
default: goto __pyx_L5_argtuple_error;
2243
goto __pyx_L4_argument_unpacking_done;
2244
__pyx_L5_argtuple_error:;
2245
__Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2247
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.__init__");
2248
__Pyx_RefNannyFinishContext();
2250
__pyx_L4_argument_unpacking_done:;
2252
/* "bzrlib/_known_graph_pyx.pyx":205
2254
* # tests at pre-allocating the node dict actually slowed things down
2255
* self._nodes = {} # <<<<<<<<<<<<<<
2256
* # Maps {sorted(revision_id, revision_id): heads}
2257
* self._known_heads = {}
2259
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2260
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
2261
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
2262
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
2263
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
2264
((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes = ((PyObject *)__pyx_t_1);
2267
/* "bzrlib/_known_graph_pyx.pyx":207
2269
* # Maps {sorted(revision_id, revision_id): heads}
2270
* self._known_heads = {} # <<<<<<<<<<<<<<
2271
* self.do_cache = int(do_cache)
2272
* # TODO: consider disabling gc since we are allocating a lot of nodes
2274
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2275
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
2276
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
2277
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads);
2278
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads);
2279
((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads = ((PyObject *)__pyx_t_1);
2282
/* "bzrlib/_known_graph_pyx.pyx":208
2283
* # Maps {sorted(revision_id, revision_id): heads}
2284
* self._known_heads = {}
2285
* self.do_cache = int(do_cache) # <<<<<<<<<<<<<<
2286
* # TODO: consider disabling gc since we are allocating a lot of nodes
2287
* # that won't be collectable anyway. real world testing has not
2289
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2290
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
2291
__Pyx_INCREF(__pyx_v_do_cache);
2292
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_do_cache);
2293
__Pyx_GIVEREF(__pyx_v_do_cache);
2294
__pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2295
__Pyx_GOTREF(__pyx_t_2);
2296
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
2297
__pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2298
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2299
((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->do_cache = __pyx_t_3;
2301
/* "bzrlib/_known_graph_pyx.pyx":212
2302
* # that won't be collectable anyway. real world testing has not
2303
* # shown a specific impact, yet.
2304
* self._initialize_nodes(parent_map) # <<<<<<<<<<<<<<
2308
__pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___initialize_nodes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2309
__Pyx_GOTREF(__pyx_t_2);
2310
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2311
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
2312
__Pyx_INCREF(__pyx_v_parent_map);
2313
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_parent_map);
2314
__Pyx_GIVEREF(__pyx_v_parent_map);
2315
__pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2316
__Pyx_GOTREF(__pyx_t_4);
2317
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2318
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
2319
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2321
/* "bzrlib/_known_graph_pyx.pyx":213
2322
* # shown a specific impact, yet.
2323
* self._initialize_nodes(parent_map)
2324
* self._find_gdfo() # <<<<<<<<<<<<<<
2326
* def __dealloc__(self):
2328
__pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___find_gdfo); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2329
__Pyx_GOTREF(__pyx_t_4);
2330
__pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2331
__Pyx_GOTREF(__pyx_t_1);
2332
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2333
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2338
__Pyx_XDECREF(__pyx_t_1);
2339
__Pyx_XDECREF(__pyx_t_2);
2340
__Pyx_XDECREF(__pyx_t_4);
2341
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.__init__");
2344
__Pyx_RefNannyFinishContext();
2348
/* "bzrlib/_known_graph_pyx.pyx":215
2351
* def __dealloc__(self): # <<<<<<<<<<<<<<
2352
* cdef _KnownGraphNode child
2353
* cdef Py_ssize_t pos
2356
static void __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
2357
static void __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_1__dealloc__(PyObject *__pyx_v_self) {
2358
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_child;
2359
Py_ssize_t __pyx_v_pos;
2360
PyObject *__pyx_v_temp_node;
2361
PyObject *__pyx_t_1 = NULL;
2363
__Pyx_RefNannySetupContext("__dealloc__");
2364
__pyx_v_child = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
2366
/* "bzrlib/_known_graph_pyx.pyx":220
2367
* cdef PyObject *temp_node
2369
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node): # <<<<<<<<<<<<<<
2370
* child = <_KnownGraphNode>temp_node
2371
* child.clear_references()
2374
__pyx_t_1 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes;
2375
__Pyx_INCREF(__pyx_t_1);
2376
__pyx_t_2 = PyDict_Next(__pyx_t_1, (&__pyx_v_pos), NULL, (&__pyx_v_temp_node));
2377
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2378
if (!__pyx_t_2) break;
2380
/* "bzrlib/_known_graph_pyx.pyx":221
2382
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node):
2383
* child = <_KnownGraphNode>temp_node # <<<<<<<<<<<<<<
2384
* child.clear_references()
2387
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node)));
2388
__Pyx_DECREF(((PyObject *)__pyx_v_child));
2389
__pyx_v_child = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node);
2391
/* "bzrlib/_known_graph_pyx.pyx":222
2392
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node):
2393
* child = <_KnownGraphNode>temp_node
2394
* child.clear_references() # <<<<<<<<<<<<<<
2396
* cdef _KnownGraphNode _get_or_create_node(self, key):
2398
__pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_child->__pyx_vtab)->clear_references(__pyx_v_child); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2399
__Pyx_GOTREF(__pyx_t_1);
2400
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2405
__Pyx_XDECREF(__pyx_t_1);
2406
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.__dealloc__");
2408
__Pyx_DECREF((PyObject *)__pyx_v_child);
2409
__Pyx_RefNannyFinishContext();
2412
/* "bzrlib/_known_graph_pyx.pyx":224
2413
* child.clear_references()
2415
* cdef _KnownGraphNode _get_or_create_node(self, key): # <<<<<<<<<<<<<<
2416
* cdef PyObject *temp_node
2417
* cdef _KnownGraphNode node
2420
static struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_f_6bzrlib_16_known_graph_pyx_10KnownGraph__get_or_create_node(struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *__pyx_v_self, PyObject *__pyx_v_key) {
2421
PyObject *__pyx_v_temp_node;
2422
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
2423
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_r = NULL;
2424
PyObject *__pyx_t_1 = NULL;
2426
PyObject *__pyx_t_3 = NULL;
2428
__Pyx_RefNannySetupContext("_get_or_create_node");
2429
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
2431
/* "bzrlib/_known_graph_pyx.pyx":228
2432
* cdef _KnownGraphNode node
2434
* temp_node = PyDict_GetItem(self._nodes, key) # <<<<<<<<<<<<<<
2435
* if temp_node == NULL:
2436
* node = _KnownGraphNode(key)
2438
__pyx_t_1 = __pyx_v_self->_nodes;
2439
__Pyx_INCREF(__pyx_t_1);
2440
__pyx_v_temp_node = PyDict_GetItem(__pyx_t_1, __pyx_v_key);
2441
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2443
/* "bzrlib/_known_graph_pyx.pyx":229
2445
* temp_node = PyDict_GetItem(self._nodes, key)
2446
* if temp_node == NULL: # <<<<<<<<<<<<<<
2447
* node = _KnownGraphNode(key)
2448
* PyDict_SetItem(self._nodes, key, node)
2450
__pyx_t_2 = (__pyx_v_temp_node == NULL);
2453
/* "bzrlib/_known_graph_pyx.pyx":230
2454
* temp_node = PyDict_GetItem(self._nodes, key)
2455
* if temp_node == NULL:
2456
* node = _KnownGraphNode(key) # <<<<<<<<<<<<<<
2457
* PyDict_SetItem(self._nodes, key, node)
2460
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2461
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
2462
__Pyx_INCREF(__pyx_v_key);
2463
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_key);
2464
__Pyx_GIVEREF(__pyx_v_key);
2465
__pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2466
__Pyx_GOTREF(__pyx_t_3);
2467
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
2468
__Pyx_DECREF(((PyObject *)__pyx_v_node));
2469
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_3);
2472
/* "bzrlib/_known_graph_pyx.pyx":231
2473
* if temp_node == NULL:
2474
* node = _KnownGraphNode(key)
2475
* PyDict_SetItem(self._nodes, key, node) # <<<<<<<<<<<<<<
2477
* node = <_KnownGraphNode>temp_node
2479
__pyx_t_3 = __pyx_v_self->_nodes;
2480
__Pyx_INCREF(__pyx_t_3);
2481
__pyx_t_4 = PyDict_SetItem(__pyx_t_3, __pyx_v_key, ((PyObject *)__pyx_v_node)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2482
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2487
/* "bzrlib/_known_graph_pyx.pyx":233
2488
* PyDict_SetItem(self._nodes, key, node)
2490
* node = <_KnownGraphNode>temp_node # <<<<<<<<<<<<<<
2494
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node)));
2495
__Pyx_DECREF(((PyObject *)__pyx_v_node));
2496
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node);
2500
/* "bzrlib/_known_graph_pyx.pyx":234
2502
* node = <_KnownGraphNode>temp_node
2503
* return node # <<<<<<<<<<<<<<
2505
* cdef _populate_parents(self, _KnownGraphNode node, parent_keys):
2507
__Pyx_XDECREF(((PyObject *)__pyx_r));
2508
__Pyx_INCREF(((PyObject *)__pyx_v_node));
2509
__pyx_r = __pyx_v_node;
2512
__pyx_r = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
2515
__Pyx_XDECREF(__pyx_t_1);
2516
__Pyx_XDECREF(__pyx_t_3);
2517
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph._get_or_create_node");
2520
__Pyx_DECREF((PyObject *)__pyx_v_node);
2521
__Pyx_XGIVEREF((PyObject *)__pyx_r);
2522
__Pyx_RefNannyFinishContext();
2526
/* "bzrlib/_known_graph_pyx.pyx":236
2529
* cdef _populate_parents(self, _KnownGraphNode node, parent_keys): # <<<<<<<<<<<<<<
2530
* cdef Py_ssize_t num_parent_keys, pos
2531
* cdef _KnownGraphNode parent_node
2534
static PyObject *__pyx_f_6bzrlib_16_known_graph_pyx_10KnownGraph__populate_parents(struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *__pyx_v_self, struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node, PyObject *__pyx_v_parent_keys) {
2535
Py_ssize_t __pyx_v_num_parent_keys;
2536
Py_ssize_t __pyx_v_pos;
2537
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_parent_node;
2538
PyObject *__pyx_v_parent_nodes;
2539
PyObject *__pyx_r = NULL;
2540
Py_ssize_t __pyx_t_1;
2541
PyObject *__pyx_t_2 = NULL;
2542
PyObject *__pyx_t_3 = NULL;
2544
__Pyx_RefNannySetupContext("_populate_parents");
2545
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
2546
__pyx_v_parent_nodes = Py_None; __Pyx_INCREF(Py_None);
2548
/* "bzrlib/_known_graph_pyx.pyx":240
2549
* cdef _KnownGraphNode parent_node
2551
* num_parent_keys = len(parent_keys) # <<<<<<<<<<<<<<
2552
* # We know how many parents, so we pre allocate the tuple
2553
* parent_nodes = PyTuple_New(num_parent_keys)
2555
__pyx_t_1 = PyObject_Length(__pyx_v_parent_keys); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2556
__pyx_v_num_parent_keys = __pyx_t_1;
2558
/* "bzrlib/_known_graph_pyx.pyx":242
2559
* num_parent_keys = len(parent_keys)
2560
* # We know how many parents, so we pre allocate the tuple
2561
* parent_nodes = PyTuple_New(num_parent_keys) # <<<<<<<<<<<<<<
2562
* for pos from 0 <= pos < num_parent_keys:
2563
* # Note: it costs us 10ms out of 40ms to lookup all of these
2565
__pyx_t_2 = PyTuple_New(__pyx_v_num_parent_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2566
__Pyx_GOTREF(__pyx_t_2);
2567
__Pyx_DECREF(__pyx_v_parent_nodes);
2568
__pyx_v_parent_nodes = __pyx_t_2;
2571
/* "bzrlib/_known_graph_pyx.pyx":243
2572
* # We know how many parents, so we pre allocate the tuple
2573
* parent_nodes = PyTuple_New(num_parent_keys)
2574
* for pos from 0 <= pos < num_parent_keys: # <<<<<<<<<<<<<<
2575
* # Note: it costs us 10ms out of 40ms to lookup all of these
2576
* # parents, it doesn't seem to be an allocation overhead,
2578
__pyx_t_1 = __pyx_v_num_parent_keys;
2579
for (__pyx_v_pos = 0; __pyx_v_pos < __pyx_t_1; __pyx_v_pos++) {
2581
/* "bzrlib/_known_graph_pyx.pyx":251
2583
* # We use [] because parent_keys may be a tuple or list
2584
* parent_node = self._get_or_create_node(parent_keys[pos]) # <<<<<<<<<<<<<<
2585
* # PyTuple_SET_ITEM will steal a reference, so INCREF first
2586
* Py_INCREF(parent_node)
2588
__pyx_t_2 = __Pyx_GetItemInt(__pyx_v_parent_keys, __pyx_v_pos, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2589
__Pyx_GOTREF(__pyx_t_2);
2590
__pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self->__pyx_vtab)->_get_or_create_node(__pyx_v_self, __pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2591
__Pyx_GOTREF(__pyx_t_3);
2592
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2593
__Pyx_DECREF(((PyObject *)__pyx_v_parent_node));
2594
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_3);
2597
/* "bzrlib/_known_graph_pyx.pyx":253
2598
* parent_node = self._get_or_create_node(parent_keys[pos])
2599
* # PyTuple_SET_ITEM will steal a reference, so INCREF first
2600
* Py_INCREF(parent_node) # <<<<<<<<<<<<<<
2601
* PyTuple_SET_ITEM(parent_nodes, pos, parent_node)
2602
* PyList_Append(parent_node.children, node)
2604
Py_INCREF(((PyObject *)__pyx_v_parent_node));
2606
/* "bzrlib/_known_graph_pyx.pyx":254
2607
* # PyTuple_SET_ITEM will steal a reference, so INCREF first
2608
* Py_INCREF(parent_node)
2609
* PyTuple_SET_ITEM(parent_nodes, pos, parent_node) # <<<<<<<<<<<<<<
2610
* PyList_Append(parent_node.children, node)
2611
* node.parents = parent_nodes
2613
PyTuple_SET_ITEM(__pyx_v_parent_nodes, __pyx_v_pos, ((PyObject *)__pyx_v_parent_node));
2615
/* "bzrlib/_known_graph_pyx.pyx":255
2616
* Py_INCREF(parent_node)
2617
* PyTuple_SET_ITEM(parent_nodes, pos, parent_node)
2618
* PyList_Append(parent_node.children, node) # <<<<<<<<<<<<<<
2619
* node.parents = parent_nodes
2622
__pyx_t_3 = __pyx_v_parent_node->children;
2623
__Pyx_INCREF(__pyx_t_3);
2624
__pyx_t_4 = PyList_Append(__pyx_t_3, ((PyObject *)__pyx_v_node)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2625
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2628
/* "bzrlib/_known_graph_pyx.pyx":256
2629
* PyTuple_SET_ITEM(parent_nodes, pos, parent_node)
2630
* PyList_Append(parent_node.children, node)
2631
* node.parents = parent_nodes # <<<<<<<<<<<<<<
2633
* def _initialize_nodes(self, parent_map):
2635
__Pyx_INCREF(__pyx_v_parent_nodes);
2636
__Pyx_GIVEREF(__pyx_v_parent_nodes);
2637
__Pyx_GOTREF(__pyx_v_node->parents);
2638
__Pyx_DECREF(__pyx_v_node->parents);
2639
__pyx_v_node->parents = __pyx_v_parent_nodes;
2641
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2644
__Pyx_XDECREF(__pyx_t_2);
2645
__Pyx_XDECREF(__pyx_t_3);
2646
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph._populate_parents");
2649
__Pyx_DECREF((PyObject *)__pyx_v_parent_node);
2650
__Pyx_DECREF(__pyx_v_parent_nodes);
2651
__Pyx_XGIVEREF(__pyx_r);
2652
__Pyx_RefNannyFinishContext();
2656
/* "bzrlib/_known_graph_pyx.pyx":258
2657
* node.parents = parent_nodes
2659
* def _initialize_nodes(self, parent_map): # <<<<<<<<<<<<<<
2660
* """Populate self._nodes.
2664
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_2_initialize_nodes(PyObject *__pyx_v_self, PyObject *__pyx_v_parent_map); /*proto*/
2665
static char __pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_2_initialize_nodes[] = "Populate self._nodes.\n\n After this has finished:\n - self._nodes will have an entry for every entry in parent_map.\n - ghosts will have a parent_keys = None,\n - all nodes found will also have child_keys populated with all known\n child keys,\n ";
2666
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_2_initialize_nodes(PyObject *__pyx_v_self, PyObject *__pyx_v_parent_map) {
2667
PyObject *__pyx_v_temp_key;
2668
PyObject *__pyx_v_temp_parent_keys;
2669
Py_ssize_t __pyx_v_pos;
2670
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
2671
PyObject *__pyx_v_key;
2672
PyObject *__pyx_v_parent_keys;
2673
PyObject *__pyx_r = NULL;
2675
PyObject *__pyx_t_2 = NULL;
2677
__Pyx_RefNannySetupContext("_initialize_nodes");
2678
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
2679
__pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
2680
__pyx_v_parent_keys = Py_None; __Pyx_INCREF(Py_None);
2682
/* "bzrlib/_known_graph_pyx.pyx":272
2683
* cdef _KnownGraphNode parent_node
2685
* if not PyDict_CheckExact(parent_map): # <<<<<<<<<<<<<<
2686
* raise TypeError('parent_map should be a dict of {key:parent_keys}')
2687
* # for key, parent_keys in parent_map.iteritems():
2689
__pyx_t_1 = (!PyDict_CheckExact(__pyx_v_parent_map));
2692
/* "bzrlib/_known_graph_pyx.pyx":273
2694
* if not PyDict_CheckExact(parent_map):
2695
* raise TypeError('parent_map should be a dict of {key:parent_keys}') # <<<<<<<<<<<<<<
2696
* # for key, parent_keys in parent_map.iteritems():
2699
__pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2700
__Pyx_GOTREF(__pyx_t_2);
2701
__Pyx_Raise(__pyx_t_2, 0, 0);
2702
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2703
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2708
/* "bzrlib/_known_graph_pyx.pyx":275
2709
* raise TypeError('parent_map should be a dict of {key:parent_keys}')
2710
* # for key, parent_keys in parent_map.iteritems():
2711
* pos = 0 # <<<<<<<<<<<<<<
2712
* while PyDict_Next(parent_map, &pos, &temp_key, &temp_parent_keys):
2713
* key = <object>temp_key
2717
/* "bzrlib/_known_graph_pyx.pyx":276
2718
* # for key, parent_keys in parent_map.iteritems():
2720
* while PyDict_Next(parent_map, &pos, &temp_key, &temp_parent_keys): # <<<<<<<<<<<<<<
2721
* key = <object>temp_key
2722
* parent_keys = <object>temp_parent_keys
2725
__pyx_t_3 = PyDict_Next(__pyx_v_parent_map, (&__pyx_v_pos), (&__pyx_v_temp_key), (&__pyx_v_temp_parent_keys));
2726
if (!__pyx_t_3) break;
2728
/* "bzrlib/_known_graph_pyx.pyx":277
2730
* while PyDict_Next(parent_map, &pos, &temp_key, &temp_parent_keys):
2731
* key = <object>temp_key # <<<<<<<<<<<<<<
2732
* parent_keys = <object>temp_parent_keys
2733
* node = self._get_or_create_node(key)
2735
__Pyx_INCREF(((PyObject *)__pyx_v_temp_key));
2736
__Pyx_DECREF(__pyx_v_key);
2737
__pyx_v_key = ((PyObject *)__pyx_v_temp_key);
2739
/* "bzrlib/_known_graph_pyx.pyx":278
2740
* while PyDict_Next(parent_map, &pos, &temp_key, &temp_parent_keys):
2741
* key = <object>temp_key
2742
* parent_keys = <object>temp_parent_keys # <<<<<<<<<<<<<<
2743
* node = self._get_or_create_node(key)
2744
* self._populate_parents(node, parent_keys)
2746
__Pyx_INCREF(((PyObject *)__pyx_v_temp_parent_keys));
2747
__Pyx_DECREF(__pyx_v_parent_keys);
2748
__pyx_v_parent_keys = ((PyObject *)__pyx_v_temp_parent_keys);
2750
/* "bzrlib/_known_graph_pyx.pyx":279
2751
* key = <object>temp_key
2752
* parent_keys = <object>temp_parent_keys
2753
* node = self._get_or_create_node(key) # <<<<<<<<<<<<<<
2754
* self._populate_parents(node, parent_keys)
2757
__pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx_KnownGraph *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->__pyx_vtab)->_get_or_create_node(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self), __pyx_v_key)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2758
__Pyx_GOTREF(__pyx_t_2);
2759
__Pyx_DECREF(((PyObject *)__pyx_v_node));
2760
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_2);
2763
/* "bzrlib/_known_graph_pyx.pyx":280
2764
* parent_keys = <object>temp_parent_keys
2765
* node = self._get_or_create_node(key)
2766
* self._populate_parents(node, parent_keys) # <<<<<<<<<<<<<<
2768
* def _find_tails(self):
2770
__pyx_t_2 = ((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx_KnownGraph *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->__pyx_vtab)->_populate_parents(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self), __pyx_v_node, __pyx_v_parent_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2771
__Pyx_GOTREF(__pyx_t_2);
2772
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2775
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2778
__Pyx_XDECREF(__pyx_t_2);
2779
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph._initialize_nodes");
2782
__Pyx_DECREF((PyObject *)__pyx_v_node);
2783
__Pyx_DECREF(__pyx_v_key);
2784
__Pyx_DECREF(__pyx_v_parent_keys);
2785
__Pyx_XGIVEREF(__pyx_r);
2786
__Pyx_RefNannyFinishContext();
2790
/* "bzrlib/_known_graph_pyx.pyx":282
2791
* self._populate_parents(node, parent_keys)
2793
* def _find_tails(self): # <<<<<<<<<<<<<<
2794
* cdef PyObject *temp_node
2795
* cdef _KnownGraphNode node
2798
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_3_find_tails(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2799
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_3_find_tails(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2800
PyObject *__pyx_v_temp_node;
2801
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
2802
Py_ssize_t __pyx_v_pos;
2803
PyObject *__pyx_v_tails;
2804
PyObject *__pyx_r = NULL;
2805
PyObject *__pyx_t_1 = NULL;
2810
__Pyx_RefNannySetupContext("_find_tails");
2811
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
2812
__pyx_v_tails = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
2814
/* "bzrlib/_known_graph_pyx.pyx":287
2815
* cdef Py_ssize_t pos
2817
* tails = [] # <<<<<<<<<<<<<<
2819
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node):
2821
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2822
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
2823
__Pyx_DECREF(((PyObject *)__pyx_v_tails));
2824
__pyx_v_tails = __pyx_t_1;
2827
/* "bzrlib/_known_graph_pyx.pyx":288
2830
* pos = 0 # <<<<<<<<<<<<<<
2831
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node):
2832
* node = <_KnownGraphNode>temp_node
2836
/* "bzrlib/_known_graph_pyx.pyx":289
2839
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node): # <<<<<<<<<<<<<<
2840
* node = <_KnownGraphNode>temp_node
2841
* if node.parents is None or PyTuple_GET_SIZE(node.parents) == 0:
2844
__pyx_t_1 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes;
2845
__Pyx_INCREF(__pyx_t_1);
2846
__pyx_t_2 = PyDict_Next(__pyx_t_1, (&__pyx_v_pos), NULL, (&__pyx_v_temp_node));
2847
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2848
if (!__pyx_t_2) break;
2850
/* "bzrlib/_known_graph_pyx.pyx":290
2852
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node):
2853
* node = <_KnownGraphNode>temp_node # <<<<<<<<<<<<<<
2854
* if node.parents is None or PyTuple_GET_SIZE(node.parents) == 0:
2857
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node)));
2858
__Pyx_DECREF(((PyObject *)__pyx_v_node));
2859
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node);
2861
/* "bzrlib/_known_graph_pyx.pyx":291
2862
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node):
2863
* node = <_KnownGraphNode>temp_node
2864
* if node.parents is None or PyTuple_GET_SIZE(node.parents) == 0: # <<<<<<<<<<<<<<
2866
* PyList_Append(tails, node)
2868
__pyx_t_3 = (__pyx_v_node->parents == Py_None);
2870
__pyx_t_1 = __pyx_v_node->parents;
2871
__Pyx_INCREF(__pyx_t_1);
2872
__pyx_t_4 = (PyTuple_GET_SIZE(__pyx_t_1) == 0);
2873
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2874
__pyx_t_5 = __pyx_t_4;
2876
__pyx_t_5 = __pyx_t_3;
2880
/* "bzrlib/_known_graph_pyx.pyx":292
2881
* node = <_KnownGraphNode>temp_node
2882
* if node.parents is None or PyTuple_GET_SIZE(node.parents) == 0:
2883
* node.gdfo = 1 # <<<<<<<<<<<<<<
2884
* PyList_Append(tails, node)
2887
__pyx_v_node->gdfo = 1;
2889
/* "bzrlib/_known_graph_pyx.pyx":293
2890
* if node.parents is None or PyTuple_GET_SIZE(node.parents) == 0:
2892
* PyList_Append(tails, node) # <<<<<<<<<<<<<<
2896
__pyx_t_2 = PyList_Append(((PyObject *)__pyx_v_tails), ((PyObject *)__pyx_v_node)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2902
/* "bzrlib/_known_graph_pyx.pyx":294
2904
* PyList_Append(tails, node)
2905
* return tails # <<<<<<<<<<<<<<
2907
* def _find_tips(self):
2909
__Pyx_XDECREF(__pyx_r);
2910
__Pyx_INCREF(((PyObject *)__pyx_v_tails));
2911
__pyx_r = ((PyObject *)__pyx_v_tails);
2914
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2917
__Pyx_XDECREF(__pyx_t_1);
2918
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph._find_tails");
2921
__Pyx_DECREF((PyObject *)__pyx_v_node);
2922
__Pyx_DECREF(__pyx_v_tails);
2923
__Pyx_XGIVEREF(__pyx_r);
2924
__Pyx_RefNannyFinishContext();
2928
/* "bzrlib/_known_graph_pyx.pyx":296
2931
* def _find_tips(self): # <<<<<<<<<<<<<<
2932
* cdef PyObject *temp_node
2933
* cdef _KnownGraphNode node
2936
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_4_find_tips(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2937
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_4_find_tips(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2938
PyObject *__pyx_v_temp_node;
2939
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
2940
Py_ssize_t __pyx_v_pos;
2941
PyObject *__pyx_v_tips;
2942
PyObject *__pyx_r = NULL;
2943
PyObject *__pyx_t_1 = NULL;
2946
__Pyx_RefNannySetupContext("_find_tips");
2947
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
2948
__pyx_v_tips = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
2950
/* "bzrlib/_known_graph_pyx.pyx":301
2951
* cdef Py_ssize_t pos
2953
* tips = [] # <<<<<<<<<<<<<<
2955
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node):
2957
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2958
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
2959
__Pyx_DECREF(((PyObject *)__pyx_v_tips));
2960
__pyx_v_tips = __pyx_t_1;
2963
/* "bzrlib/_known_graph_pyx.pyx":302
2966
* pos = 0 # <<<<<<<<<<<<<<
2967
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node):
2968
* node = <_KnownGraphNode>temp_node
2972
/* "bzrlib/_known_graph_pyx.pyx":303
2975
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node): # <<<<<<<<<<<<<<
2976
* node = <_KnownGraphNode>temp_node
2977
* if PyList_GET_SIZE(node.children) == 0:
2980
__pyx_t_1 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes;
2981
__Pyx_INCREF(__pyx_t_1);
2982
__pyx_t_2 = PyDict_Next(__pyx_t_1, (&__pyx_v_pos), NULL, (&__pyx_v_temp_node));
2983
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2984
if (!__pyx_t_2) break;
2986
/* "bzrlib/_known_graph_pyx.pyx":304
2988
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node):
2989
* node = <_KnownGraphNode>temp_node # <<<<<<<<<<<<<<
2990
* if PyList_GET_SIZE(node.children) == 0:
2991
* PyList_Append(tips, node)
2993
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node)));
2994
__Pyx_DECREF(((PyObject *)__pyx_v_node));
2995
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node);
2997
/* "bzrlib/_known_graph_pyx.pyx":305
2998
* while PyDict_Next(self._nodes, &pos, NULL, &temp_node):
2999
* node = <_KnownGraphNode>temp_node
3000
* if PyList_GET_SIZE(node.children) == 0: # <<<<<<<<<<<<<<
3001
* PyList_Append(tips, node)
3004
__pyx_t_1 = __pyx_v_node->children;
3005
__Pyx_INCREF(__pyx_t_1);
3006
__pyx_t_3 = (PyList_GET_SIZE(__pyx_t_1) == 0);
3007
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3010
/* "bzrlib/_known_graph_pyx.pyx":306
3011
* node = <_KnownGraphNode>temp_node
3012
* if PyList_GET_SIZE(node.children) == 0:
3013
* PyList_Append(tips, node) # <<<<<<<<<<<<<<
3017
__pyx_t_2 = PyList_Append(((PyObject *)__pyx_v_tips), ((PyObject *)__pyx_v_node)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3023
/* "bzrlib/_known_graph_pyx.pyx":307
3024
* if PyList_GET_SIZE(node.children) == 0:
3025
* PyList_Append(tips, node)
3026
* return tips # <<<<<<<<<<<<<<
3028
* def _find_gdfo(self):
3030
__Pyx_XDECREF(__pyx_r);
3031
__Pyx_INCREF(((PyObject *)__pyx_v_tips));
3032
__pyx_r = ((PyObject *)__pyx_v_tips);
3035
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
3038
__Pyx_XDECREF(__pyx_t_1);
3039
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph._find_tips");
3042
__Pyx_DECREF((PyObject *)__pyx_v_node);
3043
__Pyx_DECREF(__pyx_v_tips);
3044
__Pyx_XGIVEREF(__pyx_r);
3045
__Pyx_RefNannyFinishContext();
3049
/* "bzrlib/_known_graph_pyx.pyx":309
3052
* def _find_gdfo(self): # <<<<<<<<<<<<<<
3053
* cdef _KnownGraphNode node
3054
* cdef _KnownGraphNode child
3057
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_5_find_gdfo(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3058
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_5_find_gdfo(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3059
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
3060
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_child;
3061
Py_ssize_t __pyx_v_pos;
3062
Py_ssize_t __pyx_v_last_item;
3063
long __pyx_v_next_gdfo;
3064
PyObject *__pyx_v_pending;
3065
PyObject *__pyx_r = NULL;
3066
PyObject *__pyx_t_1 = NULL;
3067
PyObject *__pyx_t_2 = NULL;
3069
Py_ssize_t __pyx_t_4;
3071
__Pyx_RefNannySetupContext("_find_gdfo");
3072
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
3073
__pyx_v_child = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
3074
__pyx_v_pending = Py_None; __Pyx_INCREF(Py_None);
3076
/* "bzrlib/_known_graph_pyx.pyx":318
3077
* cdef long next_gdfo
3079
* pending = self._find_tails() # <<<<<<<<<<<<<<
3081
* last_item = PyList_GET_SIZE(pending) - 1
3083
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___find_tails); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3084
__Pyx_GOTREF(__pyx_t_1);
3085
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3086
__Pyx_GOTREF(__pyx_t_2);
3087
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3088
__Pyx_DECREF(__pyx_v_pending);
3089
__pyx_v_pending = __pyx_t_2;
3092
/* "bzrlib/_known_graph_pyx.pyx":320
3093
* pending = self._find_tails()
3095
* last_item = PyList_GET_SIZE(pending) - 1 # <<<<<<<<<<<<<<
3096
* while last_item >= 0:
3097
* # Avoid pop followed by push, instead, peek, and replace
3099
__pyx_v_last_item = (PyList_GET_SIZE(__pyx_v_pending) - 1);
3101
/* "bzrlib/_known_graph_pyx.pyx":321
3103
* last_item = PyList_GET_SIZE(pending) - 1
3104
* while last_item >= 0: # <<<<<<<<<<<<<<
3105
* # Avoid pop followed by push, instead, peek, and replace
3106
* # timing shows this is 930ms => 770ms for OOo
3109
__pyx_t_3 = (__pyx_v_last_item >= 0);
3110
if (!__pyx_t_3) break;
3112
/* "bzrlib/_known_graph_pyx.pyx":324
3113
* # Avoid pop followed by push, instead, peek, and replace
3114
* # timing shows this is 930ms => 770ms for OOo
3115
* node = _get_list_node(pending, last_item) # <<<<<<<<<<<<<<
3116
* last_item = last_item - 1
3117
* next_gdfo = node.gdfo + 1
3119
__pyx_t_2 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_v_pending, __pyx_v_last_item)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3120
__Pyx_GOTREF(__pyx_t_2);
3121
__Pyx_DECREF(((PyObject *)__pyx_v_node));
3122
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_2);
3125
/* "bzrlib/_known_graph_pyx.pyx":325
3126
* # timing shows this is 930ms => 770ms for OOo
3127
* node = _get_list_node(pending, last_item)
3128
* last_item = last_item - 1 # <<<<<<<<<<<<<<
3129
* next_gdfo = node.gdfo + 1
3130
* for pos from 0 <= pos < PyList_GET_SIZE(node.children):
3132
__pyx_v_last_item = (__pyx_v_last_item - 1);
3134
/* "bzrlib/_known_graph_pyx.pyx":326
3135
* node = _get_list_node(pending, last_item)
3136
* last_item = last_item - 1
3137
* next_gdfo = node.gdfo + 1 # <<<<<<<<<<<<<<
3138
* for pos from 0 <= pos < PyList_GET_SIZE(node.children):
3139
* child = _get_list_node(node.children, pos)
3141
__pyx_v_next_gdfo = (__pyx_v_node->gdfo + 1);
3143
/* "bzrlib/_known_graph_pyx.pyx":327
3144
* last_item = last_item - 1
3145
* next_gdfo = node.gdfo + 1
3146
* for pos from 0 <= pos < PyList_GET_SIZE(node.children): # <<<<<<<<<<<<<<
3147
* child = _get_list_node(node.children, pos)
3148
* if next_gdfo > child.gdfo:
3150
__pyx_t_2 = __pyx_v_node->children;
3151
__Pyx_INCREF(__pyx_t_2);
3152
__pyx_t_4 = PyList_GET_SIZE(__pyx_t_2);
3153
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3154
for (__pyx_v_pos = 0; __pyx_v_pos < __pyx_t_4; __pyx_v_pos++) {
3156
/* "bzrlib/_known_graph_pyx.pyx":328
3157
* next_gdfo = node.gdfo + 1
3158
* for pos from 0 <= pos < PyList_GET_SIZE(node.children):
3159
* child = _get_list_node(node.children, pos) # <<<<<<<<<<<<<<
3160
* if next_gdfo > child.gdfo:
3161
* child.gdfo = next_gdfo
3163
__pyx_t_2 = __pyx_v_node->children;
3164
__Pyx_INCREF(__pyx_t_2);
3165
__pyx_t_1 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_t_2, __pyx_v_pos)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3166
__Pyx_GOTREF(__pyx_t_1);
3167
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3168
__Pyx_DECREF(((PyObject *)__pyx_v_child));
3169
__pyx_v_child = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_1);
3172
/* "bzrlib/_known_graph_pyx.pyx":329
3173
* for pos from 0 <= pos < PyList_GET_SIZE(node.children):
3174
* child = _get_list_node(node.children, pos)
3175
* if next_gdfo > child.gdfo: # <<<<<<<<<<<<<<
3176
* child.gdfo = next_gdfo
3177
* child.seen = child.seen + 1
3179
__pyx_t_3 = (__pyx_v_next_gdfo > __pyx_v_child->gdfo);
3182
/* "bzrlib/_known_graph_pyx.pyx":330
3183
* child = _get_list_node(node.children, pos)
3184
* if next_gdfo > child.gdfo:
3185
* child.gdfo = next_gdfo # <<<<<<<<<<<<<<
3186
* child.seen = child.seen + 1
3187
* if child.seen == PyTuple_GET_SIZE(child.parents):
3189
__pyx_v_child->gdfo = __pyx_v_next_gdfo;
3194
/* "bzrlib/_known_graph_pyx.pyx":331
3195
* if next_gdfo > child.gdfo:
3196
* child.gdfo = next_gdfo
3197
* child.seen = child.seen + 1 # <<<<<<<<<<<<<<
3198
* if child.seen == PyTuple_GET_SIZE(child.parents):
3199
* # This child is populated, queue it to be walked
3201
__pyx_v_child->seen = (__pyx_v_child->seen + 1);
3203
/* "bzrlib/_known_graph_pyx.pyx":332
3204
* child.gdfo = next_gdfo
3205
* child.seen = child.seen + 1
3206
* if child.seen == PyTuple_GET_SIZE(child.parents): # <<<<<<<<<<<<<<
3207
* # This child is populated, queue it to be walked
3208
* last_item = last_item + 1
3210
__pyx_t_1 = __pyx_v_child->parents;
3211
__Pyx_INCREF(__pyx_t_1);
3212
__pyx_t_3 = (__pyx_v_child->seen == PyTuple_GET_SIZE(__pyx_t_1));
3213
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3216
/* "bzrlib/_known_graph_pyx.pyx":334
3217
* if child.seen == PyTuple_GET_SIZE(child.parents):
3218
* # This child is populated, queue it to be walked
3219
* last_item = last_item + 1 # <<<<<<<<<<<<<<
3220
* if last_item < PyList_GET_SIZE(pending):
3221
* Py_INCREF(child) # SetItem steals a ref
3223
__pyx_v_last_item = (__pyx_v_last_item + 1);
3225
/* "bzrlib/_known_graph_pyx.pyx":335
3226
* # This child is populated, queue it to be walked
3227
* last_item = last_item + 1
3228
* if last_item < PyList_GET_SIZE(pending): # <<<<<<<<<<<<<<
3229
* Py_INCREF(child) # SetItem steals a ref
3230
* PyList_SetItem(pending, last_item, child)
3232
__pyx_t_3 = (__pyx_v_last_item < PyList_GET_SIZE(__pyx_v_pending));
3235
/* "bzrlib/_known_graph_pyx.pyx":336
3236
* last_item = last_item + 1
3237
* if last_item < PyList_GET_SIZE(pending):
3238
* Py_INCREF(child) # SetItem steals a ref # <<<<<<<<<<<<<<
3239
* PyList_SetItem(pending, last_item, child)
3242
Py_INCREF(((PyObject *)__pyx_v_child));
3244
/* "bzrlib/_known_graph_pyx.pyx":337
3245
* if last_item < PyList_GET_SIZE(pending):
3246
* Py_INCREF(child) # SetItem steals a ref
3247
* PyList_SetItem(pending, last_item, child) # <<<<<<<<<<<<<<
3249
* PyList_Append(pending, child)
3251
__pyx_t_5 = PyList_SetItem(__pyx_v_pending, __pyx_v_last_item, ((PyObject *)__pyx_v_child)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3256
/* "bzrlib/_known_graph_pyx.pyx":339
3257
* PyList_SetItem(pending, last_item, child)
3259
* PyList_Append(pending, child) # <<<<<<<<<<<<<<
3260
* # We have queued this node, we don't need to track it
3263
__pyx_t_5 = PyList_Append(__pyx_v_pending, ((PyObject *)__pyx_v_child)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3267
/* "bzrlib/_known_graph_pyx.pyx":342
3268
* # We have queued this node, we don't need to track it
3270
* child.seen = 0 # <<<<<<<<<<<<<<
3272
* def add_node(self, key, parent_keys):
3274
__pyx_v_child->seen = 0;
3281
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
3284
__Pyx_XDECREF(__pyx_t_1);
3285
__Pyx_XDECREF(__pyx_t_2);
3286
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph._find_gdfo");
3289
__Pyx_DECREF((PyObject *)__pyx_v_node);
3290
__Pyx_DECREF((PyObject *)__pyx_v_child);
3291
__Pyx_DECREF(__pyx_v_pending);
3292
__Pyx_XGIVEREF(__pyx_r);
3293
__Pyx_RefNannyFinishContext();
3297
/* "bzrlib/_known_graph_pyx.pyx":344
3300
* def add_node(self, key, parent_keys): # <<<<<<<<<<<<<<
3301
* """Add a new node to the graph.
3305
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_6add_node(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3306
static char __pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_6add_node[] = "Add a new node to the graph.\n\n If this fills in a ghost, then the gdfos of all children will be\n updated accordingly.\n \n :param key: The node being added. If this is a duplicate, this is a\n no-op.\n :param parent_keys: The parents of the given node.\n :return: None (should we return if this was a ghost, etc?)\n ";
3307
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_6add_node(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3308
PyObject *__pyx_v_key = 0;
3309
PyObject *__pyx_v_parent_keys = 0;
3310
PyObject *__pyx_v_maybe_node;
3311
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
3312
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_parent_node;
3313
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_child_node;
3314
long __pyx_v_parent_gdfo;
3315
long __pyx_v_next_gdfo;
3316
PyObject *__pyx_v_existing_parent_keys;
3317
PyObject *__pyx_v_pending;
3318
PyObject *__pyx_v_pending_popleft;
3319
PyObject *__pyx_v_pending_append;
3320
PyObject *__pyx_r = NULL;
3321
PyObject *__pyx_t_1 = NULL;
3323
PyObject *__pyx_t_3 = NULL;
3324
Py_ssize_t __pyx_t_4;
3326
PyObject *__pyx_t_6 = NULL;
3327
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__parent_keys,0};
3328
__Pyx_RefNannySetupContext("add_node");
3329
if (unlikely(__pyx_kwds)) {
3330
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
3331
PyObject* values[2] = {0,0};
3332
switch (PyTuple_GET_SIZE(__pyx_args)) {
3333
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3334
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3336
default: goto __pyx_L5_argtuple_error;
3338
switch (PyTuple_GET_SIZE(__pyx_args)) {
3340
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
3341
if (likely(values[0])) kw_args--;
3342
else goto __pyx_L5_argtuple_error;
3344
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parent_keys);
3345
if (likely(values[1])) kw_args--;
3347
__Pyx_RaiseArgtupleInvalid("add_node", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3350
if (unlikely(kw_args > 0)) {
3351
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_node") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3353
__pyx_v_key = values[0];
3354
__pyx_v_parent_keys = values[1];
3355
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3356
goto __pyx_L5_argtuple_error;
3358
__pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
3359
__pyx_v_parent_keys = PyTuple_GET_ITEM(__pyx_args, 1);
3361
goto __pyx_L4_argument_unpacking_done;
3362
__pyx_L5_argtuple_error:;
3363
__Pyx_RaiseArgtupleInvalid("add_node", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3365
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.add_node");
3366
__Pyx_RefNannyFinishContext();
3368
__pyx_L4_argument_unpacking_done:;
3369
__Pyx_INCREF(__pyx_v_parent_keys);
3370
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
3371
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
3372
__pyx_v_child_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
3373
__pyx_v_existing_parent_keys = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
3374
__pyx_v_pending = Py_None; __Pyx_INCREF(Py_None);
3375
__pyx_v_pending_popleft = Py_None; __Pyx_INCREF(Py_None);
3376
__pyx_v_pending_append = Py_None; __Pyx_INCREF(Py_None);
3378
/* "bzrlib/_known_graph_pyx.pyx":359
3379
* cdef long parent_gdfo, next_gdfo
3381
* maybe_node = PyDict_GetItem(self._nodes, key) # <<<<<<<<<<<<<<
3382
* if maybe_node != NULL:
3383
* node = <_KnownGraphNode>maybe_node
3385
__pyx_t_1 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes;
3386
__Pyx_INCREF(__pyx_t_1);
3387
__pyx_v_maybe_node = PyDict_GetItem(__pyx_t_1, __pyx_v_key);
3388
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3390
/* "bzrlib/_known_graph_pyx.pyx":360
3392
* maybe_node = PyDict_GetItem(self._nodes, key)
3393
* if maybe_node != NULL: # <<<<<<<<<<<<<<
3394
* node = <_KnownGraphNode>maybe_node
3395
* if node.parents is None:
3397
__pyx_t_2 = (__pyx_v_maybe_node != NULL);
3400
/* "bzrlib/_known_graph_pyx.pyx":361
3401
* maybe_node = PyDict_GetItem(self._nodes, key)
3402
* if maybe_node != NULL:
3403
* node = <_KnownGraphNode>maybe_node # <<<<<<<<<<<<<<
3404
* if node.parents is None:
3405
* # We are filling in a ghost
3407
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_maybe_node)));
3408
__Pyx_DECREF(((PyObject *)__pyx_v_node));
3409
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_maybe_node);
3411
/* "bzrlib/_known_graph_pyx.pyx":362
3412
* if maybe_node != NULL:
3413
* node = <_KnownGraphNode>maybe_node
3414
* if node.parents is None: # <<<<<<<<<<<<<<
3415
* # We are filling in a ghost
3416
* self._populate_parents(node, parent_keys)
3418
__pyx_t_2 = (__pyx_v_node->parents == Py_None);
3421
/* "bzrlib/_known_graph_pyx.pyx":364
3422
* if node.parents is None:
3423
* # We are filling in a ghost
3424
* self._populate_parents(node, parent_keys) # <<<<<<<<<<<<<<
3425
* # We can't trust cached heads anymore
3426
* self._known_heads.clear()
3428
__pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx_KnownGraph *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->__pyx_vtab)->_populate_parents(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self), __pyx_v_node, __pyx_v_parent_keys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3429
__Pyx_GOTREF(__pyx_t_1);
3430
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3432
/* "bzrlib/_known_graph_pyx.pyx":366
3433
* self._populate_parents(node, parent_keys)
3434
* # We can't trust cached heads anymore
3435
* self._known_heads.clear() # <<<<<<<<<<<<<<
3436
* else: # Ensure that the parent_key list matches
3437
* existing_parent_keys = []
3439
__pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads, __pyx_n_s__clear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3440
__Pyx_GOTREF(__pyx_t_1);
3441
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3442
__Pyx_GOTREF(__pyx_t_3);
3443
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3444
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3449
/* "bzrlib/_known_graph_pyx.pyx":368
3450
* self._known_heads.clear()
3451
* else: # Ensure that the parent_key list matches
3452
* existing_parent_keys = [] # <<<<<<<<<<<<<<
3453
* for parent_node in node.parents:
3454
* existing_parent_keys.append(parent_node.key)
3456
__pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3457
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
3458
__Pyx_DECREF(((PyObject *)__pyx_v_existing_parent_keys));
3459
__pyx_v_existing_parent_keys = __pyx_t_3;
3462
/* "bzrlib/_known_graph_pyx.pyx":369
3463
* else: # Ensure that the parent_key list matches
3464
* existing_parent_keys = []
3465
* for parent_node in node.parents: # <<<<<<<<<<<<<<
3466
* existing_parent_keys.append(parent_node.key)
3467
* # Make sure we use a list for the comparison, in case it was a
3469
if (PyList_CheckExact(__pyx_v_node->parents) || PyTuple_CheckExact(__pyx_v_node->parents)) {
3470
__pyx_t_4 = 0; __pyx_t_3 = __pyx_v_node->parents; __Pyx_INCREF(__pyx_t_3);
3472
__pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_node->parents); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3473
__Pyx_GOTREF(__pyx_t_3);
3476
if (likely(PyList_CheckExact(__pyx_t_3))) {
3477
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
3478
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
3479
} else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
3480
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
3481
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
3483
__pyx_t_1 = PyIter_Next(__pyx_t_3);
3485
if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3488
__Pyx_GOTREF(__pyx_t_1);
3490
if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3491
__Pyx_DECREF(((PyObject *)__pyx_v_parent_node));
3492
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_1);
3495
/* "bzrlib/_known_graph_pyx.pyx":370
3496
* existing_parent_keys = []
3497
* for parent_node in node.parents:
3498
* existing_parent_keys.append(parent_node.key) # <<<<<<<<<<<<<<
3499
* # Make sure we use a list for the comparison, in case it was a
3502
if (unlikely(__pyx_v_existing_parent_keys == Py_None)) {
3503
PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3505
__pyx_t_1 = __pyx_v_parent_node->key;
3506
__Pyx_INCREF(__pyx_t_1);
3507
__pyx_t_5 = PyList_Append(__pyx_v_existing_parent_keys, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3508
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3510
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3512
/* "bzrlib/_known_graph_pyx.pyx":373
3513
* # Make sure we use a list for the comparison, in case it was a
3515
* parent_keys = list(parent_keys) # <<<<<<<<<<<<<<
3516
* if existing_parent_keys == parent_keys:
3517
* # Exact match, nothing more to do
3519
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3520
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
3521
__Pyx_INCREF(__pyx_v_parent_keys);
3522
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_parent_keys);
3523
__Pyx_GIVEREF(__pyx_v_parent_keys);
3524
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3525
__Pyx_GOTREF(__pyx_t_1);
3526
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
3527
__Pyx_DECREF(__pyx_v_parent_keys);
3528
__pyx_v_parent_keys = __pyx_t_1;
3531
/* "bzrlib/_known_graph_pyx.pyx":374
3533
* parent_keys = list(parent_keys)
3534
* if existing_parent_keys == parent_keys: # <<<<<<<<<<<<<<
3535
* # Exact match, nothing more to do
3538
__pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_existing_parent_keys), __pyx_v_parent_keys, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3539
__Pyx_GOTREF(__pyx_t_1);
3540
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3541
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3544
/* "bzrlib/_known_graph_pyx.pyx":376
3545
* if existing_parent_keys == parent_keys:
3546
* # Exact match, nothing more to do
3547
* return # <<<<<<<<<<<<<<
3549
* raise ValueError('Parent key mismatch, existing node %s'
3551
__Pyx_XDECREF(__pyx_r);
3552
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
3558
/* "bzrlib/_known_graph_pyx.pyx":380
3559
* raise ValueError('Parent key mismatch, existing node %s'
3560
* ' has parents of %s not %s'
3561
* % (key, existing_parent_keys, parent_keys)) # <<<<<<<<<<<<<<
3563
* node = _KnownGraphNode(key)
3565
__pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3566
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
3567
__Pyx_INCREF(__pyx_v_key);
3568
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_key);
3569
__Pyx_GIVEREF(__pyx_v_key);
3570
__Pyx_INCREF(((PyObject *)__pyx_v_existing_parent_keys));
3571
PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_existing_parent_keys));
3572
__Pyx_GIVEREF(((PyObject *)__pyx_v_existing_parent_keys));
3573
__Pyx_INCREF(__pyx_v_parent_keys);
3574
PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_parent_keys);
3575
__Pyx_GIVEREF(__pyx_v_parent_keys);
3576
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3577
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
3578
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
3579
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3580
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
3581
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
3582
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
3584
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3585
__Pyx_GOTREF(__pyx_t_3);
3586
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
3587
__Pyx_Raise(__pyx_t_3, 0, 0);
3588
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3589
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3598
/* "bzrlib/_known_graph_pyx.pyx":382
3599
* % (key, existing_parent_keys, parent_keys))
3601
* node = _KnownGraphNode(key) # <<<<<<<<<<<<<<
3602
* PyDict_SetItem(self._nodes, key, node)
3603
* self._populate_parents(node, parent_keys)
3605
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3606
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
3607
__Pyx_INCREF(__pyx_v_key);
3608
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key);
3609
__Pyx_GIVEREF(__pyx_v_key);
3610
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3611
__Pyx_GOTREF(__pyx_t_1);
3612
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
3613
__Pyx_DECREF(((PyObject *)__pyx_v_node));
3614
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_1);
3617
/* "bzrlib/_known_graph_pyx.pyx":383
3619
* node = _KnownGraphNode(key)
3620
* PyDict_SetItem(self._nodes, key, node) # <<<<<<<<<<<<<<
3621
* self._populate_parents(node, parent_keys)
3624
__pyx_t_1 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes;
3625
__Pyx_INCREF(__pyx_t_1);
3626
__pyx_t_5 = PyDict_SetItem(__pyx_t_1, __pyx_v_key, ((PyObject *)__pyx_v_node)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3627
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3629
/* "bzrlib/_known_graph_pyx.pyx":384
3630
* node = _KnownGraphNode(key)
3631
* PyDict_SetItem(self._nodes, key, node)
3632
* self._populate_parents(node, parent_keys) # <<<<<<<<<<<<<<
3634
* for parent_node in node.parents:
3636
__pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx_KnownGraph *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->__pyx_vtab)->_populate_parents(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self), __pyx_v_node, __pyx_v_parent_keys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3637
__Pyx_GOTREF(__pyx_t_1);
3638
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3642
/* "bzrlib/_known_graph_pyx.pyx":385
3643
* PyDict_SetItem(self._nodes, key, node)
3644
* self._populate_parents(node, parent_keys)
3645
* parent_gdfo = 0 # <<<<<<<<<<<<<<
3646
* for parent_node in node.parents:
3647
* if parent_node.gdfo == -1:
3649
__pyx_v_parent_gdfo = 0;
3651
/* "bzrlib/_known_graph_pyx.pyx":386
3652
* self._populate_parents(node, parent_keys)
3654
* for parent_node in node.parents: # <<<<<<<<<<<<<<
3655
* if parent_node.gdfo == -1:
3656
* # This is a newly introduced ghost, so it gets gdfo of 1
3658
if (PyList_CheckExact(__pyx_v_node->parents) || PyTuple_CheckExact(__pyx_v_node->parents)) {
3659
__pyx_t_4 = 0; __pyx_t_1 = __pyx_v_node->parents; __Pyx_INCREF(__pyx_t_1);
3661
__pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_node->parents); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3662
__Pyx_GOTREF(__pyx_t_1);
3665
if (likely(PyList_CheckExact(__pyx_t_1))) {
3666
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
3667
__pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
3668
} else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
3669
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
3670
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
3672
__pyx_t_3 = PyIter_Next(__pyx_t_1);
3674
if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3677
__Pyx_GOTREF(__pyx_t_3);
3679
if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3680
__Pyx_DECREF(((PyObject *)__pyx_v_parent_node));
3681
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_3);
3684
/* "bzrlib/_known_graph_pyx.pyx":387
3686
* for parent_node in node.parents:
3687
* if parent_node.gdfo == -1: # <<<<<<<<<<<<<<
3688
* # This is a newly introduced ghost, so it gets gdfo of 1
3689
* parent_node.gdfo = 1
3691
__pyx_t_2 = (__pyx_v_parent_node->gdfo == -1);
3694
/* "bzrlib/_known_graph_pyx.pyx":389
3695
* if parent_node.gdfo == -1:
3696
* # This is a newly introduced ghost, so it gets gdfo of 1
3697
* parent_node.gdfo = 1 # <<<<<<<<<<<<<<
3698
* if parent_gdfo < parent_node.gdfo:
3699
* parent_gdfo = parent_node.gdfo
3701
__pyx_v_parent_node->gdfo = 1;
3706
/* "bzrlib/_known_graph_pyx.pyx":390
3707
* # This is a newly introduced ghost, so it gets gdfo of 1
3708
* parent_node.gdfo = 1
3709
* if parent_gdfo < parent_node.gdfo: # <<<<<<<<<<<<<<
3710
* parent_gdfo = parent_node.gdfo
3711
* node.gdfo = parent_gdfo + 1
3713
__pyx_t_2 = (__pyx_v_parent_gdfo < __pyx_v_parent_node->gdfo);
3716
/* "bzrlib/_known_graph_pyx.pyx":391
3717
* parent_node.gdfo = 1
3718
* if parent_gdfo < parent_node.gdfo:
3719
* parent_gdfo = parent_node.gdfo # <<<<<<<<<<<<<<
3720
* node.gdfo = parent_gdfo + 1
3721
* # Now fill the gdfo to all children
3723
__pyx_v_parent_gdfo = __pyx_v_parent_node->gdfo;
3728
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3730
/* "bzrlib/_known_graph_pyx.pyx":392
3731
* if parent_gdfo < parent_node.gdfo:
3732
* parent_gdfo = parent_node.gdfo
3733
* node.gdfo = parent_gdfo + 1 # <<<<<<<<<<<<<<
3734
* # Now fill the gdfo to all children
3735
* # Note that this loop is slightly inefficient, in that we may visit the
3737
__pyx_v_node->gdfo = (__pyx_v_parent_gdfo + 1);
3739
/* "bzrlib/_known_graph_pyx.pyx":401
3740
* # than DFD. So that if a longer path is possible, we walk it before we
3741
* # get to the final child
3742
* pending = deque([node]) # <<<<<<<<<<<<<<
3743
* pending_popleft = pending.popleft
3744
* pending_append = pending.append
3746
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__deque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3747
__Pyx_GOTREF(__pyx_t_1);
3748
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3749
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
3750
__Pyx_INCREF(((PyObject *)__pyx_v_node));
3751
PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_node));
3752
__Pyx_GIVEREF(((PyObject *)__pyx_v_node));
3753
__pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3754
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
3755
PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_3));
3756
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
3758
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3759
__Pyx_GOTREF(__pyx_t_3);
3760
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3761
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
3762
__Pyx_DECREF(__pyx_v_pending);
3763
__pyx_v_pending = __pyx_t_3;
3766
/* "bzrlib/_known_graph_pyx.pyx":402
3767
* # get to the final child
3768
* pending = deque([node])
3769
* pending_popleft = pending.popleft # <<<<<<<<<<<<<<
3770
* pending_append = pending.append
3773
__pyx_t_3 = PyObject_GetAttr(__pyx_v_pending, __pyx_n_s__popleft); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3774
__Pyx_GOTREF(__pyx_t_3);
3775
__Pyx_DECREF(__pyx_v_pending_popleft);
3776
__pyx_v_pending_popleft = __pyx_t_3;
3779
/* "bzrlib/_known_graph_pyx.pyx":403
3780
* pending = deque([node])
3781
* pending_popleft = pending.popleft
3782
* pending_append = pending.append # <<<<<<<<<<<<<<
3784
* node = pending_popleft()
3786
__pyx_t_3 = PyObject_GetAttr(__pyx_v_pending, __pyx_n_s__append); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3787
__Pyx_GOTREF(__pyx_t_3);
3788
__Pyx_DECREF(__pyx_v_pending_append);
3789
__pyx_v_pending_append = __pyx_t_3;
3792
/* "bzrlib/_known_graph_pyx.pyx":404
3793
* pending_popleft = pending.popleft
3794
* pending_append = pending.append
3795
* while pending: # <<<<<<<<<<<<<<
3796
* node = pending_popleft()
3797
* next_gdfo = node.gdfo + 1
3800
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pending); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3801
if (!__pyx_t_2) break;
3803
/* "bzrlib/_known_graph_pyx.pyx":405
3804
* pending_append = pending.append
3806
* node = pending_popleft() # <<<<<<<<<<<<<<
3807
* next_gdfo = node.gdfo + 1
3808
* for child_node in node.children:
3810
__pyx_t_3 = PyObject_Call(__pyx_v_pending_popleft, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3811
__Pyx_GOTREF(__pyx_t_3);
3812
if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3813
__Pyx_DECREF(((PyObject *)__pyx_v_node));
3814
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_3);
3817
/* "bzrlib/_known_graph_pyx.pyx":406
3819
* node = pending_popleft()
3820
* next_gdfo = node.gdfo + 1 # <<<<<<<<<<<<<<
3821
* for child_node in node.children:
3822
* if child_node.gdfo < next_gdfo:
3824
__pyx_v_next_gdfo = (__pyx_v_node->gdfo + 1);
3826
/* "bzrlib/_known_graph_pyx.pyx":407
3827
* node = pending_popleft()
3828
* next_gdfo = node.gdfo + 1
3829
* for child_node in node.children: # <<<<<<<<<<<<<<
3830
* if child_node.gdfo < next_gdfo:
3831
* # This child is being updated, we need to check its
3833
if (PyList_CheckExact(__pyx_v_node->children) || PyTuple_CheckExact(__pyx_v_node->children)) {
3834
__pyx_t_4 = 0; __pyx_t_3 = __pyx_v_node->children; __Pyx_INCREF(__pyx_t_3);
3836
__pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_node->children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3837
__Pyx_GOTREF(__pyx_t_3);
3840
if (likely(PyList_CheckExact(__pyx_t_3))) {
3841
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
3842
__pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
3843
} else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
3844
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
3845
__pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
3847
__pyx_t_6 = PyIter_Next(__pyx_t_3);
3849
if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3852
__Pyx_GOTREF(__pyx_t_6);
3854
if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3855
__Pyx_DECREF(((PyObject *)__pyx_v_child_node));
3856
__pyx_v_child_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_6);
3859
/* "bzrlib/_known_graph_pyx.pyx":408
3860
* next_gdfo = node.gdfo + 1
3861
* for child_node in node.children:
3862
* if child_node.gdfo < next_gdfo: # <<<<<<<<<<<<<<
3863
* # This child is being updated, we need to check its
3866
__pyx_t_2 = (__pyx_v_child_node->gdfo < __pyx_v_next_gdfo);
3869
/* "bzrlib/_known_graph_pyx.pyx":411
3870
* # This child is being updated, we need to check its
3872
* child_node.gdfo = next_gdfo # <<<<<<<<<<<<<<
3873
* pending_append(child_node)
3876
__pyx_v_child_node->gdfo = __pyx_v_next_gdfo;
3878
/* "bzrlib/_known_graph_pyx.pyx":412
3880
* child_node.gdfo = next_gdfo
3881
* pending_append(child_node) # <<<<<<<<<<<<<<
3883
* def heads(self, keys):
3885
__pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3886
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
3887
__Pyx_INCREF(((PyObject *)__pyx_v_child_node));
3888
PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_child_node));
3889
__Pyx_GIVEREF(((PyObject *)__pyx_v_child_node));
3890
__pyx_t_1 = PyObject_Call(__pyx_v_pending_append, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3891
__Pyx_GOTREF(__pyx_t_1);
3892
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
3893
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3898
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3901
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
3904
__Pyx_XDECREF(__pyx_t_1);
3905
__Pyx_XDECREF(__pyx_t_3);
3906
__Pyx_XDECREF(__pyx_t_6);
3907
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.add_node");
3910
__Pyx_DECREF((PyObject *)__pyx_v_node);
3911
__Pyx_DECREF((PyObject *)__pyx_v_parent_node);
3912
__Pyx_DECREF((PyObject *)__pyx_v_child_node);
3913
__Pyx_DECREF(__pyx_v_existing_parent_keys);
3914
__Pyx_DECREF(__pyx_v_pending);
3915
__Pyx_DECREF(__pyx_v_pending_popleft);
3916
__Pyx_DECREF(__pyx_v_pending_append);
3917
__Pyx_DECREF(__pyx_v_parent_keys);
3918
__Pyx_XGIVEREF(__pyx_r);
3919
__Pyx_RefNannyFinishContext();
3923
/* "bzrlib/_known_graph_pyx.pyx":414
3924
* pending_append(child_node)
3926
* def heads(self, keys): # <<<<<<<<<<<<<<
3927
* """Return the heads from amongst keys.
3931
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_7heads(PyObject *__pyx_v_self, PyObject *__pyx_v_keys); /*proto*/
3932
static char __pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_7heads[] = "Return the heads from amongst keys.\n\n This is done by searching the ancestries of each key. Any key that is\n reachable from another key is not returned; all the others are.\n\n This operation scales with the relative depth between any two keys. It\n uses gdfo to avoid walking all ancestry.\n\n :param keys: An iterable of keys.\n :return: A set of the heads. Note that as a set there is no ordering\n information. Callers will need to filter their input to create\n order if they need it.\n ";
3933
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_7heads(PyObject *__pyx_v_self, PyObject *__pyx_v_keys) {
3934
PyObject *__pyx_v_maybe_node;
3935
PyObject *__pyx_v_maybe_heads;
3936
PyObject *__pyx_v_temp_node;
3937
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
3938
Py_ssize_t __pyx_v_pos;
3939
Py_ssize_t __pyx_v_last_item;
3940
long __pyx_v_min_gdfo;
3941
PyObject *__pyx_v_heads_key;
3942
PyObject *__pyx_v_candidate_nodes;
3943
PyObject *__pyx_v_key;
3944
PyObject *__pyx_v_cleanup;
3945
PyObject *__pyx_v_pending;
3946
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_parent_node;
3947
PyObject *__pyx_v_heads;
3948
PyObject *__pyx_r = NULL;
3949
PyObject *__pyx_t_1 = NULL;
3950
PyObject *__pyx_t_2 = NULL;
3952
Py_ssize_t __pyx_t_4;
3953
PyObject *__pyx_t_5 = NULL;
3957
__Pyx_RefNannySetupContext("heads");
3958
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
3959
__pyx_v_heads_key = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
3960
__pyx_v_candidate_nodes = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
3961
__pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
3962
__pyx_v_cleanup = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
3963
__pyx_v_pending = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
3964
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
3965
__pyx_v_heads = Py_None; __Pyx_INCREF(Py_None);
3967
/* "bzrlib/_known_graph_pyx.pyx":435
3968
* cdef long min_gdfo
3970
* heads_key = frozenset(keys) # <<<<<<<<<<<<<<
3971
* maybe_heads = PyDict_GetItem(self._known_heads, heads_key)
3972
* if maybe_heads != NULL:
3974
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3975
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
3976
__Pyx_INCREF(__pyx_v_keys);
3977
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_keys);
3978
__Pyx_GIVEREF(__pyx_v_keys);
3979
__pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyFrozenSet_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3980
__Pyx_GOTREF(__pyx_t_2);
3981
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
3982
__Pyx_DECREF(((PyObject *)__pyx_v_heads_key));
3983
__pyx_v_heads_key = ((PyObject*)__pyx_t_2);
3986
/* "bzrlib/_known_graph_pyx.pyx":436
3988
* heads_key = frozenset(keys)
3989
* maybe_heads = PyDict_GetItem(self._known_heads, heads_key) # <<<<<<<<<<<<<<
3990
* if maybe_heads != NULL:
3991
* return <object>maybe_heads
3993
__pyx_t_2 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads;
3994
__Pyx_INCREF(__pyx_t_2);
3995
__pyx_v_maybe_heads = PyDict_GetItem(__pyx_t_2, ((PyObject *)__pyx_v_heads_key));
3996
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3998
/* "bzrlib/_known_graph_pyx.pyx":437
3999
* heads_key = frozenset(keys)
4000
* maybe_heads = PyDict_GetItem(self._known_heads, heads_key)
4001
* if maybe_heads != NULL: # <<<<<<<<<<<<<<
4002
* return <object>maybe_heads
4003
* # Not cached, compute it ourselves
4005
__pyx_t_3 = (__pyx_v_maybe_heads != NULL);
4008
/* "bzrlib/_known_graph_pyx.pyx":438
4009
* maybe_heads = PyDict_GetItem(self._known_heads, heads_key)
4010
* if maybe_heads != NULL:
4011
* return <object>maybe_heads # <<<<<<<<<<<<<<
4012
* # Not cached, compute it ourselves
4013
* candidate_nodes = {}
4015
__Pyx_XDECREF(__pyx_r);
4016
__Pyx_INCREF(((PyObject *)__pyx_v_maybe_heads));
4017
__pyx_r = ((PyObject *)__pyx_v_maybe_heads);
4023
/* "bzrlib/_known_graph_pyx.pyx":440
4024
* return <object>maybe_heads
4025
* # Not cached, compute it ourselves
4026
* candidate_nodes = {} # <<<<<<<<<<<<<<
4028
* maybe_node = PyDict_GetItem(self._nodes, key)
4030
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4031
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
4032
__Pyx_DECREF(((PyObject *)__pyx_v_candidate_nodes));
4033
__pyx_v_candidate_nodes = __pyx_t_2;
4036
/* "bzrlib/_known_graph_pyx.pyx":441
4037
* # Not cached, compute it ourselves
4038
* candidate_nodes = {}
4039
* for key in keys: # <<<<<<<<<<<<<<
4040
* maybe_node = PyDict_GetItem(self._nodes, key)
4041
* if maybe_node == NULL:
4043
if (PyList_CheckExact(__pyx_v_keys) || PyTuple_CheckExact(__pyx_v_keys)) {
4044
__pyx_t_4 = 0; __pyx_t_2 = __pyx_v_keys; __Pyx_INCREF(__pyx_t_2);
4046
__pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4047
__Pyx_GOTREF(__pyx_t_2);
4050
if (likely(PyList_CheckExact(__pyx_t_2))) {
4051
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
4052
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
4053
} else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
4054
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
4055
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
4057
__pyx_t_1 = PyIter_Next(__pyx_t_2);
4059
if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4062
__Pyx_GOTREF(__pyx_t_1);
4064
__Pyx_DECREF(__pyx_v_key);
4065
__pyx_v_key = __pyx_t_1;
4068
/* "bzrlib/_known_graph_pyx.pyx":442
4069
* candidate_nodes = {}
4071
* maybe_node = PyDict_GetItem(self._nodes, key) # <<<<<<<<<<<<<<
4072
* if maybe_node == NULL:
4073
* raise KeyError('key %s not in nodes' % (key,))
4075
__pyx_t_1 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes;
4076
__Pyx_INCREF(__pyx_t_1);
4077
__pyx_v_maybe_node = PyDict_GetItem(__pyx_t_1, __pyx_v_key);
4078
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4080
/* "bzrlib/_known_graph_pyx.pyx":443
4082
* maybe_node = PyDict_GetItem(self._nodes, key)
4083
* if maybe_node == NULL: # <<<<<<<<<<<<<<
4084
* raise KeyError('key %s not in nodes' % (key,))
4085
* PyDict_SetItem(candidate_nodes, key, <object>maybe_node)
4087
__pyx_t_3 = (__pyx_v_maybe_node == NULL);
4090
/* "bzrlib/_known_graph_pyx.pyx":444
4091
* maybe_node = PyDict_GetItem(self._nodes, key)
4092
* if maybe_node == NULL:
4093
* raise KeyError('key %s not in nodes' % (key,)) # <<<<<<<<<<<<<<
4094
* PyDict_SetItem(candidate_nodes, key, <object>maybe_node)
4095
* maybe_node = PyDict_GetItem(candidate_nodes, NULL_REVISION)
4097
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4098
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
4099
__Pyx_INCREF(__pyx_v_key);
4100
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_key);
4101
__Pyx_GIVEREF(__pyx_v_key);
4102
__pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4103
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
4104
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
4105
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4106
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
4107
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
4108
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
4110
__pyx_t_5 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4111
__Pyx_GOTREF(__pyx_t_5);
4112
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
4113
__Pyx_Raise(__pyx_t_5, 0, 0);
4114
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4115
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4120
/* "bzrlib/_known_graph_pyx.pyx":445
4121
* if maybe_node == NULL:
4122
* raise KeyError('key %s not in nodes' % (key,))
4123
* PyDict_SetItem(candidate_nodes, key, <object>maybe_node) # <<<<<<<<<<<<<<
4124
* maybe_node = PyDict_GetItem(candidate_nodes, NULL_REVISION)
4125
* if maybe_node != NULL:
4127
__pyx_t_6 = PyDict_SetItem(((PyObject *)__pyx_v_candidate_nodes), __pyx_v_key, ((PyObject *)__pyx_v_maybe_node)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4129
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4131
/* "bzrlib/_known_graph_pyx.pyx":446
4132
* raise KeyError('key %s not in nodes' % (key,))
4133
* PyDict_SetItem(candidate_nodes, key, <object>maybe_node)
4134
* maybe_node = PyDict_GetItem(candidate_nodes, NULL_REVISION) # <<<<<<<<<<<<<<
4135
* if maybe_node != NULL:
4136
* # NULL_REVISION is only a head if it is the only entry
4138
__pyx_v_maybe_node = PyDict_GetItem(((PyObject *)__pyx_v_candidate_nodes), __pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION);
4140
/* "bzrlib/_known_graph_pyx.pyx":447
4141
* PyDict_SetItem(candidate_nodes, key, <object>maybe_node)
4142
* maybe_node = PyDict_GetItem(candidate_nodes, NULL_REVISION)
4143
* if maybe_node != NULL: # <<<<<<<<<<<<<<
4144
* # NULL_REVISION is only a head if it is the only entry
4145
* candidate_nodes.pop(NULL_REVISION)
4147
__pyx_t_3 = (__pyx_v_maybe_node != NULL);
4150
/* "bzrlib/_known_graph_pyx.pyx":449
4151
* if maybe_node != NULL:
4152
* # NULL_REVISION is only a head if it is the only entry
4153
* candidate_nodes.pop(NULL_REVISION) # <<<<<<<<<<<<<<
4154
* if not candidate_nodes:
4155
* return frozenset([NULL_REVISION])
4157
__pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_candidate_nodes), __pyx_n_s__pop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4158
__Pyx_GOTREF(__pyx_t_2);
4159
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4160
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
4161
__Pyx_INCREF(__pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION);
4162
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION);
4163
__Pyx_GIVEREF(__pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION);
4164
__pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4165
__Pyx_GOTREF(__pyx_t_1);
4166
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4167
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
4168
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4170
/* "bzrlib/_known_graph_pyx.pyx":450
4171
* # NULL_REVISION is only a head if it is the only entry
4172
* candidate_nodes.pop(NULL_REVISION)
4173
* if not candidate_nodes: # <<<<<<<<<<<<<<
4174
* return frozenset([NULL_REVISION])
4175
* # The keys changed, so recalculate heads_key
4177
__pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_candidate_nodes)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4178
__pyx_t_7 = (!__pyx_t_3);
4181
/* "bzrlib/_known_graph_pyx.pyx":451
4182
* candidate_nodes.pop(NULL_REVISION)
4183
* if not candidate_nodes:
4184
* return frozenset([NULL_REVISION]) # <<<<<<<<<<<<<<
4185
* # The keys changed, so recalculate heads_key
4186
* heads_key = frozenset(candidate_nodes)
4188
__Pyx_XDECREF(__pyx_r);
4189
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4190
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
4191
__Pyx_INCREF(__pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION);
4192
PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION);
4193
__Pyx_GIVEREF(__pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION);
4194
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4195
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
4196
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
4197
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
4199
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyFrozenSet_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4200
__Pyx_GOTREF(__pyx_t_1);
4201
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
4202
__pyx_r = __pyx_t_1;
4209
/* "bzrlib/_known_graph_pyx.pyx":453
4210
* return frozenset([NULL_REVISION])
4211
* # The keys changed, so recalculate heads_key
4212
* heads_key = frozenset(candidate_nodes) # <<<<<<<<<<<<<<
4213
* if PyDict_Size(candidate_nodes) < 2:
4216
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4217
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
4218
__Pyx_INCREF(((PyObject *)__pyx_v_candidate_nodes));
4219
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_candidate_nodes));
4220
__Pyx_GIVEREF(((PyObject *)__pyx_v_candidate_nodes));
4221
__pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyFrozenSet_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4222
__Pyx_GOTREF(__pyx_t_5);
4223
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
4224
__Pyx_DECREF(((PyObject *)__pyx_v_heads_key));
4225
__pyx_v_heads_key = ((PyObject*)__pyx_t_5);
4231
/* "bzrlib/_known_graph_pyx.pyx":454
4232
* # The keys changed, so recalculate heads_key
4233
* heads_key = frozenset(candidate_nodes)
4234
* if PyDict_Size(candidate_nodes) < 2: # <<<<<<<<<<<<<<
4238
__pyx_t_4 = PyDict_Size(((PyObject *)__pyx_v_candidate_nodes)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4239
__pyx_t_7 = (__pyx_t_4 < 2);
4242
/* "bzrlib/_known_graph_pyx.pyx":455
4243
* heads_key = frozenset(candidate_nodes)
4244
* if PyDict_Size(candidate_nodes) < 2:
4245
* return heads_key # <<<<<<<<<<<<<<
4249
__Pyx_XDECREF(__pyx_r);
4250
__Pyx_INCREF(((PyObject *)__pyx_v_heads_key));
4251
__pyx_r = ((PyObject *)__pyx_v_heads_key);
4257
/* "bzrlib/_known_graph_pyx.pyx":457
4260
* cleanup = [] # <<<<<<<<<<<<<<
4262
* # we know a gdfo cannot be longer than a linear chain of all nodes
4264
__pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4265
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
4266
__Pyx_DECREF(((PyObject *)__pyx_v_cleanup));
4267
__pyx_v_cleanup = __pyx_t_5;
4270
/* "bzrlib/_known_graph_pyx.pyx":458
4273
* pending = [] # <<<<<<<<<<<<<<
4274
* # we know a gdfo cannot be longer than a linear chain of all nodes
4275
* min_gdfo = PyDict_Size(self._nodes) + 1
4277
__pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4278
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
4279
__Pyx_DECREF(((PyObject *)__pyx_v_pending));
4280
__pyx_v_pending = __pyx_t_5;
4283
/* "bzrlib/_known_graph_pyx.pyx":460
4285
* # we know a gdfo cannot be longer than a linear chain of all nodes
4286
* min_gdfo = PyDict_Size(self._nodes) + 1 # <<<<<<<<<<<<<<
4287
* # Build up nodes that need to be walked, note that starting nodes are
4288
* # not added to seen()
4290
__pyx_t_5 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes;
4291
__Pyx_INCREF(__pyx_t_5);
4292
__pyx_t_4 = PyDict_Size(__pyx_t_5); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4293
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4294
__pyx_v_min_gdfo = (__pyx_t_4 + 1);
4296
/* "bzrlib/_known_graph_pyx.pyx":463
4297
* # Build up nodes that need to be walked, note that starting nodes are
4298
* # not added to seen()
4299
* pos = 0 # <<<<<<<<<<<<<<
4300
* while PyDict_Next(candidate_nodes, &pos, NULL, &temp_node):
4301
* node = <_KnownGraphNode>temp_node
4305
/* "bzrlib/_known_graph_pyx.pyx":464
4306
* # not added to seen()
4308
* while PyDict_Next(candidate_nodes, &pos, NULL, &temp_node): # <<<<<<<<<<<<<<
4309
* node = <_KnownGraphNode>temp_node
4310
* if node.parents is not None:
4313
__pyx_t_6 = PyDict_Next(((PyObject *)__pyx_v_candidate_nodes), (&__pyx_v_pos), NULL, (&__pyx_v_temp_node));
4314
if (!__pyx_t_6) break;
4316
/* "bzrlib/_known_graph_pyx.pyx":465
4318
* while PyDict_Next(candidate_nodes, &pos, NULL, &temp_node):
4319
* node = <_KnownGraphNode>temp_node # <<<<<<<<<<<<<<
4320
* if node.parents is not None:
4321
* pending.extend(node.parents)
4323
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node)));
4324
__Pyx_DECREF(((PyObject *)__pyx_v_node));
4325
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node);
4327
/* "bzrlib/_known_graph_pyx.pyx":466
4328
* while PyDict_Next(candidate_nodes, &pos, NULL, &temp_node):
4329
* node = <_KnownGraphNode>temp_node
4330
* if node.parents is not None: # <<<<<<<<<<<<<<
4331
* pending.extend(node.parents)
4332
* if node.gdfo < min_gdfo:
4334
__pyx_t_7 = (__pyx_v_node->parents != Py_None);
4337
/* "bzrlib/_known_graph_pyx.pyx":467
4338
* node = <_KnownGraphNode>temp_node
4339
* if node.parents is not None:
4340
* pending.extend(node.parents) # <<<<<<<<<<<<<<
4341
* if node.gdfo < min_gdfo:
4342
* min_gdfo = node.gdfo
4344
__pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_pending), __pyx_n_s__extend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4345
__Pyx_GOTREF(__pyx_t_5);
4346
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4347
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
4348
__Pyx_INCREF(__pyx_v_node->parents);
4349
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_node->parents);
4350
__Pyx_GIVEREF(__pyx_v_node->parents);
4351
__pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4352
__Pyx_GOTREF(__pyx_t_2);
4353
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4354
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
4355
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4360
/* "bzrlib/_known_graph_pyx.pyx":468
4361
* if node.parents is not None:
4362
* pending.extend(node.parents)
4363
* if node.gdfo < min_gdfo: # <<<<<<<<<<<<<<
4364
* min_gdfo = node.gdfo
4367
__pyx_t_7 = (__pyx_v_node->gdfo < __pyx_v_min_gdfo);
4370
/* "bzrlib/_known_graph_pyx.pyx":469
4371
* pending.extend(node.parents)
4372
* if node.gdfo < min_gdfo:
4373
* min_gdfo = node.gdfo # <<<<<<<<<<<<<<
4375
* # Now do all the real work
4377
__pyx_v_min_gdfo = __pyx_v_node->gdfo;
4383
/* "bzrlib/_known_graph_pyx.pyx":472
4385
* # Now do all the real work
4386
* last_item = PyList_GET_SIZE(pending) - 1 # <<<<<<<<<<<<<<
4387
* while last_item >= 0:
4388
* node = _get_list_node(pending, last_item)
4390
__pyx_v_last_item = (PyList_GET_SIZE(((PyObject *)__pyx_v_pending)) - 1);
4392
/* "bzrlib/_known_graph_pyx.pyx":473
4393
* # Now do all the real work
4394
* last_item = PyList_GET_SIZE(pending) - 1
4395
* while last_item >= 0: # <<<<<<<<<<<<<<
4396
* node = _get_list_node(pending, last_item)
4397
* last_item = last_item - 1
4400
__pyx_t_7 = (__pyx_v_last_item >= 0);
4401
if (!__pyx_t_7) break;
4403
/* "bzrlib/_known_graph_pyx.pyx":474
4404
* last_item = PyList_GET_SIZE(pending) - 1
4405
* while last_item >= 0:
4406
* node = _get_list_node(pending, last_item) # <<<<<<<<<<<<<<
4407
* last_item = last_item - 1
4410
__pyx_t_2 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(((PyObject *)__pyx_v_pending), __pyx_v_last_item)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4411
__Pyx_GOTREF(__pyx_t_2);
4412
__Pyx_DECREF(((PyObject *)__pyx_v_node));
4413
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_2);
4416
/* "bzrlib/_known_graph_pyx.pyx":475
4417
* while last_item >= 0:
4418
* node = _get_list_node(pending, last_item)
4419
* last_item = last_item - 1 # <<<<<<<<<<<<<<
4421
* # node already appears in some ancestry
4423
__pyx_v_last_item = (__pyx_v_last_item - 1);
4425
/* "bzrlib/_known_graph_pyx.pyx":476
4426
* node = _get_list_node(pending, last_item)
4427
* last_item = last_item - 1
4428
* if node.seen: # <<<<<<<<<<<<<<
4429
* # node already appears in some ancestry
4432
if (__pyx_v_node->seen) {
4434
/* "bzrlib/_known_graph_pyx.pyx":478
4436
* # node already appears in some ancestry
4437
* continue # <<<<<<<<<<<<<<
4438
* PyList_Append(cleanup, node)
4441
goto __pyx_L16_continue;
4446
/* "bzrlib/_known_graph_pyx.pyx":479
4447
* # node already appears in some ancestry
4449
* PyList_Append(cleanup, node) # <<<<<<<<<<<<<<
4451
* if node.gdfo <= min_gdfo:
4453
__pyx_t_6 = PyList_Append(((PyObject *)__pyx_v_cleanup), ((PyObject *)__pyx_v_node)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4455
/* "bzrlib/_known_graph_pyx.pyx":480
4457
* PyList_Append(cleanup, node)
4458
* node.seen = 1 # <<<<<<<<<<<<<<
4459
* if node.gdfo <= min_gdfo:
4462
__pyx_v_node->seen = 1;
4464
/* "bzrlib/_known_graph_pyx.pyx":481
4465
* PyList_Append(cleanup, node)
4467
* if node.gdfo <= min_gdfo: # <<<<<<<<<<<<<<
4469
* if node.parents is not None and PyTuple_GET_SIZE(node.parents) > 0:
4471
__pyx_t_7 = (__pyx_v_node->gdfo <= __pyx_v_min_gdfo);
4474
/* "bzrlib/_known_graph_pyx.pyx":482
4476
* if node.gdfo <= min_gdfo:
4477
* continue # <<<<<<<<<<<<<<
4478
* if node.parents is not None and PyTuple_GET_SIZE(node.parents) > 0:
4479
* for pos from 0 <= pos < PyTuple_GET_SIZE(node.parents):
4481
goto __pyx_L16_continue;
4486
/* "bzrlib/_known_graph_pyx.pyx":483
4487
* if node.gdfo <= min_gdfo:
4489
* if node.parents is not None and PyTuple_GET_SIZE(node.parents) > 0: # <<<<<<<<<<<<<<
4490
* for pos from 0 <= pos < PyTuple_GET_SIZE(node.parents):
4491
* parent_node = _get_tuple_node(node.parents, pos)
4493
__pyx_t_7 = (__pyx_v_node->parents != Py_None);
4495
__pyx_t_2 = __pyx_v_node->parents;
4496
__Pyx_INCREF(__pyx_t_2);
4497
__pyx_t_3 = (PyTuple_GET_SIZE(__pyx_t_2) > 0);
4498
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4499
__pyx_t_8 = __pyx_t_3;
4501
__pyx_t_8 = __pyx_t_7;
4505
/* "bzrlib/_known_graph_pyx.pyx":484
4507
* if node.parents is not None and PyTuple_GET_SIZE(node.parents) > 0:
4508
* for pos from 0 <= pos < PyTuple_GET_SIZE(node.parents): # <<<<<<<<<<<<<<
4509
* parent_node = _get_tuple_node(node.parents, pos)
4510
* last_item = last_item + 1
4512
__pyx_t_2 = __pyx_v_node->parents;
4513
__Pyx_INCREF(__pyx_t_2);
4514
__pyx_t_4 = PyTuple_GET_SIZE(__pyx_t_2);
4515
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4516
for (__pyx_v_pos = 0; __pyx_v_pos < __pyx_t_4; __pyx_v_pos++) {
4518
/* "bzrlib/_known_graph_pyx.pyx":485
4519
* if node.parents is not None and PyTuple_GET_SIZE(node.parents) > 0:
4520
* for pos from 0 <= pos < PyTuple_GET_SIZE(node.parents):
4521
* parent_node = _get_tuple_node(node.parents, pos) # <<<<<<<<<<<<<<
4522
* last_item = last_item + 1
4523
* if last_item < PyList_GET_SIZE(pending):
4525
__pyx_t_2 = __pyx_v_node->parents;
4526
__Pyx_INCREF(__pyx_t_2);
4527
__pyx_t_1 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_tuple_node(__pyx_t_2, __pyx_v_pos)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4528
__Pyx_GOTREF(__pyx_t_1);
4529
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4530
__Pyx_DECREF(((PyObject *)__pyx_v_parent_node));
4531
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_1);
4534
/* "bzrlib/_known_graph_pyx.pyx":486
4535
* for pos from 0 <= pos < PyTuple_GET_SIZE(node.parents):
4536
* parent_node = _get_tuple_node(node.parents, pos)
4537
* last_item = last_item + 1 # <<<<<<<<<<<<<<
4538
* if last_item < PyList_GET_SIZE(pending):
4539
* Py_INCREF(parent_node) # SetItem steals a ref
4541
__pyx_v_last_item = (__pyx_v_last_item + 1);
4543
/* "bzrlib/_known_graph_pyx.pyx":487
4544
* parent_node = _get_tuple_node(node.parents, pos)
4545
* last_item = last_item + 1
4546
* if last_item < PyList_GET_SIZE(pending): # <<<<<<<<<<<<<<
4547
* Py_INCREF(parent_node) # SetItem steals a ref
4548
* PyList_SetItem(pending, last_item, parent_node)
4550
__pyx_t_8 = (__pyx_v_last_item < PyList_GET_SIZE(((PyObject *)__pyx_v_pending)));
4553
/* "bzrlib/_known_graph_pyx.pyx":488
4554
* last_item = last_item + 1
4555
* if last_item < PyList_GET_SIZE(pending):
4556
* Py_INCREF(parent_node) # SetItem steals a ref # <<<<<<<<<<<<<<
4557
* PyList_SetItem(pending, last_item, parent_node)
4560
Py_INCREF(((PyObject *)__pyx_v_parent_node));
4562
/* "bzrlib/_known_graph_pyx.pyx":489
4563
* if last_item < PyList_GET_SIZE(pending):
4564
* Py_INCREF(parent_node) # SetItem steals a ref
4565
* PyList_SetItem(pending, last_item, parent_node) # <<<<<<<<<<<<<<
4567
* PyList_Append(pending, parent_node)
4569
__pyx_t_6 = PyList_SetItem(((PyObject *)__pyx_v_pending), __pyx_v_last_item, ((PyObject *)__pyx_v_parent_node)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4574
/* "bzrlib/_known_graph_pyx.pyx":491
4575
* PyList_SetItem(pending, last_item, parent_node)
4577
* PyList_Append(pending, parent_node) # <<<<<<<<<<<<<<
4581
__pyx_t_6 = PyList_Append(((PyObject *)__pyx_v_pending), ((PyObject *)__pyx_v_parent_node)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4588
__pyx_L16_continue:;
4591
/* "bzrlib/_known_graph_pyx.pyx":492
4593
* PyList_Append(pending, parent_node)
4594
* heads = [] # <<<<<<<<<<<<<<
4596
* while PyDict_Next(candidate_nodes, &pos, NULL, &temp_node):
4598
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4599
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
4600
__Pyx_DECREF(__pyx_v_heads);
4601
__pyx_v_heads = ((PyObject *)__pyx_t_1);
4604
/* "bzrlib/_known_graph_pyx.pyx":493
4605
* PyList_Append(pending, parent_node)
4607
* pos = 0 # <<<<<<<<<<<<<<
4608
* while PyDict_Next(candidate_nodes, &pos, NULL, &temp_node):
4609
* node = <_KnownGraphNode>temp_node
4613
/* "bzrlib/_known_graph_pyx.pyx":494
4616
* while PyDict_Next(candidate_nodes, &pos, NULL, &temp_node): # <<<<<<<<<<<<<<
4617
* node = <_KnownGraphNode>temp_node
4621
__pyx_t_6 = PyDict_Next(((PyObject *)__pyx_v_candidate_nodes), (&__pyx_v_pos), NULL, (&__pyx_v_temp_node));
4622
if (!__pyx_t_6) break;
4624
/* "bzrlib/_known_graph_pyx.pyx":495
4626
* while PyDict_Next(candidate_nodes, &pos, NULL, &temp_node):
4627
* node = <_KnownGraphNode>temp_node # <<<<<<<<<<<<<<
4629
* PyList_Append(heads, node.key)
4631
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node)));
4632
__Pyx_DECREF(((PyObject *)__pyx_v_node));
4633
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_v_temp_node);
4635
/* "bzrlib/_known_graph_pyx.pyx":496
4636
* while PyDict_Next(candidate_nodes, &pos, NULL, &temp_node):
4637
* node = <_KnownGraphNode>temp_node
4638
* if not node.seen: # <<<<<<<<<<<<<<
4639
* PyList_Append(heads, node.key)
4640
* heads = frozenset(heads)
4642
__pyx_t_8 = (!__pyx_v_node->seen);
4645
/* "bzrlib/_known_graph_pyx.pyx":497
4646
* node = <_KnownGraphNode>temp_node
4648
* PyList_Append(heads, node.key) # <<<<<<<<<<<<<<
4649
* heads = frozenset(heads)
4650
* for pos from 0 <= pos < PyList_GET_SIZE(cleanup):
4652
__pyx_t_1 = __pyx_v_node->key;
4653
__Pyx_INCREF(__pyx_t_1);
4654
__pyx_t_6 = PyList_Append(__pyx_v_heads, __pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4655
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4661
/* "bzrlib/_known_graph_pyx.pyx":498
4663
* PyList_Append(heads, node.key)
4664
* heads = frozenset(heads) # <<<<<<<<<<<<<<
4665
* for pos from 0 <= pos < PyList_GET_SIZE(cleanup):
4666
* node = _get_list_node(cleanup, pos)
4668
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4669
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
4670
__Pyx_INCREF(__pyx_v_heads);
4671
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_heads);
4672
__Pyx_GIVEREF(__pyx_v_heads);
4673
__pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyFrozenSet_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4674
__Pyx_GOTREF(__pyx_t_2);
4675
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
4676
__Pyx_DECREF(__pyx_v_heads);
4677
__pyx_v_heads = __pyx_t_2;
4680
/* "bzrlib/_known_graph_pyx.pyx":499
4681
* PyList_Append(heads, node.key)
4682
* heads = frozenset(heads)
4683
* for pos from 0 <= pos < PyList_GET_SIZE(cleanup): # <<<<<<<<<<<<<<
4684
* node = _get_list_node(cleanup, pos)
4687
__pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_cleanup));
4688
for (__pyx_v_pos = 0; __pyx_v_pos < __pyx_t_4; __pyx_v_pos++) {
4690
/* "bzrlib/_known_graph_pyx.pyx":500
4691
* heads = frozenset(heads)
4692
* for pos from 0 <= pos < PyList_GET_SIZE(cleanup):
4693
* node = _get_list_node(cleanup, pos) # <<<<<<<<<<<<<<
4697
__pyx_t_2 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(((PyObject *)__pyx_v_cleanup), __pyx_v_pos)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4698
__Pyx_GOTREF(__pyx_t_2);
4699
__Pyx_DECREF(((PyObject *)__pyx_v_node));
4700
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_2);
4703
/* "bzrlib/_known_graph_pyx.pyx":501
4704
* for pos from 0 <= pos < PyList_GET_SIZE(cleanup):
4705
* node = _get_list_node(cleanup, pos)
4706
* node.seen = 0 # <<<<<<<<<<<<<<
4708
* PyDict_SetItem(self._known_heads, heads_key, heads)
4710
__pyx_v_node->seen = 0;
4713
/* "bzrlib/_known_graph_pyx.pyx":502
4714
* node = _get_list_node(cleanup, pos)
4716
* if self.do_cache: # <<<<<<<<<<<<<<
4717
* PyDict_SetItem(self._known_heads, heads_key, heads)
4720
if (((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->do_cache) {
4722
/* "bzrlib/_known_graph_pyx.pyx":503
4725
* PyDict_SetItem(self._known_heads, heads_key, heads) # <<<<<<<<<<<<<<
4729
__pyx_t_2 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads;
4730
__Pyx_INCREF(__pyx_t_2);
4731
__pyx_t_6 = PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_v_heads_key), __pyx_v_heads); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4732
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4737
/* "bzrlib/_known_graph_pyx.pyx":504
4739
* PyDict_SetItem(self._known_heads, heads_key, heads)
4740
* return heads # <<<<<<<<<<<<<<
4742
* def topo_sort(self):
4744
__Pyx_XDECREF(__pyx_r);
4745
__Pyx_INCREF(__pyx_v_heads);
4746
__pyx_r = __pyx_v_heads;
4749
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
4752
__Pyx_XDECREF(__pyx_t_1);
4753
__Pyx_XDECREF(__pyx_t_2);
4754
__Pyx_XDECREF(__pyx_t_5);
4755
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.heads");
4758
__Pyx_DECREF((PyObject *)__pyx_v_node);
4759
__Pyx_DECREF(__pyx_v_heads_key);
4760
__Pyx_DECREF(__pyx_v_candidate_nodes);
4761
__Pyx_DECREF(__pyx_v_key);
4762
__Pyx_DECREF(__pyx_v_cleanup);
4763
__Pyx_DECREF(__pyx_v_pending);
4764
__Pyx_DECREF((PyObject *)__pyx_v_parent_node);
4765
__Pyx_DECREF(__pyx_v_heads);
4766
__Pyx_XGIVEREF(__pyx_r);
4767
__Pyx_RefNannyFinishContext();
4771
/* "bzrlib/_known_graph_pyx.pyx":506
4774
* def topo_sort(self): # <<<<<<<<<<<<<<
4775
* """Return the nodes in topological order.
4779
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_8topo_sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
4780
static char __pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_8topo_sort[] = "Return the nodes in topological order.\n\n All parents must occur before all children.\n ";
4781
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_8topo_sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4782
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
4783
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_child;
4784
Py_ssize_t __pyx_v_pos;
4785
Py_ssize_t __pyx_v_last_item;
4786
PyObject *__pyx_v_pending;
4787
PyObject *__pyx_v_topo_order;
4788
PyObject *__pyx_r = NULL;
4789
PyObject *__pyx_t_1 = NULL;
4790
PyObject *__pyx_t_2 = NULL;
4792
Py_ssize_t __pyx_t_4;
4795
PyObject *__pyx_t_7 = NULL;
4797
__Pyx_RefNannySetupContext("topo_sort");
4798
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
4799
__pyx_v_child = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
4800
__pyx_v_pending = Py_None; __Pyx_INCREF(Py_None);
4801
__pyx_v_topo_order = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
4803
/* "bzrlib/_known_graph_pyx.pyx":523
4804
* cdef Py_ssize_t last_item
4806
* pending = self._find_tails() # <<<<<<<<<<<<<<
4807
* if PyList_GET_SIZE(pending) == 0 and len(self._nodes) > 0:
4808
* raise errors.GraphCycleError(self._nodes)
4810
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___find_tails); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4811
__Pyx_GOTREF(__pyx_t_1);
4812
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4813
__Pyx_GOTREF(__pyx_t_2);
4814
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4815
__Pyx_DECREF(__pyx_v_pending);
4816
__pyx_v_pending = __pyx_t_2;
4819
/* "bzrlib/_known_graph_pyx.pyx":524
4821
* pending = self._find_tails()
4822
* if PyList_GET_SIZE(pending) == 0 and len(self._nodes) > 0: # <<<<<<<<<<<<<<
4823
* raise errors.GraphCycleError(self._nodes)
4826
__pyx_t_3 = (PyList_GET_SIZE(__pyx_v_pending) == 0);
4828
__pyx_t_2 = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes;
4829
__Pyx_INCREF(__pyx_t_2);
4830
__pyx_t_4 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4831
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4832
__pyx_t_5 = (__pyx_t_4 > 0);
4833
__pyx_t_6 = __pyx_t_5;
4835
__pyx_t_6 = __pyx_t_3;
4839
/* "bzrlib/_known_graph_pyx.pyx":525
4840
* pending = self._find_tails()
4841
* if PyList_GET_SIZE(pending) == 0 and len(self._nodes) > 0:
4842
* raise errors.GraphCycleError(self._nodes) # <<<<<<<<<<<<<<
4846
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__errors); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4847
__Pyx_GOTREF(__pyx_t_2);
4848
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__GraphCycleError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4849
__Pyx_GOTREF(__pyx_t_1);
4850
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4851
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4852
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
4853
__Pyx_INCREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
4854
PyTuple_SET_ITEM(__pyx_t_2, 0, ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
4855
__Pyx_GIVEREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
4856
__pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4857
__Pyx_GOTREF(__pyx_t_7);
4858
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4859
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
4860
__Pyx_Raise(__pyx_t_7, 0, 0);
4861
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4862
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4867
/* "bzrlib/_known_graph_pyx.pyx":527
4868
* raise errors.GraphCycleError(self._nodes)
4870
* topo_order = [] # <<<<<<<<<<<<<<
4872
* last_item = PyList_GET_SIZE(pending) - 1
4874
__pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4875
__Pyx_GOTREF(((PyObject *)__pyx_t_7));
4876
__Pyx_DECREF(((PyObject *)__pyx_v_topo_order));
4877
__pyx_v_topo_order = __pyx_t_7;
4880
/* "bzrlib/_known_graph_pyx.pyx":529
4883
* last_item = PyList_GET_SIZE(pending) - 1 # <<<<<<<<<<<<<<
4884
* while last_item >= 0:
4885
* # Avoid pop followed by push, instead, peek, and replace
4887
__pyx_v_last_item = (PyList_GET_SIZE(__pyx_v_pending) - 1);
4889
/* "bzrlib/_known_graph_pyx.pyx":530
4891
* last_item = PyList_GET_SIZE(pending) - 1
4892
* while last_item >= 0: # <<<<<<<<<<<<<<
4893
* # Avoid pop followed by push, instead, peek, and replace
4894
* # timing shows this is 930ms => 770ms for OOo
4897
__pyx_t_6 = (__pyx_v_last_item >= 0);
4898
if (!__pyx_t_6) break;
4900
/* "bzrlib/_known_graph_pyx.pyx":533
4901
* # Avoid pop followed by push, instead, peek, and replace
4902
* # timing shows this is 930ms => 770ms for OOo
4903
* node = _get_list_node(pending, last_item) # <<<<<<<<<<<<<<
4904
* last_item = last_item - 1
4905
* if node.parents is not None:
4907
__pyx_t_7 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_v_pending, __pyx_v_last_item)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4908
__Pyx_GOTREF(__pyx_t_7);
4909
__Pyx_DECREF(((PyObject *)__pyx_v_node));
4910
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_7);
4913
/* "bzrlib/_known_graph_pyx.pyx":534
4914
* # timing shows this is 930ms => 770ms for OOo
4915
* node = _get_list_node(pending, last_item)
4916
* last_item = last_item - 1 # <<<<<<<<<<<<<<
4917
* if node.parents is not None:
4918
* # We don't include ghost parents
4920
__pyx_v_last_item = (__pyx_v_last_item - 1);
4922
/* "bzrlib/_known_graph_pyx.pyx":535
4923
* node = _get_list_node(pending, last_item)
4924
* last_item = last_item - 1
4925
* if node.parents is not None: # <<<<<<<<<<<<<<
4926
* # We don't include ghost parents
4927
* PyList_Append(topo_order, node.key)
4929
__pyx_t_6 = (__pyx_v_node->parents != Py_None);
4932
/* "bzrlib/_known_graph_pyx.pyx":537
4933
* if node.parents is not None:
4934
* # We don't include ghost parents
4935
* PyList_Append(topo_order, node.key) # <<<<<<<<<<<<<<
4936
* for pos from 0 <= pos < PyList_GET_SIZE(node.children):
4937
* child = _get_list_node(node.children, pos)
4939
__pyx_t_7 = __pyx_v_node->key;
4940
__Pyx_INCREF(__pyx_t_7);
4941
__pyx_t_8 = PyList_Append(((PyObject *)__pyx_v_topo_order), __pyx_t_7); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4942
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4947
/* "bzrlib/_known_graph_pyx.pyx":538
4948
* # We don't include ghost parents
4949
* PyList_Append(topo_order, node.key)
4950
* for pos from 0 <= pos < PyList_GET_SIZE(node.children): # <<<<<<<<<<<<<<
4951
* child = _get_list_node(node.children, pos)
4952
* if child.gdfo == -1:
4954
__pyx_t_7 = __pyx_v_node->children;
4955
__Pyx_INCREF(__pyx_t_7);
4956
__pyx_t_4 = PyList_GET_SIZE(__pyx_t_7);
4957
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4958
for (__pyx_v_pos = 0; __pyx_v_pos < __pyx_t_4; __pyx_v_pos++) {
4960
/* "bzrlib/_known_graph_pyx.pyx":539
4961
* PyList_Append(topo_order, node.key)
4962
* for pos from 0 <= pos < PyList_GET_SIZE(node.children):
4963
* child = _get_list_node(node.children, pos) # <<<<<<<<<<<<<<
4964
* if child.gdfo == -1:
4965
* # We know we have a graph cycle because a node has a parent
4967
__pyx_t_7 = __pyx_v_node->children;
4968
__Pyx_INCREF(__pyx_t_7);
4969
__pyx_t_2 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_t_7, __pyx_v_pos)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4970
__Pyx_GOTREF(__pyx_t_2);
4971
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4972
__Pyx_DECREF(((PyObject *)__pyx_v_child));
4973
__pyx_v_child = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_2);
4976
/* "bzrlib/_known_graph_pyx.pyx":540
4977
* for pos from 0 <= pos < PyList_GET_SIZE(node.children):
4978
* child = _get_list_node(node.children, pos)
4979
* if child.gdfo == -1: # <<<<<<<<<<<<<<
4980
* # We know we have a graph cycle because a node has a parent
4981
* # which we couldn't find
4983
__pyx_t_6 = (__pyx_v_child->gdfo == -1);
4986
/* "bzrlib/_known_graph_pyx.pyx":543
4987
* # We know we have a graph cycle because a node has a parent
4988
* # which we couldn't find
4989
* raise errors.GraphCycleError(self._nodes) # <<<<<<<<<<<<<<
4990
* child.seen = child.seen + 1
4991
* if child.seen == PyTuple_GET_SIZE(child.parents):
4993
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__errors); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4994
__Pyx_GOTREF(__pyx_t_2);
4995
__pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__GraphCycleError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4996
__Pyx_GOTREF(__pyx_t_7);
4997
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4998
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4999
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
5000
__Pyx_INCREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
5001
PyTuple_SET_ITEM(__pyx_t_2, 0, ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
5002
__Pyx_GIVEREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
5003
__pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5004
__Pyx_GOTREF(__pyx_t_1);
5005
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5006
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
5007
__Pyx_Raise(__pyx_t_1, 0, 0);
5008
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5009
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5014
/* "bzrlib/_known_graph_pyx.pyx":544
5015
* # which we couldn't find
5016
* raise errors.GraphCycleError(self._nodes)
5017
* child.seen = child.seen + 1 # <<<<<<<<<<<<<<
5018
* if child.seen == PyTuple_GET_SIZE(child.parents):
5019
* # All parents of this child have been yielded, queue this
5021
__pyx_v_child->seen = (__pyx_v_child->seen + 1);
5023
/* "bzrlib/_known_graph_pyx.pyx":545
5024
* raise errors.GraphCycleError(self._nodes)
5025
* child.seen = child.seen + 1
5026
* if child.seen == PyTuple_GET_SIZE(child.parents): # <<<<<<<<<<<<<<
5027
* # All parents of this child have been yielded, queue this
5028
* # one to be yielded as well
5030
__pyx_t_1 = __pyx_v_child->parents;
5031
__Pyx_INCREF(__pyx_t_1);
5032
__pyx_t_6 = (__pyx_v_child->seen == PyTuple_GET_SIZE(__pyx_t_1));
5033
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5036
/* "bzrlib/_known_graph_pyx.pyx":548
5037
* # All parents of this child have been yielded, queue this
5038
* # one to be yielded as well
5039
* last_item = last_item + 1 # <<<<<<<<<<<<<<
5040
* if last_item < PyList_GET_SIZE(pending):
5041
* Py_INCREF(child) # SetItem steals a ref
5043
__pyx_v_last_item = (__pyx_v_last_item + 1);
5045
/* "bzrlib/_known_graph_pyx.pyx":549
5046
* # one to be yielded as well
5047
* last_item = last_item + 1
5048
* if last_item < PyList_GET_SIZE(pending): # <<<<<<<<<<<<<<
5049
* Py_INCREF(child) # SetItem steals a ref
5050
* PyList_SetItem(pending, last_item, child)
5052
__pyx_t_6 = (__pyx_v_last_item < PyList_GET_SIZE(__pyx_v_pending));
5055
/* "bzrlib/_known_graph_pyx.pyx":550
5056
* last_item = last_item + 1
5057
* if last_item < PyList_GET_SIZE(pending):
5058
* Py_INCREF(child) # SetItem steals a ref # <<<<<<<<<<<<<<
5059
* PyList_SetItem(pending, last_item, child)
5062
Py_INCREF(((PyObject *)__pyx_v_child));
5064
/* "bzrlib/_known_graph_pyx.pyx":551
5065
* if last_item < PyList_GET_SIZE(pending):
5066
* Py_INCREF(child) # SetItem steals a ref
5067
* PyList_SetItem(pending, last_item, child) # <<<<<<<<<<<<<<
5069
* PyList_Append(pending, child)
5071
__pyx_t_8 = PyList_SetItem(__pyx_v_pending, __pyx_v_last_item, ((PyObject *)__pyx_v_child)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5076
/* "bzrlib/_known_graph_pyx.pyx":553
5077
* PyList_SetItem(pending, last_item, child)
5079
* PyList_Append(pending, child) # <<<<<<<<<<<<<<
5080
* # We have queued this node, we don't need to track it
5083
__pyx_t_8 = PyList_Append(__pyx_v_pending, ((PyObject *)__pyx_v_child)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5087
/* "bzrlib/_known_graph_pyx.pyx":556
5088
* # We have queued this node, we don't need to track it
5090
* child.seen = 0 # <<<<<<<<<<<<<<
5091
* # We started from the parents, so we don't need to do anymore work
5094
__pyx_v_child->seen = 0;
5101
/* "bzrlib/_known_graph_pyx.pyx":558
5103
* # We started from the parents, so we don't need to do anymore work
5104
* return topo_order # <<<<<<<<<<<<<<
5106
* def gc_sort(self):
5108
__Pyx_XDECREF(__pyx_r);
5109
__Pyx_INCREF(((PyObject *)__pyx_v_topo_order));
5110
__pyx_r = ((PyObject *)__pyx_v_topo_order);
5113
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
5116
__Pyx_XDECREF(__pyx_t_1);
5117
__Pyx_XDECREF(__pyx_t_2);
5118
__Pyx_XDECREF(__pyx_t_7);
5119
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.topo_sort");
5122
__Pyx_DECREF((PyObject *)__pyx_v_node);
5123
__Pyx_DECREF((PyObject *)__pyx_v_child);
5124
__Pyx_DECREF(__pyx_v_pending);
5125
__Pyx_DECREF(__pyx_v_topo_order);
5126
__Pyx_XGIVEREF(__pyx_r);
5127
__Pyx_RefNannyFinishContext();
5131
/* "bzrlib/_known_graph_pyx.pyx":560
5134
* def gc_sort(self): # <<<<<<<<<<<<<<
5135
* """Return a reverse topological ordering which is 'stable'.
5139
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_9gc_sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5140
static char __pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_9gc_sort[] = "Return a reverse topological ordering which is 'stable'.\n\n There are a few constraints:\n 1) Reverse topological (all children before all parents)\n 2) Grouped by prefix\n 3) 'stable' sorting, so that we get the same result, independent of\n machine, or extra data.\n To do this, we use the same basic algorithm as topo_sort, but when we\n aren't sure what node to access next, we sort them lexicographically.\n ";
5141
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_9gc_sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5142
PyObject *__pyx_v_temp;
5143
Py_ssize_t __pyx_v_pos;
5144
Py_ssize_t __pyx_v_last_item;
5145
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
5146
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_parent_node;
5147
PyObject *__pyx_v_tips;
5148
PyObject *__pyx_v_prefix_tips;
5149
PyObject *__pyx_v_prefix;
5150
PyObject *__pyx_v_tip_nodes;
5151
PyObject *__pyx_v_result;
5152
PyObject *__pyx_v_pending;
5153
PyObject *__pyx_v_parents;
5154
PyObject *__pyx_r = NULL;
5155
PyObject *__pyx_t_1 = NULL;
5156
PyObject *__pyx_t_2 = NULL;
5157
Py_ssize_t __pyx_t_3;
5158
Py_ssize_t __pyx_t_4;
5162
PyObject *__pyx_t_8 = NULL;
5163
__Pyx_RefNannySetupContext("gc_sort");
5164
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
5165
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
5166
__pyx_v_tips = Py_None; __Pyx_INCREF(Py_None);
5167
__pyx_v_prefix_tips = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
5168
__pyx_v_prefix = Py_None; __Pyx_INCREF(Py_None);
5169
__pyx_v_tip_nodes = Py_None; __Pyx_INCREF(Py_None);
5170
__pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
5171
__pyx_v_pending = Py_None; __Pyx_INCREF(Py_None);
5172
__pyx_v_parents = Py_None; __Pyx_INCREF(Py_None);
5174
/* "bzrlib/_known_graph_pyx.pyx":575
5175
* cdef _KnownGraphNode node, node2, parent_node
5177
* tips = self._find_tips() # <<<<<<<<<<<<<<
5178
* # Split the tips based on prefix
5181
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___find_tips); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5182
__Pyx_GOTREF(__pyx_t_1);
5183
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5184
__Pyx_GOTREF(__pyx_t_2);
5185
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5186
__Pyx_DECREF(__pyx_v_tips);
5187
__pyx_v_tips = __pyx_t_2;
5190
/* "bzrlib/_known_graph_pyx.pyx":577
5191
* tips = self._find_tips()
5192
* # Split the tips based on prefix
5193
* prefix_tips = {} # <<<<<<<<<<<<<<
5194
* for pos from 0 <= pos < PyList_GET_SIZE(tips):
5195
* node = _get_list_node(tips, pos)
5197
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5198
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
5199
__Pyx_DECREF(((PyObject *)__pyx_v_prefix_tips));
5200
__pyx_v_prefix_tips = __pyx_t_2;
5203
/* "bzrlib/_known_graph_pyx.pyx":578
5204
* # Split the tips based on prefix
5206
* for pos from 0 <= pos < PyList_GET_SIZE(tips): # <<<<<<<<<<<<<<
5207
* node = _get_list_node(tips, pos)
5208
* if PyString_CheckExact(node.key) or len(node.key) == 1:
5210
__pyx_t_3 = PyList_GET_SIZE(__pyx_v_tips);
5211
for (__pyx_v_pos = 0; __pyx_v_pos < __pyx_t_3; __pyx_v_pos++) {
5213
/* "bzrlib/_known_graph_pyx.pyx":579
5215
* for pos from 0 <= pos < PyList_GET_SIZE(tips):
5216
* node = _get_list_node(tips, pos) # <<<<<<<<<<<<<<
5217
* if PyString_CheckExact(node.key) or len(node.key) == 1:
5220
__pyx_t_2 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_v_tips, __pyx_v_pos)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5221
__Pyx_GOTREF(__pyx_t_2);
5222
__Pyx_DECREF(((PyObject *)__pyx_v_node));
5223
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_2);
5226
/* "bzrlib/_known_graph_pyx.pyx":580
5227
* for pos from 0 <= pos < PyList_GET_SIZE(tips):
5228
* node = _get_list_node(tips, pos)
5229
* if PyString_CheckExact(node.key) or len(node.key) == 1: # <<<<<<<<<<<<<<
5233
__pyx_t_2 = __pyx_v_node->key;
5234
__Pyx_INCREF(__pyx_t_2);
5235
if (!PyString_CheckExact(__pyx_t_2)) {
5236
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5237
__pyx_t_1 = __pyx_v_node->key;
5238
__Pyx_INCREF(__pyx_t_1);
5239
__pyx_t_4 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5240
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5241
__pyx_t_5 = (__pyx_t_4 == 1);
5242
__pyx_t_6 = __pyx_t_5;
5244
__pyx_t_6 = PyString_CheckExact(__pyx_t_2);
5245
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5249
/* "bzrlib/_known_graph_pyx.pyx":581
5250
* node = _get_list_node(tips, pos)
5251
* if PyString_CheckExact(node.key) or len(node.key) == 1:
5252
* prefix = '' # <<<<<<<<<<<<<<
5254
* prefix = node.key[0]
5256
__Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
5257
__Pyx_DECREF(__pyx_v_prefix);
5258
__pyx_v_prefix = ((PyObject *)__pyx_kp_s_9);
5263
/* "bzrlib/_known_graph_pyx.pyx":583
5266
* prefix = node.key[0] # <<<<<<<<<<<<<<
5267
* temp = PyDict_GetItem(prefix_tips, prefix)
5270
__pyx_t_2 = __Pyx_GetItemInt(__pyx_v_node->key, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5271
__Pyx_GOTREF(__pyx_t_2);
5272
__Pyx_DECREF(__pyx_v_prefix);
5273
__pyx_v_prefix = __pyx_t_2;
5278
/* "bzrlib/_known_graph_pyx.pyx":584
5280
* prefix = node.key[0]
5281
* temp = PyDict_GetItem(prefix_tips, prefix) # <<<<<<<<<<<<<<
5283
* prefix_tips[prefix] = [node]
5285
__pyx_v_temp = PyDict_GetItem(((PyObject *)__pyx_v_prefix_tips), __pyx_v_prefix);
5287
/* "bzrlib/_known_graph_pyx.pyx":585
5288
* prefix = node.key[0]
5289
* temp = PyDict_GetItem(prefix_tips, prefix)
5290
* if temp == NULL: # <<<<<<<<<<<<<<
5291
* prefix_tips[prefix] = [node]
5294
__pyx_t_6 = (__pyx_v_temp == NULL);
5297
/* "bzrlib/_known_graph_pyx.pyx":586
5298
* temp = PyDict_GetItem(prefix_tips, prefix)
5300
* prefix_tips[prefix] = [node] # <<<<<<<<<<<<<<
5302
* tip_nodes = <object>temp
5304
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5305
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
5306
__Pyx_INCREF(((PyObject *)__pyx_v_node));
5307
PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_node));
5308
__Pyx_GIVEREF(((PyObject *)__pyx_v_node));
5309
if (PyDict_SetItem(((PyObject *)__pyx_v_prefix_tips), __pyx_v_prefix, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5310
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
5315
/* "bzrlib/_known_graph_pyx.pyx":588
5316
* prefix_tips[prefix] = [node]
5318
* tip_nodes = <object>temp # <<<<<<<<<<<<<<
5319
* PyList_Append(tip_nodes, node)
5322
__Pyx_INCREF(((PyObject *)__pyx_v_temp));
5323
__Pyx_DECREF(__pyx_v_tip_nodes);
5324
__pyx_v_tip_nodes = ((PyObject *)__pyx_v_temp);
5326
/* "bzrlib/_known_graph_pyx.pyx":589
5328
* tip_nodes = <object>temp
5329
* PyList_Append(tip_nodes, node) # <<<<<<<<<<<<<<
5333
__pyx_t_7 = PyList_Append(__pyx_v_tip_nodes, ((PyObject *)__pyx_v_node)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5338
/* "bzrlib/_known_graph_pyx.pyx":591
5339
* PyList_Append(tip_nodes, node)
5341
* result = [] # <<<<<<<<<<<<<<
5342
* for prefix in sorted(prefix_tips):
5343
* temp = PyDict_GetItem(prefix_tips, prefix)
5345
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5346
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
5347
__Pyx_DECREF(((PyObject *)__pyx_v_result));
5348
__pyx_v_result = __pyx_t_2;
5351
/* "bzrlib/_known_graph_pyx.pyx":592
5354
* for prefix in sorted(prefix_tips): # <<<<<<<<<<<<<<
5355
* temp = PyDict_GetItem(prefix_tips, prefix)
5356
* assert temp != NULL
5358
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5359
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
5360
__Pyx_INCREF(((PyObject *)__pyx_v_prefix_tips));
5361
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_prefix_tips));
5362
__Pyx_GIVEREF(((PyObject *)__pyx_v_prefix_tips));
5363
__pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5364
__Pyx_GOTREF(__pyx_t_1);
5365
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
5366
if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
5367
__pyx_t_3 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
5369
__pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5370
__Pyx_GOTREF(__pyx_t_2);
5372
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5374
if (likely(PyList_CheckExact(__pyx_t_2))) {
5375
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
5376
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
5377
} else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
5378
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
5379
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
5381
__pyx_t_1 = PyIter_Next(__pyx_t_2);
5383
if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5386
__Pyx_GOTREF(__pyx_t_1);
5388
__Pyx_DECREF(__pyx_v_prefix);
5389
__pyx_v_prefix = __pyx_t_1;
5392
/* "bzrlib/_known_graph_pyx.pyx":593
5394
* for prefix in sorted(prefix_tips):
5395
* temp = PyDict_GetItem(prefix_tips, prefix) # <<<<<<<<<<<<<<
5396
* assert temp != NULL
5397
* tip_nodes = <object>temp
5399
__pyx_v_temp = PyDict_GetItem(((PyObject *)__pyx_v_prefix_tips), __pyx_v_prefix);
5401
/* "bzrlib/_known_graph_pyx.pyx":594
5402
* for prefix in sorted(prefix_tips):
5403
* temp = PyDict_GetItem(prefix_tips, prefix)
5404
* assert temp != NULL # <<<<<<<<<<<<<<
5405
* tip_nodes = <object>temp
5406
* pending = _sort_list_nodes(tip_nodes, 1)
5408
#ifndef CYTHON_WITHOUT_ASSERTIONS
5409
if (unlikely(!(__pyx_v_temp != NULL))) {
5410
PyErr_SetNone(PyExc_AssertionError);
5411
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5415
/* "bzrlib/_known_graph_pyx.pyx":595
5416
* temp = PyDict_GetItem(prefix_tips, prefix)
5417
* assert temp != NULL
5418
* tip_nodes = <object>temp # <<<<<<<<<<<<<<
5419
* pending = _sort_list_nodes(tip_nodes, 1)
5420
* last_item = PyList_GET_SIZE(pending) - 1
5422
__Pyx_INCREF(((PyObject *)__pyx_v_temp));
5423
__Pyx_DECREF(__pyx_v_tip_nodes);
5424
__pyx_v_tip_nodes = ((PyObject *)__pyx_v_temp);
5426
/* "bzrlib/_known_graph_pyx.pyx":596
5427
* assert temp != NULL
5428
* tip_nodes = <object>temp
5429
* pending = _sort_list_nodes(tip_nodes, 1) # <<<<<<<<<<<<<<
5430
* last_item = PyList_GET_SIZE(pending) - 1
5431
* while last_item >= 0:
5433
__pyx_t_1 = __pyx_f_6bzrlib_16_known_graph_pyx__sort_list_nodes(__pyx_v_tip_nodes, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5434
__Pyx_GOTREF(__pyx_t_1);
5435
__Pyx_DECREF(__pyx_v_pending);
5436
__pyx_v_pending = __pyx_t_1;
5439
/* "bzrlib/_known_graph_pyx.pyx":597
5440
* tip_nodes = <object>temp
5441
* pending = _sort_list_nodes(tip_nodes, 1)
5442
* last_item = PyList_GET_SIZE(pending) - 1 # <<<<<<<<<<<<<<
5443
* while last_item >= 0:
5444
* node = _get_list_node(pending, last_item)
5446
__pyx_v_last_item = (PyList_GET_SIZE(__pyx_v_pending) - 1);
5448
/* "bzrlib/_known_graph_pyx.pyx":598
5449
* pending = _sort_list_nodes(tip_nodes, 1)
5450
* last_item = PyList_GET_SIZE(pending) - 1
5451
* while last_item >= 0: # <<<<<<<<<<<<<<
5452
* node = _get_list_node(pending, last_item)
5453
* last_item = last_item - 1
5456
__pyx_t_6 = (__pyx_v_last_item >= 0);
5457
if (!__pyx_t_6) break;
5459
/* "bzrlib/_known_graph_pyx.pyx":599
5460
* last_item = PyList_GET_SIZE(pending) - 1
5461
* while last_item >= 0:
5462
* node = _get_list_node(pending, last_item) # <<<<<<<<<<<<<<
5463
* last_item = last_item - 1
5464
* if node.parents is None:
5466
__pyx_t_1 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_v_pending, __pyx_v_last_item)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5467
__Pyx_GOTREF(__pyx_t_1);
5468
__Pyx_DECREF(((PyObject *)__pyx_v_node));
5469
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_1);
5472
/* "bzrlib/_known_graph_pyx.pyx":600
5473
* while last_item >= 0:
5474
* node = _get_list_node(pending, last_item)
5475
* last_item = last_item - 1 # <<<<<<<<<<<<<<
5476
* if node.parents is None:
5479
__pyx_v_last_item = (__pyx_v_last_item - 1);
5481
/* "bzrlib/_known_graph_pyx.pyx":601
5482
* node = _get_list_node(pending, last_item)
5483
* last_item = last_item - 1
5484
* if node.parents is None: # <<<<<<<<<<<<<<
5488
__pyx_t_6 = (__pyx_v_node->parents == Py_None);
5491
/* "bzrlib/_known_graph_pyx.pyx":603
5492
* if node.parents is None:
5494
* continue # <<<<<<<<<<<<<<
5495
* PyList_Append(result, node.key)
5496
* # Sorting the parent keys isn't strictly necessary for stable
5498
goto __pyx_L11_continue;
5503
/* "bzrlib/_known_graph_pyx.pyx":604
5506
* PyList_Append(result, node.key) # <<<<<<<<<<<<<<
5507
* # Sorting the parent keys isn't strictly necessary for stable
5508
* # sorting of a given graph. But it does help minimize the
5510
__pyx_t_1 = __pyx_v_node->key;
5511
__Pyx_INCREF(__pyx_t_1);
5512
__pyx_t_7 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5513
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5515
/* "bzrlib/_known_graph_pyx.pyx":611
5517
* # 7.73ms RichCompareBool sort
5518
* parents = _sort_list_nodes(node.parents, 1) # <<<<<<<<<<<<<<
5519
* for pos from 0 <= pos < len(parents):
5520
* if PyTuple_CheckExact(parents):
5522
__pyx_t_1 = __pyx_v_node->parents;
5523
__Pyx_INCREF(__pyx_t_1);
5524
__pyx_t_8 = __pyx_f_6bzrlib_16_known_graph_pyx__sort_list_nodes(__pyx_t_1, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5525
__Pyx_GOTREF(__pyx_t_8);
5526
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5527
__Pyx_DECREF(__pyx_v_parents);
5528
__pyx_v_parents = __pyx_t_8;
5531
/* "bzrlib/_known_graph_pyx.pyx":612
5532
* # 7.73ms RichCompareBool sort
5533
* parents = _sort_list_nodes(node.parents, 1)
5534
* for pos from 0 <= pos < len(parents): # <<<<<<<<<<<<<<
5535
* if PyTuple_CheckExact(parents):
5536
* parent_node = _get_tuple_node(parents, pos)
5538
__pyx_t_4 = PyObject_Length(__pyx_v_parents); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5539
for (__pyx_v_pos = 0; __pyx_v_pos < __pyx_t_4; __pyx_v_pos++) {
5541
/* "bzrlib/_known_graph_pyx.pyx":613
5542
* parents = _sort_list_nodes(node.parents, 1)
5543
* for pos from 0 <= pos < len(parents):
5544
* if PyTuple_CheckExact(parents): # <<<<<<<<<<<<<<
5545
* parent_node = _get_tuple_node(parents, pos)
5548
__pyx_t_7 = PyTuple_CheckExact(__pyx_v_parents);
5551
/* "bzrlib/_known_graph_pyx.pyx":614
5552
* for pos from 0 <= pos < len(parents):
5553
* if PyTuple_CheckExact(parents):
5554
* parent_node = _get_tuple_node(parents, pos) # <<<<<<<<<<<<<<
5556
* parent_node = _get_list_node(parents, pos)
5558
__pyx_t_8 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_tuple_node(__pyx_v_parents, __pyx_v_pos)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5559
__Pyx_GOTREF(__pyx_t_8);
5560
__Pyx_DECREF(((PyObject *)__pyx_v_parent_node));
5561
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_8);
5567
/* "bzrlib/_known_graph_pyx.pyx":616
5568
* parent_node = _get_tuple_node(parents, pos)
5570
* parent_node = _get_list_node(parents, pos) # <<<<<<<<<<<<<<
5571
* # TODO: GraphCycle detection
5572
* parent_node.seen = parent_node.seen + 1
5574
__pyx_t_8 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_v_parents, __pyx_v_pos)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5575
__Pyx_GOTREF(__pyx_t_8);
5576
__Pyx_DECREF(((PyObject *)__pyx_v_parent_node));
5577
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_8);
5582
/* "bzrlib/_known_graph_pyx.pyx":618
5583
* parent_node = _get_list_node(parents, pos)
5584
* # TODO: GraphCycle detection
5585
* parent_node.seen = parent_node.seen + 1 # <<<<<<<<<<<<<<
5586
* if (parent_node.seen
5587
* == PyList_GET_SIZE(parent_node.children)):
5589
__pyx_v_parent_node->seen = (__pyx_v_parent_node->seen + 1);
5591
/* "bzrlib/_known_graph_pyx.pyx":620
5592
* parent_node.seen = parent_node.seen + 1
5593
* if (parent_node.seen
5594
* == PyList_GET_SIZE(parent_node.children)): # <<<<<<<<<<<<<<
5595
* # All children have been processed, queue up this
5598
__pyx_t_8 = __pyx_v_parent_node->children;
5599
__Pyx_INCREF(__pyx_t_8);
5600
__pyx_t_6 = (__pyx_v_parent_node->seen == PyList_GET_SIZE(__pyx_t_8));
5601
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5604
/* "bzrlib/_known_graph_pyx.pyx":623
5605
* # All children have been processed, queue up this
5607
* last_item = last_item + 1 # <<<<<<<<<<<<<<
5608
* if last_item < PyList_GET_SIZE(pending):
5609
* Py_INCREF(parent_node) # SetItem steals a ref
5611
__pyx_v_last_item = (__pyx_v_last_item + 1);
5613
/* "bzrlib/_known_graph_pyx.pyx":624
5615
* last_item = last_item + 1
5616
* if last_item < PyList_GET_SIZE(pending): # <<<<<<<<<<<<<<
5617
* Py_INCREF(parent_node) # SetItem steals a ref
5618
* PyList_SetItem(pending, last_item, parent_node)
5620
__pyx_t_6 = (__pyx_v_last_item < PyList_GET_SIZE(__pyx_v_pending));
5623
/* "bzrlib/_known_graph_pyx.pyx":625
5624
* last_item = last_item + 1
5625
* if last_item < PyList_GET_SIZE(pending):
5626
* Py_INCREF(parent_node) # SetItem steals a ref # <<<<<<<<<<<<<<
5627
* PyList_SetItem(pending, last_item, parent_node)
5630
Py_INCREF(((PyObject *)__pyx_v_parent_node));
5632
/* "bzrlib/_known_graph_pyx.pyx":626
5633
* if last_item < PyList_GET_SIZE(pending):
5634
* Py_INCREF(parent_node) # SetItem steals a ref
5635
* PyList_SetItem(pending, last_item, parent_node) # <<<<<<<<<<<<<<
5637
* PyList_Append(pending, parent_node)
5639
__pyx_t_7 = PyList_SetItem(__pyx_v_pending, __pyx_v_last_item, ((PyObject *)__pyx_v_parent_node)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5644
/* "bzrlib/_known_graph_pyx.pyx":628
5645
* PyList_SetItem(pending, last_item, parent_node)
5647
* PyList_Append(pending, parent_node) # <<<<<<<<<<<<<<
5648
* parent_node.seen = 0
5651
__pyx_t_7 = PyList_Append(__pyx_v_pending, ((PyObject *)__pyx_v_parent_node)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5655
/* "bzrlib/_known_graph_pyx.pyx":629
5657
* PyList_Append(pending, parent_node)
5658
* parent_node.seen = 0 # <<<<<<<<<<<<<<
5662
__pyx_v_parent_node->seen = 0;
5667
__pyx_L11_continue:;
5670
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5672
/* "bzrlib/_known_graph_pyx.pyx":630
5673
* PyList_Append(pending, parent_node)
5674
* parent_node.seen = 0
5675
* return result # <<<<<<<<<<<<<<
5677
* def merge_sort(self, tip_key):
5679
__Pyx_XDECREF(__pyx_r);
5680
__Pyx_INCREF(((PyObject *)__pyx_v_result));
5681
__pyx_r = ((PyObject *)__pyx_v_result);
5684
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
5687
__Pyx_XDECREF(__pyx_t_1);
5688
__Pyx_XDECREF(__pyx_t_2);
5689
__Pyx_XDECREF(__pyx_t_8);
5690
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.gc_sort");
5693
__Pyx_DECREF((PyObject *)__pyx_v_node);
5694
__Pyx_DECREF((PyObject *)__pyx_v_parent_node);
5695
__Pyx_DECREF(__pyx_v_tips);
5696
__Pyx_DECREF(__pyx_v_prefix_tips);
5697
__Pyx_DECREF(__pyx_v_prefix);
5698
__Pyx_DECREF(__pyx_v_tip_nodes);
5699
__Pyx_DECREF(__pyx_v_result);
5700
__Pyx_DECREF(__pyx_v_pending);
5701
__Pyx_DECREF(__pyx_v_parents);
5702
__Pyx_XGIVEREF(__pyx_r);
5703
__Pyx_RefNannyFinishContext();
5707
/* "bzrlib/_known_graph_pyx.pyx":632
5710
* def merge_sort(self, tip_key): # <<<<<<<<<<<<<<
5711
* """Compute the merge sorted graph output."""
5712
* cdef _MergeSorter sorter
5715
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_10merge_sort(PyObject *__pyx_v_self, PyObject *__pyx_v_tip_key); /*proto*/
5716
static char __pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_10merge_sort[] = "Compute the merge sorted graph output.";
5717
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_10merge_sort(PyObject *__pyx_v_self, PyObject *__pyx_v_tip_key) {
5718
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *__pyx_v_sorter;
5719
PyObject *__pyx_r = NULL;
5720
PyObject *__pyx_t_1 = NULL;
5721
PyObject *__pyx_t_2 = NULL;
5722
__Pyx_RefNannySetupContext("merge_sort");
5723
__pyx_v_sorter = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)Py_None); __Pyx_INCREF(Py_None);
5725
/* "bzrlib/_known_graph_pyx.pyx":639
5726
* # that won't be collectable anyway. real world testing has not
5727
* # shown a specific impact, yet.
5728
* sorter = _MergeSorter(self, tip_key) # <<<<<<<<<<<<<<
5729
* return sorter.topo_order()
5732
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5733
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
5734
__Pyx_INCREF(__pyx_v_self);
5735
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
5736
__Pyx_GIVEREF(__pyx_v_self);
5737
__Pyx_INCREF(__pyx_v_tip_key);
5738
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tip_key);
5739
__Pyx_GIVEREF(__pyx_v_tip_key);
5740
__pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_16_known_graph_pyx__MergeSorter)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5741
__Pyx_GOTREF(__pyx_t_2);
5742
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
5743
__Pyx_DECREF(((PyObject *)__pyx_v_sorter));
5744
__pyx_v_sorter = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_t_2);
5747
/* "bzrlib/_known_graph_pyx.pyx":640
5748
* # shown a specific impact, yet.
5749
* sorter = _MergeSorter(self, tip_key)
5750
* return sorter.topo_order() # <<<<<<<<<<<<<<
5752
* def get_parent_keys(self, key):
5754
__Pyx_XDECREF(__pyx_r);
5755
__pyx_t_2 = ((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_sorter->__pyx_vtab)->topo_order(__pyx_v_sorter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5756
__Pyx_GOTREF(__pyx_t_2);
5757
__pyx_r = __pyx_t_2;
5761
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
5764
__Pyx_XDECREF(__pyx_t_1);
5765
__Pyx_XDECREF(__pyx_t_2);
5766
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.merge_sort");
5769
__Pyx_DECREF((PyObject *)__pyx_v_sorter);
5770
__Pyx_XGIVEREF(__pyx_r);
5771
__Pyx_RefNannyFinishContext();
5775
/* "bzrlib/_known_graph_pyx.pyx":642
5776
* return sorter.topo_order()
5778
* def get_parent_keys(self, key): # <<<<<<<<<<<<<<
5779
* """Get the parents for a key
5783
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_11get_parent_keys(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
5784
static char __pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_11get_parent_keys[] = "Get the parents for a key\n \n Returns a list containg the parents keys. If the key is a ghost,\n None is returned. A KeyError will be raised if the key is not in\n the graph.\n \n :param keys: Key to check (eg revision_id)\n :return: A list of parents\n ";
5785
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_11get_parent_keys(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
5786
PyObject *__pyx_r = NULL;
5787
PyObject *__pyx_t_1 = NULL;
5788
PyObject *__pyx_t_2 = NULL;
5789
__Pyx_RefNannySetupContext("get_parent_keys");
5791
/* "bzrlib/_known_graph_pyx.pyx":652
5792
* :return: A list of parents
5794
* return self._nodes[key].parent_keys # <<<<<<<<<<<<<<
5796
* def get_child_keys(self, key):
5798
__Pyx_XDECREF(__pyx_r);
5799
__pyx_t_1 = PyObject_GetItem(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes, __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5800
__Pyx_GOTREF(__pyx_t_1);
5801
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__parent_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5802
__Pyx_GOTREF(__pyx_t_2);
5803
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5804
__pyx_r = __pyx_t_2;
5808
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
5811
__Pyx_XDECREF(__pyx_t_1);
5812
__Pyx_XDECREF(__pyx_t_2);
5813
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.get_parent_keys");
5816
__Pyx_XGIVEREF(__pyx_r);
5817
__Pyx_RefNannyFinishContext();
5821
/* "bzrlib/_known_graph_pyx.pyx":654
5822
* return self._nodes[key].parent_keys
5824
* def get_child_keys(self, key): # <<<<<<<<<<<<<<
5825
* """Get the children for a key
5829
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_12get_child_keys(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
5830
static char __pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_12get_child_keys[] = "Get the children for a key\n \n Returns a list containg the children keys. A KeyError will be raised\n if the key is not in the graph.\n \n :param keys: Key to check (eg revision_id)\n :return: A list of children\n ";
5831
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_12get_child_keys(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
5832
PyObject *__pyx_r = NULL;
5833
PyObject *__pyx_t_1 = NULL;
5834
PyObject *__pyx_t_2 = NULL;
5835
__Pyx_RefNannySetupContext("get_child_keys");
5837
/* "bzrlib/_known_graph_pyx.pyx":663
5838
* :return: A list of children
5840
* return self._nodes[key].child_keys # <<<<<<<<<<<<<<
5844
__Pyx_XDECREF(__pyx_r);
5845
__pyx_t_1 = PyObject_GetItem(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes, __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5846
__Pyx_GOTREF(__pyx_t_1);
5847
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__child_keys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5848
__Pyx_GOTREF(__pyx_t_2);
5849
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5850
__pyx_r = __pyx_t_2;
5854
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
5857
__Pyx_XDECREF(__pyx_t_1);
5858
__Pyx_XDECREF(__pyx_t_2);
5859
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.get_child_keys");
5862
__Pyx_XGIVEREF(__pyx_r);
5863
__Pyx_RefNannyFinishContext();
5867
/* "bzrlib/_known_graph_pyx.pyx":195
5868
* """This is a class which assumes we already know the full graph."""
5870
* cdef public object _nodes # <<<<<<<<<<<<<<
5871
* cdef public object _known_heads
5872
* cdef public int do_cache
5875
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_6_nodes___get__(PyObject *__pyx_v_self); /*proto*/
5876
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_6_nodes___get__(PyObject *__pyx_v_self) {
5877
PyObject *__pyx_r = NULL;
5878
__Pyx_RefNannySetupContext("__get__");
5879
__Pyx_XDECREF(__pyx_r);
5880
__Pyx_INCREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
5881
__pyx_r = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes;
5884
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
5886
__Pyx_XGIVEREF(__pyx_r);
5887
__Pyx_RefNannyFinishContext();
5891
static int __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_6_nodes_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
5892
static int __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_6_nodes_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
5894
__Pyx_RefNannySetupContext("__set__");
5895
__Pyx_INCREF(__pyx_v_value);
5896
__Pyx_GIVEREF(__pyx_v_value);
5897
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
5898
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
5899
((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes = __pyx_v_value;
5902
__Pyx_RefNannyFinishContext();
5906
static int __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_6_nodes_2__del__(PyObject *__pyx_v_self); /*proto*/
5907
static int __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_6_nodes_2__del__(PyObject *__pyx_v_self) {
5909
__Pyx_RefNannySetupContext("__del__");
5910
__Pyx_INCREF(Py_None);
5911
__Pyx_GIVEREF(Py_None);
5912
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
5913
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes);
5914
((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_nodes = Py_None;
5917
__Pyx_RefNannyFinishContext();
5921
/* "bzrlib/_known_graph_pyx.pyx":196
5923
* cdef public object _nodes
5924
* cdef public object _known_heads # <<<<<<<<<<<<<<
5925
* cdef public int do_cache
5929
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_12_known_heads___get__(PyObject *__pyx_v_self); /*proto*/
5930
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_12_known_heads___get__(PyObject *__pyx_v_self) {
5931
PyObject *__pyx_r = NULL;
5932
__Pyx_RefNannySetupContext("__get__");
5933
__Pyx_XDECREF(__pyx_r);
5934
__Pyx_INCREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads);
5935
__pyx_r = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads;
5938
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
5940
__Pyx_XGIVEREF(__pyx_r);
5941
__Pyx_RefNannyFinishContext();
5945
static int __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_12_known_heads_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
5946
static int __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_12_known_heads_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
5948
__Pyx_RefNannySetupContext("__set__");
5949
__Pyx_INCREF(__pyx_v_value);
5950
__Pyx_GIVEREF(__pyx_v_value);
5951
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads);
5952
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads);
5953
((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads = __pyx_v_value;
5956
__Pyx_RefNannyFinishContext();
5960
static int __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_12_known_heads_2__del__(PyObject *__pyx_v_self); /*proto*/
5961
static int __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_12_known_heads_2__del__(PyObject *__pyx_v_self) {
5963
__Pyx_RefNannySetupContext("__del__");
5964
__Pyx_INCREF(Py_None);
5965
__Pyx_GIVEREF(Py_None);
5966
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads);
5967
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads);
5968
((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->_known_heads = Py_None;
5971
__Pyx_RefNannyFinishContext();
5975
/* "bzrlib/_known_graph_pyx.pyx":197
5976
* cdef public object _nodes
5977
* cdef public object _known_heads
5978
* cdef public int do_cache # <<<<<<<<<<<<<<
5980
* def __init__(self, parent_map, do_cache=True):
5983
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_8do_cache___get__(PyObject *__pyx_v_self); /*proto*/
5984
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_8do_cache___get__(PyObject *__pyx_v_self) {
5985
PyObject *__pyx_r = NULL;
5986
PyObject *__pyx_t_1 = NULL;
5987
__Pyx_RefNannySetupContext("__get__");
5988
__Pyx_XDECREF(__pyx_r);
5989
__pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->do_cache); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
5990
__Pyx_GOTREF(__pyx_t_1);
5991
__pyx_r = __pyx_t_1;
5995
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
5998
__Pyx_XDECREF(__pyx_t_1);
5999
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.do_cache.__get__");
6002
__Pyx_XGIVEREF(__pyx_r);
6003
__Pyx_RefNannyFinishContext();
6007
static int __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_8do_cache_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
6008
static int __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_8do_cache_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
6011
__Pyx_RefNannySetupContext("__set__");
6012
__pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6013
((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_self)->do_cache = __pyx_t_1;
6018
__Pyx_AddTraceback("bzrlib._known_graph_pyx.KnownGraph.do_cache.__set__");
6021
__Pyx_RefNannyFinishContext();
6025
/* "bzrlib/_known_graph_pyx.pyx":686
6026
* cdef int completed # Fully Processed
6028
* def __init__(self, key): # <<<<<<<<<<<<<<
6030
* self.merge_depth = -1
6033
static int __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6034
static int __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6035
PyObject *__pyx_v_key = 0;
6037
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,0};
6038
__Pyx_RefNannySetupContext("__init__");
6039
if (unlikely(__pyx_kwds)) {
6040
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
6041
PyObject* values[1] = {0};
6042
switch (PyTuple_GET_SIZE(__pyx_args)) {
6043
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6045
default: goto __pyx_L5_argtuple_error;
6047
switch (PyTuple_GET_SIZE(__pyx_args)) {
6049
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
6050
if (likely(values[0])) kw_args--;
6051
else goto __pyx_L5_argtuple_error;
6053
if (unlikely(kw_args > 0)) {
6054
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6056
__pyx_v_key = values[0];
6057
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
6058
goto __pyx_L5_argtuple_error;
6060
__pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
6062
goto __pyx_L4_argument_unpacking_done;
6063
__pyx_L5_argtuple_error:;
6064
__Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6066
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSortNode.__init__");
6067
__Pyx_RefNannyFinishContext();
6069
__pyx_L4_argument_unpacking_done:;
6071
/* "bzrlib/_known_graph_pyx.pyx":687
6073
* def __init__(self, key):
6074
* self.key = key # <<<<<<<<<<<<<<
6075
* self.merge_depth = -1
6076
* self.left_parent = None
6078
__Pyx_INCREF(__pyx_v_key);
6079
__Pyx_GIVEREF(__pyx_v_key);
6080
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key);
6081
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key);
6082
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key = __pyx_v_key;
6084
/* "bzrlib/_known_graph_pyx.pyx":688
6085
* def __init__(self, key):
6087
* self.merge_depth = -1 # <<<<<<<<<<<<<<
6088
* self.left_parent = None
6089
* self.left_pending_parent = None
6091
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->merge_depth = -1;
6093
/* "bzrlib/_known_graph_pyx.pyx":689
6095
* self.merge_depth = -1
6096
* self.left_parent = None # <<<<<<<<<<<<<<
6097
* self.left_pending_parent = None
6098
* self.pending_parents = None
6100
__Pyx_INCREF(Py_None);
6101
__Pyx_GIVEREF(Py_None);
6102
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->left_parent);
6103
__Pyx_DECREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->left_parent));
6104
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->left_parent = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None);
6106
/* "bzrlib/_known_graph_pyx.pyx":690
6107
* self.merge_depth = -1
6108
* self.left_parent = None
6109
* self.left_pending_parent = None # <<<<<<<<<<<<<<
6110
* self.pending_parents = None
6111
* self._revno_first = -1
6113
__Pyx_INCREF(Py_None);
6114
__Pyx_GIVEREF(Py_None);
6115
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->left_pending_parent);
6116
__Pyx_DECREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->left_pending_parent));
6117
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->left_pending_parent = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None);
6119
/* "bzrlib/_known_graph_pyx.pyx":691
6120
* self.left_parent = None
6121
* self.left_pending_parent = None
6122
* self.pending_parents = None # <<<<<<<<<<<<<<
6123
* self._revno_first = -1
6124
* self._revno_second = -1
6126
__Pyx_INCREF(Py_None);
6127
__Pyx_GIVEREF(Py_None);
6128
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->pending_parents);
6129
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->pending_parents);
6130
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->pending_parents = Py_None;
6132
/* "bzrlib/_known_graph_pyx.pyx":692
6133
* self.left_pending_parent = None
6134
* self.pending_parents = None
6135
* self._revno_first = -1 # <<<<<<<<<<<<<<
6136
* self._revno_second = -1
6137
* self._revno_last = -1
6139
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->_revno_first = -1;
6141
/* "bzrlib/_known_graph_pyx.pyx":693
6142
* self.pending_parents = None
6143
* self._revno_first = -1
6144
* self._revno_second = -1 # <<<<<<<<<<<<<<
6145
* self._revno_last = -1
6146
* self.is_first_child = 0
6148
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->_revno_second = -1;
6150
/* "bzrlib/_known_graph_pyx.pyx":694
6151
* self._revno_first = -1
6152
* self._revno_second = -1
6153
* self._revno_last = -1 # <<<<<<<<<<<<<<
6154
* self.is_first_child = 0
6155
* self.seen_by_child = 0
6157
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->_revno_last = -1;
6159
/* "bzrlib/_known_graph_pyx.pyx":695
6160
* self._revno_second = -1
6161
* self._revno_last = -1
6162
* self.is_first_child = 0 # <<<<<<<<<<<<<<
6163
* self.seen_by_child = 0
6164
* self.completed = 0
6166
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->is_first_child = 0;
6168
/* "bzrlib/_known_graph_pyx.pyx":696
6169
* self._revno_last = -1
6170
* self.is_first_child = 0
6171
* self.seen_by_child = 0 # <<<<<<<<<<<<<<
6172
* self.completed = 0
6175
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->seen_by_child = 0;
6177
/* "bzrlib/_known_graph_pyx.pyx":697
6178
* self.is_first_child = 0
6179
* self.seen_by_child = 0
6180
* self.completed = 0 # <<<<<<<<<<<<<<
6182
* def __repr__(self):
6184
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->completed = 0;
6187
__Pyx_RefNannyFinishContext();
6191
/* "bzrlib/_known_graph_pyx.pyx":699
6192
* self.completed = 0
6194
* def __repr__(self): # <<<<<<<<<<<<<<
6195
* return '%s(%s depth:%s rev:%s,%s,%s first:%s seen:%s)' % (
6196
* self.__class__.__name__, self.key,
6199
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_1__repr__(PyObject *__pyx_v_self); /*proto*/
6200
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_1__repr__(PyObject *__pyx_v_self) {
6201
PyObject *__pyx_r = NULL;
6202
PyObject *__pyx_t_1 = NULL;
6203
PyObject *__pyx_t_2 = NULL;
6204
PyObject *__pyx_t_3 = NULL;
6205
PyObject *__pyx_t_4 = NULL;
6206
PyObject *__pyx_t_5 = NULL;
6207
PyObject *__pyx_t_6 = NULL;
6208
PyObject *__pyx_t_7 = NULL;
6209
PyObject *__pyx_t_8 = NULL;
6210
__Pyx_RefNannySetupContext("__repr__");
6212
/* "bzrlib/_known_graph_pyx.pyx":700
6214
* def __repr__(self):
6215
* return '%s(%s depth:%s rev:%s,%s,%s first:%s seen:%s)' % ( # <<<<<<<<<<<<<<
6216
* self.__class__.__name__, self.key,
6219
__Pyx_XDECREF(__pyx_r);
6221
/* "bzrlib/_known_graph_pyx.pyx":701
6222
* def __repr__(self):
6223
* return '%s(%s depth:%s rev:%s,%s,%s first:%s seen:%s)' % (
6224
* self.__class__.__name__, self.key, # <<<<<<<<<<<<<<
6226
* self._revno_first, self._revno_second, self._revno_last,
6228
__pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6229
__Pyx_GOTREF(__pyx_t_1);
6230
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6231
__Pyx_GOTREF(__pyx_t_2);
6232
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6234
/* "bzrlib/_known_graph_pyx.pyx":702
6235
* return '%s(%s depth:%s rev:%s,%s,%s first:%s seen:%s)' % (
6236
* self.__class__.__name__, self.key,
6237
* self.merge_depth, # <<<<<<<<<<<<<<
6238
* self._revno_first, self._revno_second, self._revno_last,
6239
* self.is_first_child, self.seen_by_child)
6241
__pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->merge_depth); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6242
__Pyx_GOTREF(__pyx_t_1);
6244
/* "bzrlib/_known_graph_pyx.pyx":703
6245
* self.__class__.__name__, self.key,
6247
* self._revno_first, self._revno_second, self._revno_last, # <<<<<<<<<<<<<<
6248
* self.is_first_child, self.seen_by_child)
6251
__pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->_revno_first); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6252
__Pyx_GOTREF(__pyx_t_3);
6253
__pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->_revno_second); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6254
__Pyx_GOTREF(__pyx_t_4);
6255
__pyx_t_5 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->_revno_last); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6256
__Pyx_GOTREF(__pyx_t_5);
6258
/* "bzrlib/_known_graph_pyx.pyx":704
6260
* self._revno_first, self._revno_second, self._revno_last,
6261
* self.is_first_child, self.seen_by_child) # <<<<<<<<<<<<<<
6263
* cdef int has_pending_parents(self): # cannot_raise
6265
__pyx_t_6 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->is_first_child); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6266
__Pyx_GOTREF(__pyx_t_6);
6267
__pyx_t_7 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->seen_by_child); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6268
__Pyx_GOTREF(__pyx_t_7);
6269
__pyx_t_8 = PyTuple_New(8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6270
__Pyx_GOTREF(((PyObject *)__pyx_t_8));
6271
PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
6272
__Pyx_GIVEREF(__pyx_t_2);
6273
__Pyx_INCREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key);
6274
PyTuple_SET_ITEM(__pyx_t_8, 1, ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key);
6275
__Pyx_GIVEREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key);
6276
PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1);
6277
__Pyx_GIVEREF(__pyx_t_1);
6278
PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_3);
6279
__Pyx_GIVEREF(__pyx_t_3);
6280
PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_4);
6281
__Pyx_GIVEREF(__pyx_t_4);
6282
PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_5);
6283
__Pyx_GIVEREF(__pyx_t_5);
6284
PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_t_6);
6285
__Pyx_GIVEREF(__pyx_t_6);
6286
PyTuple_SET_ITEM(__pyx_t_8, 7, __pyx_t_7);
6287
__Pyx_GIVEREF(__pyx_t_7);
6295
__pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6296
__Pyx_GOTREF(((PyObject *)__pyx_t_7));
6297
__Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
6298
__pyx_r = ((PyObject *)__pyx_t_7);
6302
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
6305
__Pyx_XDECREF(__pyx_t_1);
6306
__Pyx_XDECREF(__pyx_t_2);
6307
__Pyx_XDECREF(__pyx_t_3);
6308
__Pyx_XDECREF(__pyx_t_4);
6309
__Pyx_XDECREF(__pyx_t_5);
6310
__Pyx_XDECREF(__pyx_t_6);
6311
__Pyx_XDECREF(__pyx_t_7);
6312
__Pyx_XDECREF(__pyx_t_8);
6313
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSortNode.__repr__");
6316
__Pyx_XGIVEREF(__pyx_r);
6317
__Pyx_RefNannyFinishContext();
6321
/* "bzrlib/_known_graph_pyx.pyx":706
6322
* self.is_first_child, self.seen_by_child)
6324
* cdef int has_pending_parents(self): # cannot_raise # <<<<<<<<<<<<<<
6325
* if self.left_pending_parent is not None or self.pending_parents:
6329
static int __pyx_f_6bzrlib_16_known_graph_pyx_14_MergeSortNode_has_pending_parents(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_v_self) {
6334
__Pyx_RefNannySetupContext("has_pending_parents");
6336
/* "bzrlib/_known_graph_pyx.pyx":707
6338
* cdef int has_pending_parents(self): # cannot_raise
6339
* if self.left_pending_parent is not None or self.pending_parents: # <<<<<<<<<<<<<<
6343
__pyx_t_1 = (((PyObject *)__pyx_v_self->left_pending_parent) != Py_None);
6345
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->pending_parents); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6346
__pyx_t_3 = __pyx_t_2;
6348
__pyx_t_3 = __pyx_t_1;
6352
/* "bzrlib/_known_graph_pyx.pyx":708
6353
* cdef int has_pending_parents(self): # cannot_raise
6354
* if self.left_pending_parent is not None or self.pending_parents:
6355
* return 1 # <<<<<<<<<<<<<<
6365
/* "bzrlib/_known_graph_pyx.pyx":709
6366
* if self.left_pending_parent is not None or self.pending_parents:
6368
* return 0 # <<<<<<<<<<<<<<
6370
* cdef object _revno(self):
6378
__Pyx_WriteUnraisable("bzrlib._known_graph_pyx._MergeSortNode.has_pending_parents");
6381
__Pyx_RefNannyFinishContext();
6385
/* "bzrlib/_known_graph_pyx.pyx":711
6388
* cdef object _revno(self): # <<<<<<<<<<<<<<
6389
* if self._revno_first == -1:
6390
* if self._revno_second != -1:
6393
static PyObject *__pyx_f_6bzrlib_16_known_graph_pyx_14_MergeSortNode__revno(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_v_self) {
6394
PyObject *__pyx_r = NULL;
6396
PyObject *__pyx_t_2 = NULL;
6397
PyObject *__pyx_t_3 = NULL;
6398
PyObject *__pyx_t_4 = NULL;
6399
PyObject *__pyx_t_5 = NULL;
6400
__Pyx_RefNannySetupContext("_revno");
6402
/* "bzrlib/_known_graph_pyx.pyx":712
6404
* cdef object _revno(self):
6405
* if self._revno_first == -1: # <<<<<<<<<<<<<<
6406
* if self._revno_second != -1:
6407
* raise RuntimeError('Something wrong with: %s' % (self,))
6409
__pyx_t_1 = (__pyx_v_self->_revno_first == -1);
6412
/* "bzrlib/_known_graph_pyx.pyx":713
6413
* cdef object _revno(self):
6414
* if self._revno_first == -1:
6415
* if self._revno_second != -1: # <<<<<<<<<<<<<<
6416
* raise RuntimeError('Something wrong with: %s' % (self,))
6417
* return (self._revno_last,)
6419
__pyx_t_1 = (__pyx_v_self->_revno_second != -1);
6422
/* "bzrlib/_known_graph_pyx.pyx":714
6423
* if self._revno_first == -1:
6424
* if self._revno_second != -1:
6425
* raise RuntimeError('Something wrong with: %s' % (self,)) # <<<<<<<<<<<<<<
6426
* return (self._revno_last,)
6429
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6430
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
6431
__Pyx_INCREF(((PyObject *)__pyx_v_self));
6432
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
6433
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
6434
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6435
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
6436
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6437
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6438
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
6439
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
6440
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
6442
__pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6443
__Pyx_GOTREF(__pyx_t_3);
6444
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6445
__Pyx_Raise(__pyx_t_3, 0, 0);
6446
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6447
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6452
/* "bzrlib/_known_graph_pyx.pyx":715
6453
* if self._revno_second != -1:
6454
* raise RuntimeError('Something wrong with: %s' % (self,))
6455
* return (self._revno_last,) # <<<<<<<<<<<<<<
6457
* return (self._revno_first, self._revno_second, self._revno_last)
6459
__Pyx_XDECREF(__pyx_r);
6460
__pyx_t_3 = PyInt_FromLong(__pyx_v_self->_revno_last); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6461
__Pyx_GOTREF(__pyx_t_3);
6462
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6463
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
6464
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
6465
__Pyx_GIVEREF(__pyx_t_3);
6467
__pyx_r = ((PyObject *)__pyx_t_2);
6474
/* "bzrlib/_known_graph_pyx.pyx":717
6475
* return (self._revno_last,)
6477
* return (self._revno_first, self._revno_second, self._revno_last) # <<<<<<<<<<<<<<
6481
__Pyx_XDECREF(__pyx_r);
6482
__pyx_t_2 = PyInt_FromLong(__pyx_v_self->_revno_first); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6483
__Pyx_GOTREF(__pyx_t_2);
6484
__pyx_t_3 = PyInt_FromLong(__pyx_v_self->_revno_second); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6485
__Pyx_GOTREF(__pyx_t_3);
6486
__pyx_t_4 = PyInt_FromLong(__pyx_v_self->_revno_last); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6487
__Pyx_GOTREF(__pyx_t_4);
6488
__pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6489
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
6490
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
6491
__Pyx_GIVEREF(__pyx_t_2);
6492
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
6493
__Pyx_GIVEREF(__pyx_t_3);
6494
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
6495
__Pyx_GIVEREF(__pyx_t_4);
6499
__pyx_r = ((PyObject *)__pyx_t_5);
6505
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
6508
__Pyx_XDECREF(__pyx_t_2);
6509
__Pyx_XDECREF(__pyx_t_3);
6510
__Pyx_XDECREF(__pyx_t_4);
6511
__Pyx_XDECREF(__pyx_t_5);
6512
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSortNode._revno");
6515
__Pyx_XGIVEREF(__pyx_r);
6516
__Pyx_RefNannyFinishContext();
6520
/* "bzrlib/_known_graph_pyx.pyx":720
6523
* def __get__(self): # <<<<<<<<<<<<<<
6524
* return self._revno()
6528
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_5revno___get__(PyObject *__pyx_v_self); /*proto*/
6529
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_5revno___get__(PyObject *__pyx_v_self) {
6530
PyObject *__pyx_r = NULL;
6531
PyObject *__pyx_t_1 = NULL;
6532
__Pyx_RefNannySetupContext("__get__");
6534
/* "bzrlib/_known_graph_pyx.pyx":721
6536
* def __get__(self):
6537
* return self._revno() # <<<<<<<<<<<<<<
6541
__Pyx_XDECREF(__pyx_r);
6542
__pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSortNode *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->__pyx_vtab)->_revno(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6543
__Pyx_GOTREF(__pyx_t_1);
6544
__pyx_r = __pyx_t_1;
6548
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
6551
__Pyx_XDECREF(__pyx_t_1);
6552
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSortNode.revno.__get__");
6555
__Pyx_XGIVEREF(__pyx_r);
6556
__Pyx_RefNannyFinishContext();
6560
/* "bzrlib/_known_graph_pyx.pyx":670
6563
* cdef public object key # <<<<<<<<<<<<<<
6564
* cdef public long merge_depth
6565
* cdef public object end_of_merge # True/False Is this the end of the current merge
6568
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_3key___get__(PyObject *__pyx_v_self); /*proto*/
6569
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_3key___get__(PyObject *__pyx_v_self) {
6570
PyObject *__pyx_r = NULL;
6571
__Pyx_RefNannySetupContext("__get__");
6572
__Pyx_XDECREF(__pyx_r);
6573
__Pyx_INCREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key);
6574
__pyx_r = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key;
6577
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
6579
__Pyx_XGIVEREF(__pyx_r);
6580
__Pyx_RefNannyFinishContext();
6584
static int __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_3key_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
6585
static int __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_3key_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
6587
__Pyx_RefNannySetupContext("__set__");
6588
__Pyx_INCREF(__pyx_v_value);
6589
__Pyx_GIVEREF(__pyx_v_value);
6590
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key);
6591
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key);
6592
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key = __pyx_v_value;
6595
__Pyx_RefNannyFinishContext();
6599
static int __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_3key_2__del__(PyObject *__pyx_v_self); /*proto*/
6600
static int __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_3key_2__del__(PyObject *__pyx_v_self) {
6602
__Pyx_RefNannySetupContext("__del__");
6603
__Pyx_INCREF(Py_None);
6604
__Pyx_GIVEREF(Py_None);
6605
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key);
6606
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key);
6607
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->key = Py_None;
6610
__Pyx_RefNannyFinishContext();
6614
/* "bzrlib/_known_graph_pyx.pyx":671
6616
* cdef public object key
6617
* cdef public long merge_depth # <<<<<<<<<<<<<<
6618
* cdef public object end_of_merge # True/False Is this the end of the current merge
6622
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_11merge_depth___get__(PyObject *__pyx_v_self); /*proto*/
6623
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_11merge_depth___get__(PyObject *__pyx_v_self) {
6624
PyObject *__pyx_r = NULL;
6625
PyObject *__pyx_t_1 = NULL;
6626
__Pyx_RefNannySetupContext("__get__");
6627
__Pyx_XDECREF(__pyx_r);
6628
__pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->merge_depth); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6629
__Pyx_GOTREF(__pyx_t_1);
6630
__pyx_r = __pyx_t_1;
6634
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
6637
__Pyx_XDECREF(__pyx_t_1);
6638
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSortNode.merge_depth.__get__");
6641
__Pyx_XGIVEREF(__pyx_r);
6642
__Pyx_RefNannyFinishContext();
6646
static int __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_11merge_depth_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
6647
static int __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_11merge_depth_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
6650
__Pyx_RefNannySetupContext("__set__");
6651
__pyx_t_1 = __Pyx_PyInt_AsLong(__pyx_v_value); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6652
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->merge_depth = __pyx_t_1;
6657
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSortNode.merge_depth.__set__");
6660
__Pyx_RefNannyFinishContext();
6664
/* "bzrlib/_known_graph_pyx.pyx":672
6665
* cdef public object key
6666
* cdef public long merge_depth
6667
* cdef public object end_of_merge # True/False Is this the end of the current merge # <<<<<<<<<<<<<<
6669
* # Private api, used while computing the information
6672
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_12end_of_merge___get__(PyObject *__pyx_v_self); /*proto*/
6673
static PyObject *__pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_12end_of_merge___get__(PyObject *__pyx_v_self) {
6674
PyObject *__pyx_r = NULL;
6675
__Pyx_RefNannySetupContext("__get__");
6676
__Pyx_XDECREF(__pyx_r);
6677
__Pyx_INCREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->end_of_merge);
6678
__pyx_r = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->end_of_merge;
6681
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
6683
__Pyx_XGIVEREF(__pyx_r);
6684
__Pyx_RefNannyFinishContext();
6688
static int __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_12end_of_merge_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
6689
static int __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_12end_of_merge_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
6691
__Pyx_RefNannySetupContext("__set__");
6692
__Pyx_INCREF(__pyx_v_value);
6693
__Pyx_GIVEREF(__pyx_v_value);
6694
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->end_of_merge);
6695
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->end_of_merge);
6696
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->end_of_merge = __pyx_v_value;
6699
__Pyx_RefNannyFinishContext();
6703
static int __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_12end_of_merge_2__del__(PyObject *__pyx_v_self); /*proto*/
6704
static int __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_12end_of_merge_2__del__(PyObject *__pyx_v_self) {
6706
__Pyx_RefNannySetupContext("__del__");
6707
__Pyx_INCREF(Py_None);
6708
__Pyx_GIVEREF(Py_None);
6709
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->end_of_merge);
6710
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->end_of_merge);
6711
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_self)->end_of_merge = Py_None;
6714
__Pyx_RefNannyFinishContext();
6718
/* "bzrlib/_known_graph_pyx.pyx":743
6719
* cdef object _scheduled_nodes # List of nodes ready to be yielded
6721
* def __init__(self, known_graph, tip_key): # <<<<<<<<<<<<<<
6722
* cdef _KnownGraphNode node
6726
static int __pyx_pf_6bzrlib_16_known_graph_pyx_12_MergeSorter___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6727
static int __pyx_pf_6bzrlib_16_known_graph_pyx_12_MergeSorter___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6728
PyObject *__pyx_v_known_graph = 0;
6729
PyObject *__pyx_v_tip_key = 0;
6730
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
6732
PyObject *__pyx_t_1 = NULL;
6735
PyObject *__pyx_t_4 = NULL;
6738
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__known_graph,&__pyx_n_s__tip_key,0};
6739
__Pyx_RefNannySetupContext("__init__");
6740
if (unlikely(__pyx_kwds)) {
6741
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
6742
PyObject* values[2] = {0,0};
6743
switch (PyTuple_GET_SIZE(__pyx_args)) {
6744
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6745
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6747
default: goto __pyx_L5_argtuple_error;
6749
switch (PyTuple_GET_SIZE(__pyx_args)) {
6751
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__known_graph);
6752
if (likely(values[0])) kw_args--;
6753
else goto __pyx_L5_argtuple_error;
6755
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tip_key);
6756
if (likely(values[1])) kw_args--;
6758
__Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6761
if (unlikely(kw_args > 0)) {
6762
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6764
__pyx_v_known_graph = values[0];
6765
__pyx_v_tip_key = values[1];
6766
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
6767
goto __pyx_L5_argtuple_error;
6769
__pyx_v_known_graph = PyTuple_GET_ITEM(__pyx_args, 0);
6770
__pyx_v_tip_key = PyTuple_GET_ITEM(__pyx_args, 1);
6772
goto __pyx_L4_argument_unpacking_done;
6773
__pyx_L5_argtuple_error:;
6774
__Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
6776
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSorter.__init__");
6777
__Pyx_RefNannyFinishContext();
6779
__pyx_L4_argument_unpacking_done:;
6780
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
6782
/* "bzrlib/_known_graph_pyx.pyx":746
6783
* cdef _KnownGraphNode node
6785
* self.graph = known_graph # <<<<<<<<<<<<<<
6786
* # self._ms_nodes = {}
6787
* self._revno_to_branch_count = {}
6789
if (!(likely(((__pyx_v_known_graph) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_known_graph, __pyx_ptype_6bzrlib_16_known_graph_pyx_KnownGraph))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6790
__Pyx_INCREF(__pyx_v_known_graph);
6791
__Pyx_GIVEREF(__pyx_v_known_graph);
6792
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->graph);
6793
__Pyx_DECREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->graph));
6794
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->graph = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)__pyx_v_known_graph);
6796
/* "bzrlib/_known_graph_pyx.pyx":748
6797
* self.graph = known_graph
6798
* # self._ms_nodes = {}
6799
* self._revno_to_branch_count = {} # <<<<<<<<<<<<<<
6800
* self._depth_first_stack = []
6801
* self._last_stack_item = -1
6803
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6804
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
6805
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
6806
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->_revno_to_branch_count);
6807
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->_revno_to_branch_count);
6808
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->_revno_to_branch_count = ((PyObject *)__pyx_t_1);
6811
/* "bzrlib/_known_graph_pyx.pyx":749
6812
* # self._ms_nodes = {}
6813
* self._revno_to_branch_count = {}
6814
* self._depth_first_stack = [] # <<<<<<<<<<<<<<
6815
* self._last_stack_item = -1
6816
* self._scheduled_nodes = []
6818
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6819
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
6820
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
6821
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->_depth_first_stack);
6822
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->_depth_first_stack);
6823
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->_depth_first_stack = ((PyObject *)__pyx_t_1);
6826
/* "bzrlib/_known_graph_pyx.pyx":750
6827
* self._revno_to_branch_count = {}
6828
* self._depth_first_stack = []
6829
* self._last_stack_item = -1 # <<<<<<<<<<<<<<
6830
* self._scheduled_nodes = []
6831
* if (tip_key is not None and tip_key != NULL_REVISION
6833
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->_last_stack_item = -1;
6835
/* "bzrlib/_known_graph_pyx.pyx":751
6836
* self._depth_first_stack = []
6837
* self._last_stack_item = -1
6838
* self._scheduled_nodes = [] # <<<<<<<<<<<<<<
6839
* if (tip_key is not None and tip_key != NULL_REVISION
6840
* and tip_key != (NULL_REVISION,)):
6842
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6843
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
6844
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
6845
__Pyx_GOTREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->_scheduled_nodes);
6846
__Pyx_DECREF(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->_scheduled_nodes);
6847
((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->_scheduled_nodes = ((PyObject *)__pyx_t_1);
6850
/* "bzrlib/_known_graph_pyx.pyx":752
6851
* self._last_stack_item = -1
6852
* self._scheduled_nodes = []
6853
* if (tip_key is not None and tip_key != NULL_REVISION # <<<<<<<<<<<<<<
6854
* and tip_key != (NULL_REVISION,)):
6855
* node = self.graph._nodes[tip_key]
6857
__pyx_t_2 = (__pyx_v_tip_key != Py_None);
6860
/* "bzrlib/_known_graph_pyx.pyx":753
6861
* self._scheduled_nodes = []
6862
* if (tip_key is not None and tip_key != NULL_REVISION
6863
* and tip_key != (NULL_REVISION,)): # <<<<<<<<<<<<<<
6864
* node = self.graph._nodes[tip_key]
6865
* self._push_node(node, 0)
6867
__pyx_t_1 = PyObject_RichCompare(__pyx_v_tip_key, __pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6868
__Pyx_GOTREF(__pyx_t_1);
6869
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6870
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6872
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6873
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
6874
__Pyx_INCREF(__pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION);
6875
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION);
6876
__Pyx_GIVEREF(__pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION);
6877
__pyx_t_4 = PyObject_RichCompare(__pyx_v_tip_key, ((PyObject *)__pyx_t_1), Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6878
__Pyx_GOTREF(__pyx_t_4);
6879
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
6880
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6881
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6882
__pyx_t_6 = __pyx_t_5;
6884
__pyx_t_6 = __pyx_t_3;
6886
__pyx_t_3 = __pyx_t_6;
6888
__pyx_t_3 = __pyx_t_2;
6892
/* "bzrlib/_known_graph_pyx.pyx":754
6893
* if (tip_key is not None and tip_key != NULL_REVISION
6894
* and tip_key != (NULL_REVISION,)):
6895
* node = self.graph._nodes[tip_key] # <<<<<<<<<<<<<<
6896
* self._push_node(node, 0)
6899
__pyx_t_4 = PyObject_GetItem(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->graph->_nodes, __pyx_v_tip_key); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6900
__Pyx_GOTREF(__pyx_t_4);
6901
if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6902
__Pyx_DECREF(((PyObject *)__pyx_v_node));
6903
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_4);
6906
/* "bzrlib/_known_graph_pyx.pyx":755
6907
* and tip_key != (NULL_REVISION,)):
6908
* node = self.graph._nodes[tip_key]
6909
* self._push_node(node, 0) # <<<<<<<<<<<<<<
6911
* cdef _MergeSortNode _get_ms_node(self, _KnownGraphNode node):
6913
__pyx_t_4 = ((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSorter *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self)->__pyx_vtab)->_push_node(((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self), __pyx_v_node, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6914
__Pyx_GOTREF(__pyx_t_4);
6915
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6923
__Pyx_XDECREF(__pyx_t_1);
6924
__Pyx_XDECREF(__pyx_t_4);
6925
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSorter.__init__");
6928
__Pyx_DECREF((PyObject *)__pyx_v_node);
6929
__Pyx_RefNannyFinishContext();
6933
/* "bzrlib/_known_graph_pyx.pyx":757
6934
* self._push_node(node, 0)
6936
* cdef _MergeSortNode _get_ms_node(self, _KnownGraphNode node): # <<<<<<<<<<<<<<
6937
* cdef PyObject *temp_node
6938
* cdef _MergeSortNode ms_node
6941
static struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_f_6bzrlib_16_known_graph_pyx_12_MergeSorter__get_ms_node(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *__pyx_v_self, struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node) {
6942
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_v_ms_node;
6943
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_r = NULL;
6945
PyObject *__pyx_t_2 = NULL;
6946
PyObject *__pyx_t_3 = NULL;
6947
__Pyx_RefNannySetupContext("_get_ms_node");
6948
__pyx_v_ms_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)Py_None); __Pyx_INCREF(Py_None);
6950
/* "bzrlib/_known_graph_pyx.pyx":761
6951
* cdef _MergeSortNode ms_node
6953
* if node.extra is None: # <<<<<<<<<<<<<<
6954
* ms_node = _MergeSortNode(node.key)
6955
* node.extra = ms_node
6957
__pyx_t_1 = (__pyx_v_node->extra == Py_None);
6960
/* "bzrlib/_known_graph_pyx.pyx":762
6962
* if node.extra is None:
6963
* ms_node = _MergeSortNode(node.key) # <<<<<<<<<<<<<<
6964
* node.extra = ms_node
6967
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6968
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
6969
__Pyx_INCREF(__pyx_v_node->key);
6970
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_node->key);
6971
__Pyx_GIVEREF(__pyx_v_node->key);
6972
__pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_16_known_graph_pyx__MergeSortNode)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
6973
__Pyx_GOTREF(__pyx_t_3);
6974
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
6975
__Pyx_DECREF(((PyObject *)__pyx_v_ms_node));
6976
__pyx_v_ms_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_t_3);
6979
/* "bzrlib/_known_graph_pyx.pyx":763
6980
* if node.extra is None:
6981
* ms_node = _MergeSortNode(node.key)
6982
* node.extra = ms_node # <<<<<<<<<<<<<<
6984
* ms_node = <_MergeSortNode>node.extra
6986
__Pyx_INCREF(((PyObject *)__pyx_v_ms_node));
6987
__Pyx_GIVEREF(((PyObject *)__pyx_v_ms_node));
6988
__Pyx_GOTREF(__pyx_v_node->extra);
6989
__Pyx_DECREF(__pyx_v_node->extra);
6990
__pyx_v_node->extra = ((PyObject *)__pyx_v_ms_node);
6995
/* "bzrlib/_known_graph_pyx.pyx":765
6996
* node.extra = ms_node
6998
* ms_node = <_MergeSortNode>node.extra # <<<<<<<<<<<<<<
7002
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_node->extra)));
7003
__Pyx_DECREF(((PyObject *)__pyx_v_ms_node));
7004
__pyx_v_ms_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_node->extra);
7008
/* "bzrlib/_known_graph_pyx.pyx":766
7010
* ms_node = <_MergeSortNode>node.extra
7011
* return ms_node # <<<<<<<<<<<<<<
7013
* cdef _push_node(self, _KnownGraphNode node, long merge_depth):
7015
__Pyx_XDECREF(((PyObject *)__pyx_r));
7016
__Pyx_INCREF(((PyObject *)__pyx_v_ms_node));
7017
__pyx_r = __pyx_v_ms_node;
7020
__pyx_r = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)Py_None); __Pyx_INCREF(Py_None);
7023
__Pyx_XDECREF(__pyx_t_2);
7024
__Pyx_XDECREF(__pyx_t_3);
7025
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSorter._get_ms_node");
7028
__Pyx_DECREF((PyObject *)__pyx_v_ms_node);
7029
__Pyx_XGIVEREF((PyObject *)__pyx_r);
7030
__Pyx_RefNannyFinishContext();
7034
/* "bzrlib/_known_graph_pyx.pyx":768
7037
* cdef _push_node(self, _KnownGraphNode node, long merge_depth): # <<<<<<<<<<<<<<
7038
* cdef _KnownGraphNode parent_node
7039
* cdef _MergeSortNode ms_node, ms_parent_node
7042
static PyObject *__pyx_f_6bzrlib_16_known_graph_pyx_12_MergeSorter__push_node(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *__pyx_v_self, struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node, long __pyx_v_merge_depth) {
7043
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_parent_node;
7044
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_v_ms_node;
7045
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_v_ms_parent_node;
7046
Py_ssize_t __pyx_v_pos;
7047
PyObject *__pyx_r = NULL;
7048
PyObject *__pyx_t_1 = NULL;
7050
PyObject *__pyx_t_3 = NULL;
7051
Py_ssize_t __pyx_t_4;
7053
__Pyx_RefNannySetupContext("_push_node");
7054
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
7055
__pyx_v_ms_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)Py_None); __Pyx_INCREF(Py_None);
7056
__pyx_v_ms_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)Py_None); __Pyx_INCREF(Py_None);
7058
/* "bzrlib/_known_graph_pyx.pyx":773
7059
* cdef Py_ssize_t pos
7061
* ms_node = self._get_ms_node(node) # <<<<<<<<<<<<<<
7062
* ms_node.merge_depth = merge_depth
7063
* if node.parents is None:
7065
__pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self->__pyx_vtab)->_get_ms_node(__pyx_v_self, __pyx_v_node)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7066
__Pyx_GOTREF(__pyx_t_1);
7067
__Pyx_DECREF(((PyObject *)__pyx_v_ms_node));
7068
__pyx_v_ms_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_t_1);
7071
/* "bzrlib/_known_graph_pyx.pyx":774
7073
* ms_node = self._get_ms_node(node)
7074
* ms_node.merge_depth = merge_depth # <<<<<<<<<<<<<<
7075
* if node.parents is None:
7076
* raise RuntimeError('ghost nodes should not be pushed'
7078
__pyx_v_ms_node->merge_depth = __pyx_v_merge_depth;
7080
/* "bzrlib/_known_graph_pyx.pyx":775
7081
* ms_node = self._get_ms_node(node)
7082
* ms_node.merge_depth = merge_depth
7083
* if node.parents is None: # <<<<<<<<<<<<<<
7084
* raise RuntimeError('ghost nodes should not be pushed'
7085
* ' onto the stack: %s' % (node,))
7087
__pyx_t_2 = (__pyx_v_node->parents == Py_None);
7090
/* "bzrlib/_known_graph_pyx.pyx":777
7091
* if node.parents is None:
7092
* raise RuntimeError('ghost nodes should not be pushed'
7093
* ' onto the stack: %s' % (node,)) # <<<<<<<<<<<<<<
7094
* if PyTuple_GET_SIZE(node.parents) > 0:
7095
* parent_node = _get_tuple_node(node.parents, 0)
7097
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7098
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
7099
__Pyx_INCREF(((PyObject *)__pyx_v_node));
7100
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_node));
7101
__Pyx_GIVEREF(((PyObject *)__pyx_v_node));
7102
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7103
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
7104
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
7105
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7106
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
7107
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
7108
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
7110
__pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7111
__Pyx_GOTREF(__pyx_t_3);
7112
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
7113
__Pyx_Raise(__pyx_t_3, 0, 0);
7114
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7115
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7120
/* "bzrlib/_known_graph_pyx.pyx":778
7121
* raise RuntimeError('ghost nodes should not be pushed'
7122
* ' onto the stack: %s' % (node,))
7123
* if PyTuple_GET_SIZE(node.parents) > 0: # <<<<<<<<<<<<<<
7124
* parent_node = _get_tuple_node(node.parents, 0)
7125
* ms_node.left_parent = parent_node
7127
__pyx_t_3 = __pyx_v_node->parents;
7128
__Pyx_INCREF(__pyx_t_3);
7129
__pyx_t_2 = (PyTuple_GET_SIZE(__pyx_t_3) > 0);
7130
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7133
/* "bzrlib/_known_graph_pyx.pyx":779
7134
* ' onto the stack: %s' % (node,))
7135
* if PyTuple_GET_SIZE(node.parents) > 0:
7136
* parent_node = _get_tuple_node(node.parents, 0) # <<<<<<<<<<<<<<
7137
* ms_node.left_parent = parent_node
7138
* if parent_node.parents is None: # left-hand ghost
7140
__pyx_t_3 = __pyx_v_node->parents;
7141
__Pyx_INCREF(__pyx_t_3);
7142
__pyx_t_1 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_tuple_node(__pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7143
__Pyx_GOTREF(__pyx_t_1);
7144
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7145
__Pyx_DECREF(((PyObject *)__pyx_v_parent_node));
7146
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_1);
7149
/* "bzrlib/_known_graph_pyx.pyx":780
7150
* if PyTuple_GET_SIZE(node.parents) > 0:
7151
* parent_node = _get_tuple_node(node.parents, 0)
7152
* ms_node.left_parent = parent_node # <<<<<<<<<<<<<<
7153
* if parent_node.parents is None: # left-hand ghost
7154
* ms_node.left_pending_parent = None
7156
__Pyx_INCREF(((PyObject *)__pyx_v_parent_node));
7157
__Pyx_GIVEREF(((PyObject *)__pyx_v_parent_node));
7158
__Pyx_GOTREF(__pyx_v_ms_node->left_parent);
7159
__Pyx_DECREF(((PyObject *)__pyx_v_ms_node->left_parent));
7160
__pyx_v_ms_node->left_parent = __pyx_v_parent_node;
7162
/* "bzrlib/_known_graph_pyx.pyx":781
7163
* parent_node = _get_tuple_node(node.parents, 0)
7164
* ms_node.left_parent = parent_node
7165
* if parent_node.parents is None: # left-hand ghost # <<<<<<<<<<<<<<
7166
* ms_node.left_pending_parent = None
7167
* ms_node.left_parent = None
7169
__pyx_t_2 = (__pyx_v_parent_node->parents == Py_None);
7172
/* "bzrlib/_known_graph_pyx.pyx":782
7173
* ms_node.left_parent = parent_node
7174
* if parent_node.parents is None: # left-hand ghost
7175
* ms_node.left_pending_parent = None # <<<<<<<<<<<<<<
7176
* ms_node.left_parent = None
7179
__Pyx_INCREF(Py_None);
7180
__Pyx_GIVEREF(Py_None);
7181
__Pyx_GOTREF(__pyx_v_ms_node->left_pending_parent);
7182
__Pyx_DECREF(((PyObject *)__pyx_v_ms_node->left_pending_parent));
7183
__pyx_v_ms_node->left_pending_parent = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None);
7185
/* "bzrlib/_known_graph_pyx.pyx":783
7186
* if parent_node.parents is None: # left-hand ghost
7187
* ms_node.left_pending_parent = None
7188
* ms_node.left_parent = None # <<<<<<<<<<<<<<
7190
* ms_node.left_pending_parent = parent_node
7192
__Pyx_INCREF(Py_None);
7193
__Pyx_GIVEREF(Py_None);
7194
__Pyx_GOTREF(__pyx_v_ms_node->left_parent);
7195
__Pyx_DECREF(((PyObject *)__pyx_v_ms_node->left_parent));
7196
__pyx_v_ms_node->left_parent = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None);
7201
/* "bzrlib/_known_graph_pyx.pyx":785
7202
* ms_node.left_parent = None
7204
* ms_node.left_pending_parent = parent_node # <<<<<<<<<<<<<<
7205
* if PyTuple_GET_SIZE(node.parents) > 1:
7206
* ms_node.pending_parents = []
7208
__Pyx_INCREF(((PyObject *)__pyx_v_parent_node));
7209
__Pyx_GIVEREF(((PyObject *)__pyx_v_parent_node));
7210
__Pyx_GOTREF(__pyx_v_ms_node->left_pending_parent);
7211
__Pyx_DECREF(((PyObject *)__pyx_v_ms_node->left_pending_parent));
7212
__pyx_v_ms_node->left_pending_parent = __pyx_v_parent_node;
7219
/* "bzrlib/_known_graph_pyx.pyx":786
7221
* ms_node.left_pending_parent = parent_node
7222
* if PyTuple_GET_SIZE(node.parents) > 1: # <<<<<<<<<<<<<<
7223
* ms_node.pending_parents = []
7224
* for pos from 1 <= pos < PyTuple_GET_SIZE(node.parents):
7226
__pyx_t_1 = __pyx_v_node->parents;
7227
__Pyx_INCREF(__pyx_t_1);
7228
__pyx_t_2 = (PyTuple_GET_SIZE(__pyx_t_1) > 1);
7229
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7232
/* "bzrlib/_known_graph_pyx.pyx":787
7233
* ms_node.left_pending_parent = parent_node
7234
* if PyTuple_GET_SIZE(node.parents) > 1:
7235
* ms_node.pending_parents = [] # <<<<<<<<<<<<<<
7236
* for pos from 1 <= pos < PyTuple_GET_SIZE(node.parents):
7237
* parent_node = _get_tuple_node(node.parents, pos)
7239
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7240
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
7241
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
7242
__Pyx_GOTREF(__pyx_v_ms_node->pending_parents);
7243
__Pyx_DECREF(__pyx_v_ms_node->pending_parents);
7244
__pyx_v_ms_node->pending_parents = ((PyObject *)__pyx_t_1);
7247
/* "bzrlib/_known_graph_pyx.pyx":788
7248
* if PyTuple_GET_SIZE(node.parents) > 1:
7249
* ms_node.pending_parents = []
7250
* for pos from 1 <= pos < PyTuple_GET_SIZE(node.parents): # <<<<<<<<<<<<<<
7251
* parent_node = _get_tuple_node(node.parents, pos)
7252
* if parent_node.parents is None: # ghost
7254
__pyx_t_1 = __pyx_v_node->parents;
7255
__Pyx_INCREF(__pyx_t_1);
7256
__pyx_t_4 = PyTuple_GET_SIZE(__pyx_t_1);
7257
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7258
for (__pyx_v_pos = 1; __pyx_v_pos < __pyx_t_4; __pyx_v_pos++) {
7260
/* "bzrlib/_known_graph_pyx.pyx":789
7261
* ms_node.pending_parents = []
7262
* for pos from 1 <= pos < PyTuple_GET_SIZE(node.parents):
7263
* parent_node = _get_tuple_node(node.parents, pos) # <<<<<<<<<<<<<<
7264
* if parent_node.parents is None: # ghost
7267
__pyx_t_1 = __pyx_v_node->parents;
7268
__Pyx_INCREF(__pyx_t_1);
7269
__pyx_t_3 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_tuple_node(__pyx_t_1, __pyx_v_pos)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7270
__Pyx_GOTREF(__pyx_t_3);
7271
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7272
__Pyx_DECREF(((PyObject *)__pyx_v_parent_node));
7273
__pyx_v_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_3);
7276
/* "bzrlib/_known_graph_pyx.pyx":790
7277
* for pos from 1 <= pos < PyTuple_GET_SIZE(node.parents):
7278
* parent_node = _get_tuple_node(node.parents, pos)
7279
* if parent_node.parents is None: # ghost # <<<<<<<<<<<<<<
7281
* PyList_Append(ms_node.pending_parents, parent_node)
7283
__pyx_t_2 = (__pyx_v_parent_node->parents == Py_None);
7286
/* "bzrlib/_known_graph_pyx.pyx":791
7287
* parent_node = _get_tuple_node(node.parents, pos)
7288
* if parent_node.parents is None: # ghost
7289
* continue # <<<<<<<<<<<<<<
7290
* PyList_Append(ms_node.pending_parents, parent_node)
7293
goto __pyx_L7_continue;
7298
/* "bzrlib/_known_graph_pyx.pyx":792
7299
* if parent_node.parents is None: # ghost
7301
* PyList_Append(ms_node.pending_parents, parent_node) # <<<<<<<<<<<<<<
7303
* ms_node.is_first_child = 1
7305
__pyx_t_3 = __pyx_v_ms_node->pending_parents;
7306
__Pyx_INCREF(__pyx_t_3);
7307
__pyx_t_5 = PyList_Append(__pyx_t_3, ((PyObject *)__pyx_v_parent_node)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7308
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7315
/* "bzrlib/_known_graph_pyx.pyx":794
7316
* PyList_Append(ms_node.pending_parents, parent_node)
7318
* ms_node.is_first_child = 1 # <<<<<<<<<<<<<<
7319
* if ms_node.left_parent is not None:
7320
* ms_parent_node = self._get_ms_node(ms_node.left_parent)
7322
__pyx_v_ms_node->is_first_child = 1;
7324
/* "bzrlib/_known_graph_pyx.pyx":795
7326
* ms_node.is_first_child = 1
7327
* if ms_node.left_parent is not None: # <<<<<<<<<<<<<<
7328
* ms_parent_node = self._get_ms_node(ms_node.left_parent)
7329
* if ms_parent_node.seen_by_child:
7331
__pyx_t_2 = (((PyObject *)__pyx_v_ms_node->left_parent) != Py_None);
7334
/* "bzrlib/_known_graph_pyx.pyx":796
7335
* ms_node.is_first_child = 1
7336
* if ms_node.left_parent is not None:
7337
* ms_parent_node = self._get_ms_node(ms_node.left_parent) # <<<<<<<<<<<<<<
7338
* if ms_parent_node.seen_by_child:
7339
* ms_node.is_first_child = 0
7341
__pyx_t_3 = ((PyObject *)__pyx_v_ms_node->left_parent);
7342
__Pyx_INCREF(__pyx_t_3);
7343
__pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self->__pyx_vtab)->_get_ms_node(__pyx_v_self, ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_3))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7344
__Pyx_GOTREF(__pyx_t_1);
7345
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7346
__Pyx_DECREF(((PyObject *)__pyx_v_ms_parent_node));
7347
__pyx_v_ms_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_t_1);
7350
/* "bzrlib/_known_graph_pyx.pyx":797
7351
* if ms_node.left_parent is not None:
7352
* ms_parent_node = self._get_ms_node(ms_node.left_parent)
7353
* if ms_parent_node.seen_by_child: # <<<<<<<<<<<<<<
7354
* ms_node.is_first_child = 0
7355
* ms_parent_node.seen_by_child = 1
7357
if (__pyx_v_ms_parent_node->seen_by_child) {
7359
/* "bzrlib/_known_graph_pyx.pyx":798
7360
* ms_parent_node = self._get_ms_node(ms_node.left_parent)
7361
* if ms_parent_node.seen_by_child:
7362
* ms_node.is_first_child = 0 # <<<<<<<<<<<<<<
7363
* ms_parent_node.seen_by_child = 1
7364
* self._last_stack_item = self._last_stack_item + 1
7366
__pyx_v_ms_node->is_first_child = 0;
7371
/* "bzrlib/_known_graph_pyx.pyx":799
7372
* if ms_parent_node.seen_by_child:
7373
* ms_node.is_first_child = 0
7374
* ms_parent_node.seen_by_child = 1 # <<<<<<<<<<<<<<
7375
* self._last_stack_item = self._last_stack_item + 1
7376
* if self._last_stack_item < PyList_GET_SIZE(self._depth_first_stack):
7378
__pyx_v_ms_parent_node->seen_by_child = 1;
7383
/* "bzrlib/_known_graph_pyx.pyx":800
7384
* ms_node.is_first_child = 0
7385
* ms_parent_node.seen_by_child = 1
7386
* self._last_stack_item = self._last_stack_item + 1 # <<<<<<<<<<<<<<
7387
* if self._last_stack_item < PyList_GET_SIZE(self._depth_first_stack):
7388
* Py_INCREF(node) # SetItem steals a ref
7390
__pyx_v_self->_last_stack_item = (__pyx_v_self->_last_stack_item + 1);
7392
/* "bzrlib/_known_graph_pyx.pyx":801
7393
* ms_parent_node.seen_by_child = 1
7394
* self._last_stack_item = self._last_stack_item + 1
7395
* if self._last_stack_item < PyList_GET_SIZE(self._depth_first_stack): # <<<<<<<<<<<<<<
7396
* Py_INCREF(node) # SetItem steals a ref
7397
* PyList_SetItem(self._depth_first_stack, self._last_stack_item,
7399
__pyx_t_1 = __pyx_v_self->_depth_first_stack;
7400
__Pyx_INCREF(__pyx_t_1);
7401
__pyx_t_2 = (__pyx_v_self->_last_stack_item < PyList_GET_SIZE(__pyx_t_1));
7402
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7405
/* "bzrlib/_known_graph_pyx.pyx":802
7406
* self._last_stack_item = self._last_stack_item + 1
7407
* if self._last_stack_item < PyList_GET_SIZE(self._depth_first_stack):
7408
* Py_INCREF(node) # SetItem steals a ref # <<<<<<<<<<<<<<
7409
* PyList_SetItem(self._depth_first_stack, self._last_stack_item,
7412
Py_INCREF(((PyObject *)__pyx_v_node));
7414
/* "bzrlib/_known_graph_pyx.pyx":803
7415
* if self._last_stack_item < PyList_GET_SIZE(self._depth_first_stack):
7416
* Py_INCREF(node) # SetItem steals a ref
7417
* PyList_SetItem(self._depth_first_stack, self._last_stack_item, # <<<<<<<<<<<<<<
7421
__pyx_t_1 = __pyx_v_self->_depth_first_stack;
7422
__Pyx_INCREF(__pyx_t_1);
7424
/* "bzrlib/_known_graph_pyx.pyx":804
7425
* Py_INCREF(node) # SetItem steals a ref
7426
* PyList_SetItem(self._depth_first_stack, self._last_stack_item,
7427
* node) # <<<<<<<<<<<<<<
7429
* PyList_Append(self._depth_first_stack, node)
7431
__pyx_t_5 = PyList_SetItem(__pyx_t_1, __pyx_v_self->_last_stack_item, ((PyObject *)__pyx_v_node)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7432
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7437
/* "bzrlib/_known_graph_pyx.pyx":806
7440
* PyList_Append(self._depth_first_stack, node) # <<<<<<<<<<<<<<
7442
* cdef _pop_node(self):
7444
__pyx_t_1 = __pyx_v_self->_depth_first_stack;
7445
__Pyx_INCREF(__pyx_t_1);
7446
__pyx_t_5 = PyList_Append(__pyx_t_1, ((PyObject *)__pyx_v_node)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7447
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7451
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
7454
__Pyx_XDECREF(__pyx_t_1);
7455
__Pyx_XDECREF(__pyx_t_3);
7456
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSorter._push_node");
7459
__Pyx_DECREF((PyObject *)__pyx_v_parent_node);
7460
__Pyx_DECREF((PyObject *)__pyx_v_ms_node);
7461
__Pyx_DECREF((PyObject *)__pyx_v_ms_parent_node);
7462
__Pyx_XGIVEREF(__pyx_r);
7463
__Pyx_RefNannyFinishContext();
7467
/* "bzrlib/_known_graph_pyx.pyx":808
7468
* PyList_Append(self._depth_first_stack, node)
7470
* cdef _pop_node(self): # <<<<<<<<<<<<<<
7471
* cdef PyObject *temp
7472
* cdef _MergeSortNode ms_node, ms_parent_node, ms_prev_node
7475
static PyObject *__pyx_f_6bzrlib_16_known_graph_pyx_12_MergeSorter__pop_node(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *__pyx_v_self) {
7476
PyObject *__pyx_v_temp;
7477
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_v_ms_node;
7478
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_v_ms_parent_node;
7479
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_v_ms_prev_node;
7480
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
7481
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_prev_node;
7482
long __pyx_v_base_revno;
7483
PyObject *__pyx_v_branch_count;
7484
PyObject *__pyx_v_root_count;
7485
PyObject *__pyx_r = NULL;
7486
PyObject *__pyx_t_1 = NULL;
7487
PyObject *__pyx_t_2 = NULL;
7491
PyObject *__pyx_t_6 = NULL;
7494
__Pyx_RefNannySetupContext("_pop_node");
7495
__pyx_v_ms_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)Py_None); __Pyx_INCREF(Py_None);
7496
__pyx_v_ms_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)Py_None); __Pyx_INCREF(Py_None);
7497
__pyx_v_ms_prev_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)Py_None); __Pyx_INCREF(Py_None);
7498
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
7499
__pyx_v_prev_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
7500
__pyx_v_branch_count = Py_None; __Pyx_INCREF(Py_None);
7501
__pyx_v_root_count = Py_None; __Pyx_INCREF(Py_None);
7503
/* "bzrlib/_known_graph_pyx.pyx":813
7504
* cdef _KnownGraphNode node, parent_node, prev_node
7506
* node = _get_list_node(self._depth_first_stack, self._last_stack_item) # <<<<<<<<<<<<<<
7507
* ms_node = <_MergeSortNode>node.extra
7508
* self._last_stack_item = self._last_stack_item - 1
7510
__pyx_t_1 = __pyx_v_self->_depth_first_stack;
7511
__Pyx_INCREF(__pyx_t_1);
7512
__pyx_t_2 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_t_1, __pyx_v_self->_last_stack_item)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7513
__Pyx_GOTREF(__pyx_t_2);
7514
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7515
__Pyx_DECREF(((PyObject *)__pyx_v_node));
7516
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_2);
7519
/* "bzrlib/_known_graph_pyx.pyx":814
7521
* node = _get_list_node(self._depth_first_stack, self._last_stack_item)
7522
* ms_node = <_MergeSortNode>node.extra # <<<<<<<<<<<<<<
7523
* self._last_stack_item = self._last_stack_item - 1
7524
* if ms_node.left_parent is not None:
7526
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_node->extra)));
7527
__Pyx_DECREF(((PyObject *)__pyx_v_ms_node));
7528
__pyx_v_ms_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_node->extra);
7530
/* "bzrlib/_known_graph_pyx.pyx":815
7531
* node = _get_list_node(self._depth_first_stack, self._last_stack_item)
7532
* ms_node = <_MergeSortNode>node.extra
7533
* self._last_stack_item = self._last_stack_item - 1 # <<<<<<<<<<<<<<
7534
* if ms_node.left_parent is not None:
7535
* # Assign the revision number from the left-hand parent
7537
__pyx_v_self->_last_stack_item = (__pyx_v_self->_last_stack_item - 1);
7539
/* "bzrlib/_known_graph_pyx.pyx":816
7540
* ms_node = <_MergeSortNode>node.extra
7541
* self._last_stack_item = self._last_stack_item - 1
7542
* if ms_node.left_parent is not None: # <<<<<<<<<<<<<<
7543
* # Assign the revision number from the left-hand parent
7544
* ms_parent_node = <_MergeSortNode>ms_node.left_parent.extra
7546
__pyx_t_3 = (((PyObject *)__pyx_v_ms_node->left_parent) != Py_None);
7549
/* "bzrlib/_known_graph_pyx.pyx":818
7550
* if ms_node.left_parent is not None:
7551
* # Assign the revision number from the left-hand parent
7552
* ms_parent_node = <_MergeSortNode>ms_node.left_parent.extra # <<<<<<<<<<<<<<
7553
* if ms_node.is_first_child:
7554
* # First child just increments the final digit
7556
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_ms_node->left_parent->extra)));
7557
__Pyx_DECREF(((PyObject *)__pyx_v_ms_parent_node));
7558
__pyx_v_ms_parent_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_ms_node->left_parent->extra);
7560
/* "bzrlib/_known_graph_pyx.pyx":819
7561
* # Assign the revision number from the left-hand parent
7562
* ms_parent_node = <_MergeSortNode>ms_node.left_parent.extra
7563
* if ms_node.is_first_child: # <<<<<<<<<<<<<<
7564
* # First child just increments the final digit
7565
* ms_node._revno_first = ms_parent_node._revno_first
7567
if (__pyx_v_ms_node->is_first_child) {
7569
/* "bzrlib/_known_graph_pyx.pyx":821
7570
* if ms_node.is_first_child:
7571
* # First child just increments the final digit
7572
* ms_node._revno_first = ms_parent_node._revno_first # <<<<<<<<<<<<<<
7573
* ms_node._revno_second = ms_parent_node._revno_second
7574
* ms_node._revno_last = ms_parent_node._revno_last + 1
7576
__pyx_v_ms_node->_revno_first = __pyx_v_ms_parent_node->_revno_first;
7578
/* "bzrlib/_known_graph_pyx.pyx":822
7579
* # First child just increments the final digit
7580
* ms_node._revno_first = ms_parent_node._revno_first
7581
* ms_node._revno_second = ms_parent_node._revno_second # <<<<<<<<<<<<<<
7582
* ms_node._revno_last = ms_parent_node._revno_last + 1
7585
__pyx_v_ms_node->_revno_second = __pyx_v_ms_parent_node->_revno_second;
7587
/* "bzrlib/_known_graph_pyx.pyx":823
7588
* ms_node._revno_first = ms_parent_node._revno_first
7589
* ms_node._revno_second = ms_parent_node._revno_second
7590
* ms_node._revno_last = ms_parent_node._revno_last + 1 # <<<<<<<<<<<<<<
7592
* # Not the first child, make a new branch
7594
__pyx_v_ms_node->_revno_last = (__pyx_v_ms_parent_node->_revno_last + 1);
7599
/* "bzrlib/_known_graph_pyx.pyx":827
7600
* # Not the first child, make a new branch
7601
* # (mainline_revno, branch_count, 1)
7602
* if ms_parent_node._revno_first == -1: # <<<<<<<<<<<<<<
7603
* # Mainline ancestor, the increment is on the last digit
7604
* base_revno = ms_parent_node._revno_last
7606
__pyx_t_3 = (__pyx_v_ms_parent_node->_revno_first == -1);
7609
/* "bzrlib/_known_graph_pyx.pyx":829
7610
* if ms_parent_node._revno_first == -1:
7611
* # Mainline ancestor, the increment is on the last digit
7612
* base_revno = ms_parent_node._revno_last # <<<<<<<<<<<<<<
7614
* base_revno = ms_parent_node._revno_first
7616
__pyx_v_base_revno = __pyx_v_ms_parent_node->_revno_last;
7621
/* "bzrlib/_known_graph_pyx.pyx":831
7622
* base_revno = ms_parent_node._revno_last
7624
* base_revno = ms_parent_node._revno_first # <<<<<<<<<<<<<<
7625
* temp = PyDict_GetItem(self._revno_to_branch_count,
7628
__pyx_v_base_revno = __pyx_v_ms_parent_node->_revno_first;
7632
/* "bzrlib/_known_graph_pyx.pyx":832
7634
* base_revno = ms_parent_node._revno_first
7635
* temp = PyDict_GetItem(self._revno_to_branch_count, # <<<<<<<<<<<<<<
7639
__pyx_t_2 = __pyx_v_self->_revno_to_branch_count;
7640
__Pyx_INCREF(__pyx_t_2);
7642
/* "bzrlib/_known_graph_pyx.pyx":833
7643
* base_revno = ms_parent_node._revno_first
7644
* temp = PyDict_GetItem(self._revno_to_branch_count,
7645
* base_revno) # <<<<<<<<<<<<<<
7649
__pyx_t_1 = PyInt_FromLong(__pyx_v_base_revno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7650
__Pyx_GOTREF(__pyx_t_1);
7651
__pyx_v_temp = PyDict_GetItem(__pyx_t_2, __pyx_t_1);
7652
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7653
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7655
/* "bzrlib/_known_graph_pyx.pyx":834
7656
* temp = PyDict_GetItem(self._revno_to_branch_count,
7658
* if temp == NULL: # <<<<<<<<<<<<<<
7662
__pyx_t_3 = (__pyx_v_temp == NULL);
7665
/* "bzrlib/_known_graph_pyx.pyx":835
7668
* branch_count = 1 # <<<<<<<<<<<<<<
7670
* branch_count = (<object>temp) + 1
7672
__Pyx_INCREF(__pyx_int_1);
7673
__Pyx_DECREF(__pyx_v_branch_count);
7674
__pyx_v_branch_count = __pyx_int_1;
7679
/* "bzrlib/_known_graph_pyx.pyx":837
7682
* branch_count = (<object>temp) + 1 # <<<<<<<<<<<<<<
7683
* PyDict_SetItem(self._revno_to_branch_count, base_revno,
7686
__pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_temp), __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7687
__Pyx_GOTREF(__pyx_t_1);
7688
__Pyx_DECREF(__pyx_v_branch_count);
7689
__pyx_v_branch_count = __pyx_t_1;
7694
/* "bzrlib/_known_graph_pyx.pyx":838
7696
* branch_count = (<object>temp) + 1
7697
* PyDict_SetItem(self._revno_to_branch_count, base_revno, # <<<<<<<<<<<<<<
7699
* ms_node._revno_first = base_revno
7701
__pyx_t_1 = __pyx_v_self->_revno_to_branch_count;
7702
__Pyx_INCREF(__pyx_t_1);
7703
__pyx_t_2 = PyInt_FromLong(__pyx_v_base_revno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7704
__Pyx_GOTREF(__pyx_t_2);
7706
/* "bzrlib/_known_graph_pyx.pyx":839
7707
* branch_count = (<object>temp) + 1
7708
* PyDict_SetItem(self._revno_to_branch_count, base_revno,
7709
* branch_count) # <<<<<<<<<<<<<<
7710
* ms_node._revno_first = base_revno
7711
* ms_node._revno_second = branch_count
7713
__pyx_t_4 = PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_v_branch_count); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7714
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7715
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7717
/* "bzrlib/_known_graph_pyx.pyx":840
7718
* PyDict_SetItem(self._revno_to_branch_count, base_revno,
7720
* ms_node._revno_first = base_revno # <<<<<<<<<<<<<<
7721
* ms_node._revno_second = branch_count
7722
* ms_node._revno_last = 1
7724
__pyx_v_ms_node->_revno_first = __pyx_v_base_revno;
7726
/* "bzrlib/_known_graph_pyx.pyx":841
7728
* ms_node._revno_first = base_revno
7729
* ms_node._revno_second = branch_count # <<<<<<<<<<<<<<
7730
* ms_node._revno_last = 1
7733
__pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_v_branch_count); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7734
__pyx_v_ms_node->_revno_second = __pyx_t_5;
7736
/* "bzrlib/_known_graph_pyx.pyx":842
7737
* ms_node._revno_first = base_revno
7738
* ms_node._revno_second = branch_count
7739
* ms_node._revno_last = 1 # <<<<<<<<<<<<<<
7741
* temp = PyDict_GetItem(self._revno_to_branch_count, 0)
7743
__pyx_v_ms_node->_revno_last = 1;
7750
/* "bzrlib/_known_graph_pyx.pyx":844
7751
* ms_node._revno_last = 1
7753
* temp = PyDict_GetItem(self._revno_to_branch_count, 0) # <<<<<<<<<<<<<<
7755
* # The first root node doesn't have a 3-digit revno
7757
__pyx_t_2 = __pyx_v_self->_revno_to_branch_count;
7758
__Pyx_INCREF(__pyx_t_2);
7759
__pyx_v_temp = PyDict_GetItem(__pyx_t_2, __pyx_int_0);
7760
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7762
/* "bzrlib/_known_graph_pyx.pyx":845
7764
* temp = PyDict_GetItem(self._revno_to_branch_count, 0)
7765
* if temp == NULL: # <<<<<<<<<<<<<<
7766
* # The first root node doesn't have a 3-digit revno
7769
__pyx_t_3 = (__pyx_v_temp == NULL);
7772
/* "bzrlib/_known_graph_pyx.pyx":847
7774
* # The first root node doesn't have a 3-digit revno
7775
* root_count = 0 # <<<<<<<<<<<<<<
7776
* ms_node._revno_first = -1
7777
* ms_node._revno_second = -1
7779
__Pyx_INCREF(__pyx_int_0);
7780
__Pyx_DECREF(__pyx_v_root_count);
7781
__pyx_v_root_count = __pyx_int_0;
7783
/* "bzrlib/_known_graph_pyx.pyx":848
7784
* # The first root node doesn't have a 3-digit revno
7786
* ms_node._revno_first = -1 # <<<<<<<<<<<<<<
7787
* ms_node._revno_second = -1
7788
* ms_node._revno_last = 1
7790
__pyx_v_ms_node->_revno_first = -1;
7792
/* "bzrlib/_known_graph_pyx.pyx":849
7794
* ms_node._revno_first = -1
7795
* ms_node._revno_second = -1 # <<<<<<<<<<<<<<
7796
* ms_node._revno_last = 1
7799
__pyx_v_ms_node->_revno_second = -1;
7801
/* "bzrlib/_known_graph_pyx.pyx":850
7802
* ms_node._revno_first = -1
7803
* ms_node._revno_second = -1
7804
* ms_node._revno_last = 1 # <<<<<<<<<<<<<<
7806
* root_count = (<object>temp) + 1
7808
__pyx_v_ms_node->_revno_last = 1;
7813
/* "bzrlib/_known_graph_pyx.pyx":852
7814
* ms_node._revno_last = 1
7816
* root_count = (<object>temp) + 1 # <<<<<<<<<<<<<<
7817
* ms_node._revno_first = 0
7818
* ms_node._revno_second = root_count
7820
__pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_v_temp), __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7821
__Pyx_GOTREF(__pyx_t_2);
7822
__Pyx_DECREF(__pyx_v_root_count);
7823
__pyx_v_root_count = __pyx_t_2;
7826
/* "bzrlib/_known_graph_pyx.pyx":853
7828
* root_count = (<object>temp) + 1
7829
* ms_node._revno_first = 0 # <<<<<<<<<<<<<<
7830
* ms_node._revno_second = root_count
7831
* ms_node._revno_last = 1
7833
__pyx_v_ms_node->_revno_first = 0;
7835
/* "bzrlib/_known_graph_pyx.pyx":854
7836
* root_count = (<object>temp) + 1
7837
* ms_node._revno_first = 0
7838
* ms_node._revno_second = root_count # <<<<<<<<<<<<<<
7839
* ms_node._revno_last = 1
7840
* PyDict_SetItem(self._revno_to_branch_count, 0, root_count)
7842
__pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_v_root_count); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7843
__pyx_v_ms_node->_revno_second = __pyx_t_5;
7845
/* "bzrlib/_known_graph_pyx.pyx":855
7846
* ms_node._revno_first = 0
7847
* ms_node._revno_second = root_count
7848
* ms_node._revno_last = 1 # <<<<<<<<<<<<<<
7849
* PyDict_SetItem(self._revno_to_branch_count, 0, root_count)
7850
* ms_node.completed = 1
7852
__pyx_v_ms_node->_revno_last = 1;
7856
/* "bzrlib/_known_graph_pyx.pyx":856
7857
* ms_node._revno_second = root_count
7858
* ms_node._revno_last = 1
7859
* PyDict_SetItem(self._revno_to_branch_count, 0, root_count) # <<<<<<<<<<<<<<
7860
* ms_node.completed = 1
7861
* if PyList_GET_SIZE(self._scheduled_nodes) == 0:
7863
__pyx_t_2 = __pyx_v_self->_revno_to_branch_count;
7864
__Pyx_INCREF(__pyx_t_2);
7865
__pyx_t_4 = PyDict_SetItem(__pyx_t_2, __pyx_int_0, __pyx_v_root_count); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7866
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7870
/* "bzrlib/_known_graph_pyx.pyx":857
7871
* ms_node._revno_last = 1
7872
* PyDict_SetItem(self._revno_to_branch_count, 0, root_count)
7873
* ms_node.completed = 1 # <<<<<<<<<<<<<<
7874
* if PyList_GET_SIZE(self._scheduled_nodes) == 0:
7875
* # The first scheduled node is always the end of merge
7877
__pyx_v_ms_node->completed = 1;
7879
/* "bzrlib/_known_graph_pyx.pyx":858
7880
* PyDict_SetItem(self._revno_to_branch_count, 0, root_count)
7881
* ms_node.completed = 1
7882
* if PyList_GET_SIZE(self._scheduled_nodes) == 0: # <<<<<<<<<<<<<<
7883
* # The first scheduled node is always the end of merge
7884
* ms_node.end_of_merge = True
7886
__pyx_t_2 = __pyx_v_self->_scheduled_nodes;
7887
__Pyx_INCREF(__pyx_t_2);
7888
__pyx_t_3 = (PyList_GET_SIZE(__pyx_t_2) == 0);
7889
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7892
/* "bzrlib/_known_graph_pyx.pyx":860
7893
* if PyList_GET_SIZE(self._scheduled_nodes) == 0:
7894
* # The first scheduled node is always the end of merge
7895
* ms_node.end_of_merge = True # <<<<<<<<<<<<<<
7897
* prev_node = _get_list_node(self._scheduled_nodes,
7899
__pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7900
__Pyx_GOTREF(__pyx_t_2);
7901
__Pyx_GIVEREF(__pyx_t_2);
7902
__Pyx_GOTREF(__pyx_v_ms_node->end_of_merge);
7903
__Pyx_DECREF(__pyx_v_ms_node->end_of_merge);
7904
__pyx_v_ms_node->end_of_merge = __pyx_t_2;
7910
/* "bzrlib/_known_graph_pyx.pyx":862
7911
* ms_node.end_of_merge = True
7913
* prev_node = _get_list_node(self._scheduled_nodes, # <<<<<<<<<<<<<<
7914
* PyList_GET_SIZE(self._scheduled_nodes) - 1)
7915
* ms_prev_node = <_MergeSortNode>prev_node.extra
7917
__pyx_t_2 = __pyx_v_self->_scheduled_nodes;
7918
__Pyx_INCREF(__pyx_t_2);
7920
/* "bzrlib/_known_graph_pyx.pyx":863
7922
* prev_node = _get_list_node(self._scheduled_nodes,
7923
* PyList_GET_SIZE(self._scheduled_nodes) - 1) # <<<<<<<<<<<<<<
7924
* ms_prev_node = <_MergeSortNode>prev_node.extra
7925
* if ms_prev_node.merge_depth < ms_node.merge_depth:
7927
__pyx_t_1 = __pyx_v_self->_scheduled_nodes;
7928
__Pyx_INCREF(__pyx_t_1);
7929
__pyx_t_6 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_t_2, (PyList_GET_SIZE(__pyx_t_1) - 1))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7930
__Pyx_GOTREF(__pyx_t_6);
7931
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7932
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7933
__Pyx_DECREF(((PyObject *)__pyx_v_prev_node));
7934
__pyx_v_prev_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_6);
7937
/* "bzrlib/_known_graph_pyx.pyx":864
7938
* prev_node = _get_list_node(self._scheduled_nodes,
7939
* PyList_GET_SIZE(self._scheduled_nodes) - 1)
7940
* ms_prev_node = <_MergeSortNode>prev_node.extra # <<<<<<<<<<<<<<
7941
* if ms_prev_node.merge_depth < ms_node.merge_depth:
7942
* # The previously pushed node is to our left, so this is the end
7944
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_prev_node->extra)));
7945
__Pyx_DECREF(((PyObject *)__pyx_v_ms_prev_node));
7946
__pyx_v_ms_prev_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_prev_node->extra);
7948
/* "bzrlib/_known_graph_pyx.pyx":865
7949
* PyList_GET_SIZE(self._scheduled_nodes) - 1)
7950
* ms_prev_node = <_MergeSortNode>prev_node.extra
7951
* if ms_prev_node.merge_depth < ms_node.merge_depth: # <<<<<<<<<<<<<<
7952
* # The previously pushed node is to our left, so this is the end
7953
* # of this right-hand chain
7955
__pyx_t_3 = (__pyx_v_ms_prev_node->merge_depth < __pyx_v_ms_node->merge_depth);
7958
/* "bzrlib/_known_graph_pyx.pyx":868
7959
* # The previously pushed node is to our left, so this is the end
7960
* # of this right-hand chain
7961
* ms_node.end_of_merge = True # <<<<<<<<<<<<<<
7962
* elif (ms_prev_node.merge_depth == ms_node.merge_depth
7963
* and prev_node not in node.parents):
7965
__pyx_t_6 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7966
__Pyx_GOTREF(__pyx_t_6);
7967
__Pyx_GIVEREF(__pyx_t_6);
7968
__Pyx_GOTREF(__pyx_v_ms_node->end_of_merge);
7969
__Pyx_DECREF(__pyx_v_ms_node->end_of_merge);
7970
__pyx_v_ms_node->end_of_merge = __pyx_t_6;
7975
/* "bzrlib/_known_graph_pyx.pyx":869
7976
* # of this right-hand chain
7977
* ms_node.end_of_merge = True
7978
* elif (ms_prev_node.merge_depth == ms_node.merge_depth # <<<<<<<<<<<<<<
7979
* and prev_node not in node.parents):
7980
* # The next node is not a direct parent of this node
7982
__pyx_t_3 = (__pyx_v_ms_prev_node->merge_depth == __pyx_v_ms_node->merge_depth);
7985
/* "bzrlib/_known_graph_pyx.pyx":870
7986
* ms_node.end_of_merge = True
7987
* elif (ms_prev_node.merge_depth == ms_node.merge_depth
7988
* and prev_node not in node.parents): # <<<<<<<<<<<<<<
7989
* # The next node is not a direct parent of this node
7990
* ms_node.end_of_merge = True
7992
__pyx_t_7 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_node->parents, ((PyObject *)__pyx_v_prev_node)))); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
7993
__pyx_t_8 = __pyx_t_7;
7995
__pyx_t_8 = __pyx_t_3;
7999
/* "bzrlib/_known_graph_pyx.pyx":872
8000
* and prev_node not in node.parents):
8001
* # The next node is not a direct parent of this node
8002
* ms_node.end_of_merge = True # <<<<<<<<<<<<<<
8004
* ms_node.end_of_merge = False
8006
__pyx_t_6 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8007
__Pyx_GOTREF(__pyx_t_6);
8008
__Pyx_GIVEREF(__pyx_t_6);
8009
__Pyx_GOTREF(__pyx_v_ms_node->end_of_merge);
8010
__Pyx_DECREF(__pyx_v_ms_node->end_of_merge);
8011
__pyx_v_ms_node->end_of_merge = __pyx_t_6;
8017
/* "bzrlib/_known_graph_pyx.pyx":874
8018
* ms_node.end_of_merge = True
8020
* ms_node.end_of_merge = False # <<<<<<<<<<<<<<
8021
* PyList_Append(self._scheduled_nodes, node)
8024
__pyx_t_6 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8025
__Pyx_GOTREF(__pyx_t_6);
8026
__Pyx_GIVEREF(__pyx_t_6);
8027
__Pyx_GOTREF(__pyx_v_ms_node->end_of_merge);
8028
__Pyx_DECREF(__pyx_v_ms_node->end_of_merge);
8029
__pyx_v_ms_node->end_of_merge = __pyx_t_6;
8036
/* "bzrlib/_known_graph_pyx.pyx":875
8038
* ms_node.end_of_merge = False
8039
* PyList_Append(self._scheduled_nodes, node) # <<<<<<<<<<<<<<
8041
* cdef _schedule_stack(self):
8043
__pyx_t_6 = __pyx_v_self->_scheduled_nodes;
8044
__Pyx_INCREF(__pyx_t_6);
8045
__pyx_t_4 = PyList_Append(__pyx_t_6, ((PyObject *)__pyx_v_node)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8046
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8048
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
8051
__Pyx_XDECREF(__pyx_t_1);
8052
__Pyx_XDECREF(__pyx_t_2);
8053
__Pyx_XDECREF(__pyx_t_6);
8054
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSorter._pop_node");
8057
__Pyx_DECREF((PyObject *)__pyx_v_ms_node);
8058
__Pyx_DECREF((PyObject *)__pyx_v_ms_parent_node);
8059
__Pyx_DECREF((PyObject *)__pyx_v_ms_prev_node);
8060
__Pyx_DECREF((PyObject *)__pyx_v_node);
8061
__Pyx_DECREF((PyObject *)__pyx_v_prev_node);
8062
__Pyx_DECREF(__pyx_v_branch_count);
8063
__Pyx_DECREF(__pyx_v_root_count);
8064
__Pyx_XGIVEREF(__pyx_r);
8065
__Pyx_RefNannyFinishContext();
8069
/* "bzrlib/_known_graph_pyx.pyx":877
8070
* PyList_Append(self._scheduled_nodes, node)
8072
* cdef _schedule_stack(self): # <<<<<<<<<<<<<<
8073
* cdef _KnownGraphNode last_node, next_node
8074
* cdef _MergeSortNode ms_node, ms_last_node, ms_next_node
8077
static PyObject *__pyx_f_6bzrlib_16_known_graph_pyx_12_MergeSorter__schedule_stack(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *__pyx_v_self) {
8078
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_last_node;
8079
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_next_node;
8080
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_v_ms_last_node;
8081
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_v_ms_next_node;
8082
long __pyx_v_next_merge_depth;
8083
PyObject *__pyx_v_ordered;
8084
PyObject *__pyx_r = NULL;
8085
PyObject *__pyx_t_1 = NULL;
8087
PyObject *__pyx_t_3 = NULL;
8088
PyObject *__pyx_t_4 = NULL;
8090
__Pyx_RefNannySetupContext("_schedule_stack");
8091
__pyx_v_last_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
8092
__pyx_v_next_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
8093
__pyx_v_ms_last_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)Py_None); __Pyx_INCREF(Py_None);
8094
__pyx_v_ms_next_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)Py_None); __Pyx_INCREF(Py_None);
8095
__pyx_v_ordered = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
8097
/* "bzrlib/_known_graph_pyx.pyx":881
8098
* cdef _MergeSortNode ms_node, ms_last_node, ms_next_node
8099
* cdef long next_merge_depth
8100
* ordered = [] # <<<<<<<<<<<<<<
8101
* while self._last_stack_item >= 0:
8102
* # Peek at the last item on the stack
8104
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8105
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
8106
__Pyx_DECREF(((PyObject *)__pyx_v_ordered));
8107
__pyx_v_ordered = __pyx_t_1;
8110
/* "bzrlib/_known_graph_pyx.pyx":882
8111
* cdef long next_merge_depth
8113
* while self._last_stack_item >= 0: # <<<<<<<<<<<<<<
8114
* # Peek at the last item on the stack
8115
* last_node = _get_list_node(self._depth_first_stack,
8118
__pyx_t_2 = (__pyx_v_self->_last_stack_item >= 0);
8119
if (!__pyx_t_2) break;
8121
/* "bzrlib/_known_graph_pyx.pyx":884
8122
* while self._last_stack_item >= 0:
8123
* # Peek at the last item on the stack
8124
* last_node = _get_list_node(self._depth_first_stack, # <<<<<<<<<<<<<<
8125
* self._last_stack_item)
8126
* if last_node.gdfo == -1:
8128
__pyx_t_1 = __pyx_v_self->_depth_first_stack;
8129
__Pyx_INCREF(__pyx_t_1);
8131
/* "bzrlib/_known_graph_pyx.pyx":885
8132
* # Peek at the last item on the stack
8133
* last_node = _get_list_node(self._depth_first_stack,
8134
* self._last_stack_item) # <<<<<<<<<<<<<<
8135
* if last_node.gdfo == -1:
8136
* # if _find_gdfo skipped a node, that means there is a graph
8138
__pyx_t_3 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_t_1, __pyx_v_self->_last_stack_item)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8139
__Pyx_GOTREF(__pyx_t_3);
8140
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8141
__Pyx_DECREF(((PyObject *)__pyx_v_last_node));
8142
__pyx_v_last_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_3);
8145
/* "bzrlib/_known_graph_pyx.pyx":886
8146
* last_node = _get_list_node(self._depth_first_stack,
8147
* self._last_stack_item)
8148
* if last_node.gdfo == -1: # <<<<<<<<<<<<<<
8149
* # if _find_gdfo skipped a node, that means there is a graph
8150
* # cycle, error out now
8152
__pyx_t_2 = (__pyx_v_last_node->gdfo == -1);
8155
/* "bzrlib/_known_graph_pyx.pyx":889
8156
* # if _find_gdfo skipped a node, that means there is a graph
8157
* # cycle, error out now
8158
* raise errors.GraphCycleError(self.graph._nodes) # <<<<<<<<<<<<<<
8159
* ms_last_node = <_MergeSortNode>last_node.extra
8160
* if not ms_last_node.has_pending_parents():
8162
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__errors); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8163
__Pyx_GOTREF(__pyx_t_3);
8164
__pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__GraphCycleError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8165
__Pyx_GOTREF(__pyx_t_1);
8166
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8167
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8168
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
8169
__Pyx_INCREF(__pyx_v_self->graph->_nodes);
8170
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self->graph->_nodes);
8171
__Pyx_GIVEREF(__pyx_v_self->graph->_nodes);
8172
__pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8173
__Pyx_GOTREF(__pyx_t_4);
8174
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8175
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
8176
__Pyx_Raise(__pyx_t_4, 0, 0);
8177
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8178
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8183
/* "bzrlib/_known_graph_pyx.pyx":890
8184
* # cycle, error out now
8185
* raise errors.GraphCycleError(self.graph._nodes)
8186
* ms_last_node = <_MergeSortNode>last_node.extra # <<<<<<<<<<<<<<
8187
* if not ms_last_node.has_pending_parents():
8188
* # Processed all parents, pop this node
8190
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_last_node->extra)));
8191
__Pyx_DECREF(((PyObject *)__pyx_v_ms_last_node));
8192
__pyx_v_ms_last_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_last_node->extra);
8194
/* "bzrlib/_known_graph_pyx.pyx":891
8195
* raise errors.GraphCycleError(self.graph._nodes)
8196
* ms_last_node = <_MergeSortNode>last_node.extra
8197
* if not ms_last_node.has_pending_parents(): # <<<<<<<<<<<<<<
8198
* # Processed all parents, pop this node
8201
__pyx_t_2 = (!((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_ms_last_node->__pyx_vtab)->has_pending_parents(__pyx_v_ms_last_node));
8204
/* "bzrlib/_known_graph_pyx.pyx":893
8205
* if not ms_last_node.has_pending_parents():
8206
* # Processed all parents, pop this node
8207
* self._pop_node() # <<<<<<<<<<<<<<
8209
* while ms_last_node.has_pending_parents():
8211
__pyx_t_4 = ((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self->__pyx_vtab)->_pop_node(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8212
__Pyx_GOTREF(__pyx_t_4);
8213
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8215
/* "bzrlib/_known_graph_pyx.pyx":894
8216
* # Processed all parents, pop this node
8218
* continue # <<<<<<<<<<<<<<
8219
* while ms_last_node.has_pending_parents():
8220
* if ms_last_node.left_pending_parent is not None:
8222
goto __pyx_L3_continue;
8227
/* "bzrlib/_known_graph_pyx.pyx":895
8230
* while ms_last_node.has_pending_parents(): # <<<<<<<<<<<<<<
8231
* if ms_last_node.left_pending_parent is not None:
8232
* # recurse depth first into the primary parent
8235
__pyx_t_5 = ((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_ms_last_node->__pyx_vtab)->has_pending_parents(__pyx_v_ms_last_node);
8236
if (!__pyx_t_5) break;
8238
/* "bzrlib/_known_graph_pyx.pyx":896
8240
* while ms_last_node.has_pending_parents():
8241
* if ms_last_node.left_pending_parent is not None: # <<<<<<<<<<<<<<
8242
* # recurse depth first into the primary parent
8243
* next_node = ms_last_node.left_pending_parent
8245
__pyx_t_2 = (((PyObject *)__pyx_v_ms_last_node->left_pending_parent) != Py_None);
8248
/* "bzrlib/_known_graph_pyx.pyx":898
8249
* if ms_last_node.left_pending_parent is not None:
8250
* # recurse depth first into the primary parent
8251
* next_node = ms_last_node.left_pending_parent # <<<<<<<<<<<<<<
8252
* ms_last_node.left_pending_parent = None
8255
__Pyx_INCREF(((PyObject *)__pyx_v_ms_last_node->left_pending_parent));
8256
__Pyx_DECREF(((PyObject *)__pyx_v_next_node));
8257
__pyx_v_next_node = __pyx_v_ms_last_node->left_pending_parent;
8259
/* "bzrlib/_known_graph_pyx.pyx":899
8260
* # recurse depth first into the primary parent
8261
* next_node = ms_last_node.left_pending_parent
8262
* ms_last_node.left_pending_parent = None # <<<<<<<<<<<<<<
8264
* # place any merges in right-to-left order for scheduling
8266
__Pyx_INCREF(Py_None);
8267
__Pyx_GIVEREF(Py_None);
8268
__Pyx_GOTREF(__pyx_v_ms_last_node->left_pending_parent);
8269
__Pyx_DECREF(((PyObject *)__pyx_v_ms_last_node->left_pending_parent));
8270
__pyx_v_ms_last_node->left_pending_parent = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None);
8275
/* "bzrlib/_known_graph_pyx.pyx":908
8276
* # left most, which will display nicely (you get
8277
* # smaller trees at the top of the combined merge).
8278
* next_node = ms_last_node.pending_parents.pop() # <<<<<<<<<<<<<<
8279
* ms_next_node = self._get_ms_node(next_node)
8280
* if ms_next_node.completed:
8282
__pyx_t_4 = __Pyx_PyObject_Pop(__pyx_v_ms_last_node->pending_parents); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8283
__Pyx_GOTREF(__pyx_t_4);
8284
if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8285
__Pyx_DECREF(((PyObject *)__pyx_v_next_node));
8286
__pyx_v_next_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_4);
8291
/* "bzrlib/_known_graph_pyx.pyx":909
8292
* # smaller trees at the top of the combined merge).
8293
* next_node = ms_last_node.pending_parents.pop()
8294
* ms_next_node = self._get_ms_node(next_node) # <<<<<<<<<<<<<<
8295
* if ms_next_node.completed:
8296
* # this parent was completed by a child on the
8298
__pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self->__pyx_vtab)->_get_ms_node(__pyx_v_self, __pyx_v_next_node)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8299
__Pyx_GOTREF(__pyx_t_4);
8300
__Pyx_DECREF(((PyObject *)__pyx_v_ms_next_node));
8301
__pyx_v_ms_next_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_t_4);
8304
/* "bzrlib/_known_graph_pyx.pyx":910
8305
* next_node = ms_last_node.pending_parents.pop()
8306
* ms_next_node = self._get_ms_node(next_node)
8307
* if ms_next_node.completed: # <<<<<<<<<<<<<<
8308
* # this parent was completed by a child on the
8309
* # call stack. skip it.
8311
if (__pyx_v_ms_next_node->completed) {
8313
/* "bzrlib/_known_graph_pyx.pyx":913
8314
* # this parent was completed by a child on the
8315
* # call stack. skip it.
8316
* continue # <<<<<<<<<<<<<<
8317
* # otherwise transfer it from the source graph into the
8318
* # top of the current depth first search stack.
8320
goto __pyx_L7_continue;
8325
/* "bzrlib/_known_graph_pyx.pyx":917
8326
* # top of the current depth first search stack.
8328
* if next_node is ms_last_node.left_parent: # <<<<<<<<<<<<<<
8329
* next_merge_depth = ms_last_node.merge_depth
8332
__pyx_t_2 = (__pyx_v_next_node == __pyx_v_ms_last_node->left_parent);
8335
/* "bzrlib/_known_graph_pyx.pyx":918
8337
* if next_node is ms_last_node.left_parent:
8338
* next_merge_depth = ms_last_node.merge_depth # <<<<<<<<<<<<<<
8340
* next_merge_depth = ms_last_node.merge_depth + 1
8342
__pyx_v_next_merge_depth = __pyx_v_ms_last_node->merge_depth;
8347
/* "bzrlib/_known_graph_pyx.pyx":920
8348
* next_merge_depth = ms_last_node.merge_depth
8350
* next_merge_depth = ms_last_node.merge_depth + 1 # <<<<<<<<<<<<<<
8351
* self._push_node(next_node, next_merge_depth)
8352
* # and do not continue processing parents until this 'call'
8354
__pyx_v_next_merge_depth = (__pyx_v_ms_last_node->merge_depth + 1);
8358
/* "bzrlib/_known_graph_pyx.pyx":921
8360
* next_merge_depth = ms_last_node.merge_depth + 1
8361
* self._push_node(next_node, next_merge_depth) # <<<<<<<<<<<<<<
8362
* # and do not continue processing parents until this 'call'
8365
__pyx_t_4 = ((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self->__pyx_vtab)->_push_node(__pyx_v_self, __pyx_v_next_node, __pyx_v_next_merge_depth); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8366
__Pyx_GOTREF(__pyx_t_4);
8367
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8369
/* "bzrlib/_known_graph_pyx.pyx":924
8370
* # and do not continue processing parents until this 'call'
8372
* break # <<<<<<<<<<<<<<
8374
* cdef topo_order(self):
8376
goto __pyx_L8_break;
8383
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
8386
__Pyx_XDECREF(__pyx_t_1);
8387
__Pyx_XDECREF(__pyx_t_3);
8388
__Pyx_XDECREF(__pyx_t_4);
8389
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSorter._schedule_stack");
8392
__Pyx_DECREF((PyObject *)__pyx_v_last_node);
8393
__Pyx_DECREF((PyObject *)__pyx_v_next_node);
8394
__Pyx_DECREF((PyObject *)__pyx_v_ms_last_node);
8395
__Pyx_DECREF((PyObject *)__pyx_v_ms_next_node);
8396
__Pyx_DECREF(__pyx_v_ordered);
8397
__Pyx_XGIVEREF(__pyx_r);
8398
__Pyx_RefNannyFinishContext();
8402
/* "bzrlib/_known_graph_pyx.pyx":926
8405
* cdef topo_order(self): # <<<<<<<<<<<<<<
8406
* cdef _MergeSortNode ms_node
8407
* cdef _KnownGraphNode node
8410
static PyObject *__pyx_f_6bzrlib_16_known_graph_pyx_12_MergeSorter_topo_order(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *__pyx_v_self) {
8411
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *__pyx_v_ms_node;
8412
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *__pyx_v_node;
8413
Py_ssize_t __pyx_v_pos;
8414
PyObject *__pyx_v_ordered;
8415
PyObject *__pyx_r = NULL;
8416
PyObject *__pyx_t_1 = NULL;
8417
PyObject *__pyx_t_2 = NULL;
8418
PyObject *__pyx_t_3 = NULL;
8420
__Pyx_RefNannySetupContext("topo_order");
8421
__pyx_v_ms_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)Py_None); __Pyx_INCREF(Py_None);
8422
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); __Pyx_INCREF(Py_None);
8423
__pyx_v_ordered = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
8425
/* "bzrlib/_known_graph_pyx.pyx":936
8426
* # We might consider moving the attributes into the base
8427
* # KnownGraph object.
8428
* self._schedule_stack() # <<<<<<<<<<<<<<
8430
* # We've set up the basic schedule, now we can continue processing the
8432
__pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSorter *)__pyx_v_self->__pyx_vtab)->_schedule_stack(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8433
__Pyx_GOTREF(__pyx_t_1);
8434
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8436
/* "bzrlib/_known_graph_pyx.pyx":946
8437
* # 7ms is computing the return tuple
8438
* # 4ms is PyList_Append()
8439
* ordered = [] # <<<<<<<<<<<<<<
8440
* # output the result in reverse order, and separate the generated info
8441
* for pos from PyList_GET_SIZE(self._scheduled_nodes) > pos >= 0:
8443
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8444
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
8445
__Pyx_DECREF(((PyObject *)__pyx_v_ordered));
8446
__pyx_v_ordered = __pyx_t_1;
8449
/* "bzrlib/_known_graph_pyx.pyx":948
8451
* # output the result in reverse order, and separate the generated info
8452
* for pos from PyList_GET_SIZE(self._scheduled_nodes) > pos >= 0: # <<<<<<<<<<<<<<
8453
* node = _get_list_node(self._scheduled_nodes, pos)
8454
* ms_node = <_MergeSortNode>node.extra
8456
__pyx_t_1 = __pyx_v_self->_scheduled_nodes;
8457
__Pyx_INCREF(__pyx_t_1);
8458
for (__pyx_v_pos = PyList_GET_SIZE(__pyx_t_1)-1; __pyx_v_pos >= 0; __pyx_v_pos--) {
8460
/* "bzrlib/_known_graph_pyx.pyx":949
8461
* # output the result in reverse order, and separate the generated info
8462
* for pos from PyList_GET_SIZE(self._scheduled_nodes) > pos >= 0:
8463
* node = _get_list_node(self._scheduled_nodes, pos) # <<<<<<<<<<<<<<
8464
* ms_node = <_MergeSortNode>node.extra
8465
* PyList_Append(ordered, ms_node)
8467
__pyx_t_2 = __pyx_v_self->_scheduled_nodes;
8468
__Pyx_INCREF(__pyx_t_2);
8469
__pyx_t_3 = ((PyObject *)__pyx_f_6bzrlib_16_known_graph_pyx__get_list_node(__pyx_t_2, __pyx_v_pos)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8470
__Pyx_GOTREF(__pyx_t_3);
8471
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8472
__Pyx_DECREF(((PyObject *)__pyx_v_node));
8473
__pyx_v_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)__pyx_t_3);
8476
/* "bzrlib/_known_graph_pyx.pyx":950
8477
* for pos from PyList_GET_SIZE(self._scheduled_nodes) > pos >= 0:
8478
* node = _get_list_node(self._scheduled_nodes, pos)
8479
* ms_node = <_MergeSortNode>node.extra # <<<<<<<<<<<<<<
8480
* PyList_Append(ordered, ms_node)
8483
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_node->extra)));
8484
__Pyx_DECREF(((PyObject *)__pyx_v_ms_node));
8485
__pyx_v_ms_node = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)__pyx_v_node->extra);
8487
/* "bzrlib/_known_graph_pyx.pyx":951
8488
* node = _get_list_node(self._scheduled_nodes, pos)
8489
* ms_node = <_MergeSortNode>node.extra
8490
* PyList_Append(ordered, ms_node) # <<<<<<<<<<<<<<
8492
* # Clear out the scheduled nodes now that we're done
8494
__pyx_t_4 = PyList_Append(((PyObject *)__pyx_v_ordered), ((PyObject *)__pyx_v_ms_node)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8496
/* "bzrlib/_known_graph_pyx.pyx":952
8497
* ms_node = <_MergeSortNode>node.extra
8498
* PyList_Append(ordered, ms_node)
8499
* node.extra = None # <<<<<<<<<<<<<<
8500
* # Clear out the scheduled nodes now that we're done
8501
* self._scheduled_nodes = []
8503
__Pyx_INCREF(Py_None);
8504
__Pyx_GIVEREF(Py_None);
8505
__Pyx_GOTREF(__pyx_v_node->extra);
8506
__Pyx_DECREF(__pyx_v_node->extra);
8507
__pyx_v_node->extra = Py_None;
8509
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8511
/* "bzrlib/_known_graph_pyx.pyx":954
8513
* # Clear out the scheduled nodes now that we're done
8514
* self._scheduled_nodes = [] # <<<<<<<<<<<<<<
8517
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
8518
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
8519
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
8520
__Pyx_GOTREF(__pyx_v_self->_scheduled_nodes);
8521
__Pyx_DECREF(__pyx_v_self->_scheduled_nodes);
8522
__pyx_v_self->_scheduled_nodes = ((PyObject *)__pyx_t_1);
8525
/* "bzrlib/_known_graph_pyx.pyx":955
8526
* # Clear out the scheduled nodes now that we're done
8527
* self._scheduled_nodes = []
8528
* return ordered # <<<<<<<<<<<<<<
8530
__Pyx_XDECREF(__pyx_r);
8531
__Pyx_INCREF(((PyObject *)__pyx_v_ordered));
8532
__pyx_r = ((PyObject *)__pyx_v_ordered);
8535
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
8538
__Pyx_XDECREF(__pyx_t_1);
8539
__Pyx_XDECREF(__pyx_t_2);
8540
__Pyx_XDECREF(__pyx_t_3);
8541
__Pyx_AddTraceback("bzrlib._known_graph_pyx._MergeSorter.topo_order");
8544
__Pyx_DECREF((PyObject *)__pyx_v_ms_node);
8545
__Pyx_DECREF((PyObject *)__pyx_v_node);
8546
__Pyx_DECREF(__pyx_v_ordered);
8547
__Pyx_XGIVEREF(__pyx_r);
8548
__Pyx_RefNannyFinishContext();
8551
static struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__KnownGraphNode __pyx_vtable_6bzrlib_16_known_graph_pyx__KnownGraphNode;
8553
static PyObject *__pyx_tp_new_6bzrlib_16_known_graph_pyx__KnownGraphNode(PyTypeObject *t, PyObject *a, PyObject *k) {
8554
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *p;
8555
PyObject *o = (*t->tp_alloc)(t, 0);
8557
p = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)o);
8558
p->__pyx_vtab = __pyx_vtabptr_6bzrlib_16_known_graph_pyx__KnownGraphNode;
8559
p->key = Py_None; Py_INCREF(Py_None);
8560
p->parents = Py_None; Py_INCREF(Py_None);
8561
p->children = Py_None; Py_INCREF(Py_None);
8562
p->extra = Py_None; Py_INCREF(Py_None);
8566
static void __pyx_tp_dealloc_6bzrlib_16_known_graph_pyx__KnownGraphNode(PyObject *o) {
8567
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *p = (struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)o;
8569
Py_XDECREF(p->parents);
8570
Py_XDECREF(p->children);
8571
Py_XDECREF(p->extra);
8572
(*Py_TYPE(o)->tp_free)(o);
8575
static int __pyx_tp_traverse_6bzrlib_16_known_graph_pyx__KnownGraphNode(PyObject *o, visitproc v, void *a) {
8577
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *p = (struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)o;
8579
e = (*v)(p->key, a); if (e) return e;
8582
e = (*v)(p->parents, a); if (e) return e;
8585
e = (*v)(p->children, a); if (e) return e;
8588
e = (*v)(p->extra, a); if (e) return e;
8593
static int __pyx_tp_clear_6bzrlib_16_known_graph_pyx__KnownGraphNode(PyObject *o) {
8594
struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *p = (struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)o;
8596
tmp = ((PyObject*)p->key);
8597
p->key = Py_None; Py_INCREF(Py_None);
8599
tmp = ((PyObject*)p->parents);
8600
p->parents = Py_None; Py_INCREF(Py_None);
8602
tmp = ((PyObject*)p->children);
8603
p->children = Py_None; Py_INCREF(Py_None);
8605
tmp = ((PyObject*)p->extra);
8606
p->extra = Py_None; Py_INCREF(Py_None);
8611
static PyObject *__pyx_getprop_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_child_keys(PyObject *o, void *x) {
8612
return __pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_10child_keys___get__(o);
8615
static PyObject *__pyx_getprop_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_parent_keys(PyObject *o, void *x) {
8616
return __pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_11parent_keys___get__(o);
8619
static PyObject *__pyx_getprop_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_gdfo(PyObject *o, void *x) {
8620
return __pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_4gdfo___get__(o);
8623
static int __pyx_setprop_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_gdfo(PyObject *o, PyObject *v, void *x) {
8625
return __pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_4gdfo_1__set__(o, v);
8628
PyErr_SetString(PyExc_NotImplementedError, "__del__");
8633
static PyMethodDef __pyx_methods_6bzrlib_16_known_graph_pyx__KnownGraphNode[] = {
8637
static struct PyGetSetDef __pyx_getsets_6bzrlib_16_known_graph_pyx__KnownGraphNode[] = {
8638
{(char *)"child_keys", __pyx_getprop_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_child_keys, 0, 0, 0},
8639
{(char *)"parent_keys", __pyx_getprop_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_parent_keys, 0, 0, 0},
8640
{(char *)"gdfo", __pyx_getprop_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_gdfo, __pyx_setprop_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_gdfo, 0, 0},
8644
static PyNumberMethods __pyx_tp_as_number__KnownGraphNode = {
8648
#if PY_MAJOR_VERSION < 3
8664
#if PY_MAJOR_VERSION < 3
8668
#if PY_MAJOR_VERSION < 3
8674
#if PY_MAJOR_VERSION < 3
8677
#if PY_MAJOR_VERSION < 3
8680
0, /*nb_inplace_add*/
8681
0, /*nb_inplace_subtract*/
8682
0, /*nb_inplace_multiply*/
8683
#if PY_MAJOR_VERSION < 3
8684
0, /*nb_inplace_divide*/
8686
0, /*nb_inplace_remainder*/
8687
0, /*nb_inplace_power*/
8688
0, /*nb_inplace_lshift*/
8689
0, /*nb_inplace_rshift*/
8690
0, /*nb_inplace_and*/
8691
0, /*nb_inplace_xor*/
8692
0, /*nb_inplace_or*/
8693
0, /*nb_floor_divide*/
8694
0, /*nb_true_divide*/
8695
0, /*nb_inplace_floor_divide*/
8696
0, /*nb_inplace_true_divide*/
8697
#if PY_VERSION_HEX >= 0x02050000
8702
static PySequenceMethods __pyx_tp_as_sequence__KnownGraphNode = {
8711
0, /*sq_inplace_concat*/
8712
0, /*sq_inplace_repeat*/
8715
static PyMappingMethods __pyx_tp_as_mapping__KnownGraphNode = {
8718
0, /*mp_ass_subscript*/
8721
static PyBufferProcs __pyx_tp_as_buffer__KnownGraphNode = {
8722
#if PY_MAJOR_VERSION < 3
8723
0, /*bf_getreadbuffer*/
8725
#if PY_MAJOR_VERSION < 3
8726
0, /*bf_getwritebuffer*/
8728
#if PY_MAJOR_VERSION < 3
8729
0, /*bf_getsegcount*/
8731
#if PY_MAJOR_VERSION < 3
8732
0, /*bf_getcharbuffer*/
8734
#if PY_VERSION_HEX >= 0x02060000
8737
#if PY_VERSION_HEX >= 0x02060000
8738
0, /*bf_releasebuffer*/
8742
static PyTypeObject __pyx_type_6bzrlib_16_known_graph_pyx__KnownGraphNode = {
8743
PyVarObject_HEAD_INIT(0, 0)
8744
__Pyx_NAMESTR("bzrlib._known_graph_pyx._KnownGraphNode"), /*tp_name*/
8745
sizeof(struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode), /*tp_basicsize*/
8747
__pyx_tp_dealloc_6bzrlib_16_known_graph_pyx__KnownGraphNode, /*tp_dealloc*/
8751
#if PY_MAJOR_VERSION < 3
8756
__pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_1__repr__, /*tp_repr*/
8757
&__pyx_tp_as_number__KnownGraphNode, /*tp_as_number*/
8758
&__pyx_tp_as_sequence__KnownGraphNode, /*tp_as_sequence*/
8759
&__pyx_tp_as_mapping__KnownGraphNode, /*tp_as_mapping*/
8765
&__pyx_tp_as_buffer__KnownGraphNode, /*tp_as_buffer*/
8766
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
8767
__Pyx_DOCSTR("Represents a single object in the known graph."), /*tp_doc*/
8768
__pyx_tp_traverse_6bzrlib_16_known_graph_pyx__KnownGraphNode, /*tp_traverse*/
8769
__pyx_tp_clear_6bzrlib_16_known_graph_pyx__KnownGraphNode, /*tp_clear*/
8770
0, /*tp_richcompare*/
8771
0, /*tp_weaklistoffset*/
8774
__pyx_methods_6bzrlib_16_known_graph_pyx__KnownGraphNode, /*tp_methods*/
8776
__pyx_getsets_6bzrlib_16_known_graph_pyx__KnownGraphNode, /*tp_getset*/
8781
0, /*tp_dictoffset*/
8782
__pyx_pf_6bzrlib_16_known_graph_pyx_15_KnownGraphNode___init__, /*tp_init*/
8784
__pyx_tp_new_6bzrlib_16_known_graph_pyx__KnownGraphNode, /*tp_new*/
8790
0, /*tp_subclasses*/
8793
#if PY_VERSION_HEX >= 0x02060000
8794
0, /*tp_version_tag*/
8797
static struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSorter __pyx_vtable_6bzrlib_16_known_graph_pyx__MergeSorter;
8799
static PyObject *__pyx_tp_new_6bzrlib_16_known_graph_pyx__MergeSorter(PyTypeObject *t, PyObject *a, PyObject *k) {
8800
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *p;
8801
PyObject *o = (*t->tp_alloc)(t, 0);
8803
p = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)o);
8804
p->__pyx_vtab = __pyx_vtabptr_6bzrlib_16_known_graph_pyx__MergeSorter;
8805
p->graph = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)Py_None); Py_INCREF(Py_None);
8806
p->_depth_first_stack = Py_None; Py_INCREF(Py_None);
8807
p->_revno_to_branch_count = Py_None; Py_INCREF(Py_None);
8808
p->_scheduled_nodes = Py_None; Py_INCREF(Py_None);
8812
static void __pyx_tp_dealloc_6bzrlib_16_known_graph_pyx__MergeSorter(PyObject *o) {
8813
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *p = (struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)o;
8814
Py_XDECREF(((PyObject *)p->graph));
8815
Py_XDECREF(p->_depth_first_stack);
8816
Py_XDECREF(p->_revno_to_branch_count);
8817
Py_XDECREF(p->_scheduled_nodes);
8818
(*Py_TYPE(o)->tp_free)(o);
8821
static int __pyx_tp_traverse_6bzrlib_16_known_graph_pyx__MergeSorter(PyObject *o, visitproc v, void *a) {
8823
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *p = (struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)o;
8825
e = (*v)(((PyObject*)p->graph), a); if (e) return e;
8827
if (p->_depth_first_stack) {
8828
e = (*v)(p->_depth_first_stack, a); if (e) return e;
8830
if (p->_revno_to_branch_count) {
8831
e = (*v)(p->_revno_to_branch_count, a); if (e) return e;
8833
if (p->_scheduled_nodes) {
8834
e = (*v)(p->_scheduled_nodes, a); if (e) return e;
8839
static int __pyx_tp_clear_6bzrlib_16_known_graph_pyx__MergeSorter(PyObject *o) {
8840
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *p = (struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *)o;
8842
tmp = ((PyObject*)p->graph);
8843
p->graph = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)Py_None); Py_INCREF(Py_None);
8845
tmp = ((PyObject*)p->_depth_first_stack);
8846
p->_depth_first_stack = Py_None; Py_INCREF(Py_None);
8848
tmp = ((PyObject*)p->_revno_to_branch_count);
8849
p->_revno_to_branch_count = Py_None; Py_INCREF(Py_None);
8851
tmp = ((PyObject*)p->_scheduled_nodes);
8852
p->_scheduled_nodes = Py_None; Py_INCREF(Py_None);
8857
static PyMethodDef __pyx_methods_6bzrlib_16_known_graph_pyx__MergeSorter[] = {
8861
static PyNumberMethods __pyx_tp_as_number__MergeSorter = {
8865
#if PY_MAJOR_VERSION < 3
8881
#if PY_MAJOR_VERSION < 3
8885
#if PY_MAJOR_VERSION < 3
8891
#if PY_MAJOR_VERSION < 3
8894
#if PY_MAJOR_VERSION < 3
8897
0, /*nb_inplace_add*/
8898
0, /*nb_inplace_subtract*/
8899
0, /*nb_inplace_multiply*/
8900
#if PY_MAJOR_VERSION < 3
8901
0, /*nb_inplace_divide*/
8903
0, /*nb_inplace_remainder*/
8904
0, /*nb_inplace_power*/
8905
0, /*nb_inplace_lshift*/
8906
0, /*nb_inplace_rshift*/
8907
0, /*nb_inplace_and*/
8908
0, /*nb_inplace_xor*/
8909
0, /*nb_inplace_or*/
8910
0, /*nb_floor_divide*/
8911
0, /*nb_true_divide*/
8912
0, /*nb_inplace_floor_divide*/
8913
0, /*nb_inplace_true_divide*/
8914
#if PY_VERSION_HEX >= 0x02050000
8919
static PySequenceMethods __pyx_tp_as_sequence__MergeSorter = {
8928
0, /*sq_inplace_concat*/
8929
0, /*sq_inplace_repeat*/
8932
static PyMappingMethods __pyx_tp_as_mapping__MergeSorter = {
8935
0, /*mp_ass_subscript*/
8938
static PyBufferProcs __pyx_tp_as_buffer__MergeSorter = {
8939
#if PY_MAJOR_VERSION < 3
8940
0, /*bf_getreadbuffer*/
8942
#if PY_MAJOR_VERSION < 3
8943
0, /*bf_getwritebuffer*/
8945
#if PY_MAJOR_VERSION < 3
8946
0, /*bf_getsegcount*/
8948
#if PY_MAJOR_VERSION < 3
8949
0, /*bf_getcharbuffer*/
8951
#if PY_VERSION_HEX >= 0x02060000
8954
#if PY_VERSION_HEX >= 0x02060000
8955
0, /*bf_releasebuffer*/
8959
static PyTypeObject __pyx_type_6bzrlib_16_known_graph_pyx__MergeSorter = {
8960
PyVarObject_HEAD_INIT(0, 0)
8961
__Pyx_NAMESTR("bzrlib._known_graph_pyx._MergeSorter"), /*tp_name*/
8962
sizeof(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter), /*tp_basicsize*/
8964
__pyx_tp_dealloc_6bzrlib_16_known_graph_pyx__MergeSorter, /*tp_dealloc*/
8968
#if PY_MAJOR_VERSION < 3
8974
&__pyx_tp_as_number__MergeSorter, /*tp_as_number*/
8975
&__pyx_tp_as_sequence__MergeSorter, /*tp_as_sequence*/
8976
&__pyx_tp_as_mapping__MergeSorter, /*tp_as_mapping*/
8982
&__pyx_tp_as_buffer__MergeSorter, /*tp_as_buffer*/
8983
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
8984
__Pyx_DOCSTR("This class does the work of computing the merge_sort ordering.\n\n We have some small advantages, in that we get all the extra information\n that KnownGraph knows, like knowing the child lists, etc.\n "), /*tp_doc*/
8985
__pyx_tp_traverse_6bzrlib_16_known_graph_pyx__MergeSorter, /*tp_traverse*/
8986
__pyx_tp_clear_6bzrlib_16_known_graph_pyx__MergeSorter, /*tp_clear*/
8987
0, /*tp_richcompare*/
8988
0, /*tp_weaklistoffset*/
8991
__pyx_methods_6bzrlib_16_known_graph_pyx__MergeSorter, /*tp_methods*/
8998
0, /*tp_dictoffset*/
8999
__pyx_pf_6bzrlib_16_known_graph_pyx_12_MergeSorter___init__, /*tp_init*/
9001
__pyx_tp_new_6bzrlib_16_known_graph_pyx__MergeSorter, /*tp_new*/
9007
0, /*tp_subclasses*/
9010
#if PY_VERSION_HEX >= 0x02060000
9011
0, /*tp_version_tag*/
9014
static struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx_KnownGraph __pyx_vtable_6bzrlib_16_known_graph_pyx_KnownGraph;
9016
static PyObject *__pyx_tp_new_6bzrlib_16_known_graph_pyx_KnownGraph(PyTypeObject *t, PyObject *a, PyObject *k) {
9017
struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *p;
9018
PyObject *o = (*t->tp_alloc)(t, 0);
9020
p = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)o);
9021
p->__pyx_vtab = __pyx_vtabptr_6bzrlib_16_known_graph_pyx_KnownGraph;
9022
p->_nodes = Py_None; Py_INCREF(Py_None);
9023
p->_known_heads = Py_None; Py_INCREF(Py_None);
9027
static void __pyx_tp_dealloc_6bzrlib_16_known_graph_pyx_KnownGraph(PyObject *o) {
9028
struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *p = (struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)o;
9030
PyObject *etype, *eval, *etb;
9031
PyErr_Fetch(&etype, &eval, &etb);
9033
__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_1__dealloc__(o);
9034
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
9036
PyErr_Restore(etype, eval, etb);
9038
Py_XDECREF(p->_nodes);
9039
Py_XDECREF(p->_known_heads);
9040
(*Py_TYPE(o)->tp_free)(o);
9043
static int __pyx_tp_traverse_6bzrlib_16_known_graph_pyx_KnownGraph(PyObject *o, visitproc v, void *a) {
9045
struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *p = (struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)o;
9047
e = (*v)(p->_nodes, a); if (e) return e;
9049
if (p->_known_heads) {
9050
e = (*v)(p->_known_heads, a); if (e) return e;
9055
static int __pyx_tp_clear_6bzrlib_16_known_graph_pyx_KnownGraph(PyObject *o) {
9056
struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *p = (struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *)o;
9058
tmp = ((PyObject*)p->_nodes);
9059
p->_nodes = Py_None; Py_INCREF(Py_None);
9061
tmp = ((PyObject*)p->_known_heads);
9062
p->_known_heads = Py_None; Py_INCREF(Py_None);
9067
static PyObject *__pyx_getprop_6bzrlib_16_known_graph_pyx_10KnownGraph__nodes(PyObject *o, void *x) {
9068
return __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_6_nodes___get__(o);
9071
static int __pyx_setprop_6bzrlib_16_known_graph_pyx_10KnownGraph__nodes(PyObject *o, PyObject *v, void *x) {
9073
return __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_6_nodes_1__set__(o, v);
9076
return __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_6_nodes_2__del__(o);
9080
static PyObject *__pyx_getprop_6bzrlib_16_known_graph_pyx_10KnownGraph__known_heads(PyObject *o, void *x) {
9081
return __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_12_known_heads___get__(o);
9084
static int __pyx_setprop_6bzrlib_16_known_graph_pyx_10KnownGraph__known_heads(PyObject *o, PyObject *v, void *x) {
9086
return __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_12_known_heads_1__set__(o, v);
9089
return __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_12_known_heads_2__del__(o);
9093
static PyObject *__pyx_getprop_6bzrlib_16_known_graph_pyx_10KnownGraph_do_cache(PyObject *o, void *x) {
9094
return __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_8do_cache___get__(o);
9097
static int __pyx_setprop_6bzrlib_16_known_graph_pyx_10KnownGraph_do_cache(PyObject *o, PyObject *v, void *x) {
9099
return __pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_8do_cache_1__set__(o, v);
9102
PyErr_SetString(PyExc_NotImplementedError, "__del__");
9107
static PyMethodDef __pyx_methods_6bzrlib_16_known_graph_pyx_KnownGraph[] = {
9108
{__Pyx_NAMESTR("_initialize_nodes"), (PyCFunction)__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_2_initialize_nodes, METH_O, __Pyx_DOCSTR(__pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_2_initialize_nodes)},
9109
{__Pyx_NAMESTR("_find_tails"), (PyCFunction)__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_3_find_tails, METH_NOARGS, __Pyx_DOCSTR(0)},
9110
{__Pyx_NAMESTR("_find_tips"), (PyCFunction)__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_4_find_tips, METH_NOARGS, __Pyx_DOCSTR(0)},
9111
{__Pyx_NAMESTR("_find_gdfo"), (PyCFunction)__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_5_find_gdfo, METH_NOARGS, __Pyx_DOCSTR(0)},
9112
{__Pyx_NAMESTR("add_node"), (PyCFunction)__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_6add_node, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_6add_node)},
9113
{__Pyx_NAMESTR("heads"), (PyCFunction)__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_7heads, METH_O, __Pyx_DOCSTR(__pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_7heads)},
9114
{__Pyx_NAMESTR("topo_sort"), (PyCFunction)__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_8topo_sort, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_8topo_sort)},
9115
{__Pyx_NAMESTR("gc_sort"), (PyCFunction)__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_9gc_sort, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_9gc_sort)},
9116
{__Pyx_NAMESTR("merge_sort"), (PyCFunction)__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_10merge_sort, METH_O, __Pyx_DOCSTR(__pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_10merge_sort)},
9117
{__Pyx_NAMESTR("get_parent_keys"), (PyCFunction)__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_11get_parent_keys, METH_O, __Pyx_DOCSTR(__pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_11get_parent_keys)},
9118
{__Pyx_NAMESTR("get_child_keys"), (PyCFunction)__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph_12get_child_keys, METH_O, __Pyx_DOCSTR(__pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph_12get_child_keys)},
9122
static struct PyGetSetDef __pyx_getsets_6bzrlib_16_known_graph_pyx_KnownGraph[] = {
9123
{(char *)"_nodes", __pyx_getprop_6bzrlib_16_known_graph_pyx_10KnownGraph__nodes, __pyx_setprop_6bzrlib_16_known_graph_pyx_10KnownGraph__nodes, 0, 0},
9124
{(char *)"_known_heads", __pyx_getprop_6bzrlib_16_known_graph_pyx_10KnownGraph__known_heads, __pyx_setprop_6bzrlib_16_known_graph_pyx_10KnownGraph__known_heads, 0, 0},
9125
{(char *)"do_cache", __pyx_getprop_6bzrlib_16_known_graph_pyx_10KnownGraph_do_cache, __pyx_setprop_6bzrlib_16_known_graph_pyx_10KnownGraph_do_cache, 0, 0},
9129
static PyNumberMethods __pyx_tp_as_number_KnownGraph = {
9133
#if PY_MAJOR_VERSION < 3
9149
#if PY_MAJOR_VERSION < 3
9153
#if PY_MAJOR_VERSION < 3
9159
#if PY_MAJOR_VERSION < 3
9162
#if PY_MAJOR_VERSION < 3
9165
0, /*nb_inplace_add*/
9166
0, /*nb_inplace_subtract*/
9167
0, /*nb_inplace_multiply*/
9168
#if PY_MAJOR_VERSION < 3
9169
0, /*nb_inplace_divide*/
9171
0, /*nb_inplace_remainder*/
9172
0, /*nb_inplace_power*/
9173
0, /*nb_inplace_lshift*/
9174
0, /*nb_inplace_rshift*/
9175
0, /*nb_inplace_and*/
9176
0, /*nb_inplace_xor*/
9177
0, /*nb_inplace_or*/
9178
0, /*nb_floor_divide*/
9179
0, /*nb_true_divide*/
9180
0, /*nb_inplace_floor_divide*/
9181
0, /*nb_inplace_true_divide*/
9182
#if PY_VERSION_HEX >= 0x02050000
9187
static PySequenceMethods __pyx_tp_as_sequence_KnownGraph = {
9196
0, /*sq_inplace_concat*/
9197
0, /*sq_inplace_repeat*/
9200
static PyMappingMethods __pyx_tp_as_mapping_KnownGraph = {
9203
0, /*mp_ass_subscript*/
9206
static PyBufferProcs __pyx_tp_as_buffer_KnownGraph = {
9207
#if PY_MAJOR_VERSION < 3
9208
0, /*bf_getreadbuffer*/
9210
#if PY_MAJOR_VERSION < 3
9211
0, /*bf_getwritebuffer*/
9213
#if PY_MAJOR_VERSION < 3
9214
0, /*bf_getsegcount*/
9216
#if PY_MAJOR_VERSION < 3
9217
0, /*bf_getcharbuffer*/
9219
#if PY_VERSION_HEX >= 0x02060000
9222
#if PY_VERSION_HEX >= 0x02060000
9223
0, /*bf_releasebuffer*/
9227
static PyTypeObject __pyx_type_6bzrlib_16_known_graph_pyx_KnownGraph = {
9228
PyVarObject_HEAD_INIT(0, 0)
9229
__Pyx_NAMESTR("bzrlib._known_graph_pyx.KnownGraph"), /*tp_name*/
9230
sizeof(struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph), /*tp_basicsize*/
9232
__pyx_tp_dealloc_6bzrlib_16_known_graph_pyx_KnownGraph, /*tp_dealloc*/
9236
#if PY_MAJOR_VERSION < 3
9242
&__pyx_tp_as_number_KnownGraph, /*tp_as_number*/
9243
&__pyx_tp_as_sequence_KnownGraph, /*tp_as_sequence*/
9244
&__pyx_tp_as_mapping_KnownGraph, /*tp_as_mapping*/
9250
&__pyx_tp_as_buffer_KnownGraph, /*tp_as_buffer*/
9251
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
9252
__Pyx_DOCSTR("This is a class which assumes we already know the full graph."), /*tp_doc*/
9253
__pyx_tp_traverse_6bzrlib_16_known_graph_pyx_KnownGraph, /*tp_traverse*/
9254
__pyx_tp_clear_6bzrlib_16_known_graph_pyx_KnownGraph, /*tp_clear*/
9255
0, /*tp_richcompare*/
9256
0, /*tp_weaklistoffset*/
9259
__pyx_methods_6bzrlib_16_known_graph_pyx_KnownGraph, /*tp_methods*/
9261
__pyx_getsets_6bzrlib_16_known_graph_pyx_KnownGraph, /*tp_getset*/
9266
0, /*tp_dictoffset*/
9267
__pyx_pf_6bzrlib_16_known_graph_pyx_10KnownGraph___init__, /*tp_init*/
9269
__pyx_tp_new_6bzrlib_16_known_graph_pyx_KnownGraph, /*tp_new*/
9275
0, /*tp_subclasses*/
9278
#if PY_VERSION_HEX >= 0x02060000
9279
0, /*tp_version_tag*/
9282
static struct __pyx_vtabstruct_6bzrlib_16_known_graph_pyx__MergeSortNode __pyx_vtable_6bzrlib_16_known_graph_pyx__MergeSortNode;
9284
static PyObject *__pyx_tp_new_6bzrlib_16_known_graph_pyx__MergeSortNode(PyTypeObject *t, PyObject *a, PyObject *k) {
9285
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *p;
9286
PyObject *o = (*t->tp_alloc)(t, 0);
9288
p = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)o);
9289
p->__pyx_vtab = __pyx_vtabptr_6bzrlib_16_known_graph_pyx__MergeSortNode;
9290
p->key = Py_None; Py_INCREF(Py_None);
9291
p->end_of_merge = Py_None; Py_INCREF(Py_None);
9292
p->left_parent = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); Py_INCREF(Py_None);
9293
p->left_pending_parent = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); Py_INCREF(Py_None);
9294
p->pending_parents = Py_None; Py_INCREF(Py_None);
9298
static void __pyx_tp_dealloc_6bzrlib_16_known_graph_pyx__MergeSortNode(PyObject *o) {
9299
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *p = (struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)o;
9301
Py_XDECREF(p->end_of_merge);
9302
Py_XDECREF(((PyObject *)p->left_parent));
9303
Py_XDECREF(((PyObject *)p->left_pending_parent));
9304
Py_XDECREF(p->pending_parents);
9305
(*Py_TYPE(o)->tp_free)(o);
9308
static int __pyx_tp_traverse_6bzrlib_16_known_graph_pyx__MergeSortNode(PyObject *o, visitproc v, void *a) {
9310
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *p = (struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)o;
9312
e = (*v)(p->key, a); if (e) return e;
9314
if (p->end_of_merge) {
9315
e = (*v)(p->end_of_merge, a); if (e) return e;
9317
if (p->left_parent) {
9318
e = (*v)(((PyObject*)p->left_parent), a); if (e) return e;
9320
if (p->left_pending_parent) {
9321
e = (*v)(((PyObject*)p->left_pending_parent), a); if (e) return e;
9323
if (p->pending_parents) {
9324
e = (*v)(p->pending_parents, a); if (e) return e;
9329
static int __pyx_tp_clear_6bzrlib_16_known_graph_pyx__MergeSortNode(PyObject *o) {
9330
struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *p = (struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *)o;
9332
tmp = ((PyObject*)p->key);
9333
p->key = Py_None; Py_INCREF(Py_None);
9335
tmp = ((PyObject*)p->end_of_merge);
9336
p->end_of_merge = Py_None; Py_INCREF(Py_None);
9338
tmp = ((PyObject*)p->left_parent);
9339
p->left_parent = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); Py_INCREF(Py_None);
9341
tmp = ((PyObject*)p->left_pending_parent);
9342
p->left_pending_parent = ((struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *)Py_None); Py_INCREF(Py_None);
9344
tmp = ((PyObject*)p->pending_parents);
9345
p->pending_parents = Py_None; Py_INCREF(Py_None);
9350
static PyObject *__pyx_getprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_revno(PyObject *o, void *x) {
9351
return __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_5revno___get__(o);
9354
static PyObject *__pyx_getprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_key(PyObject *o, void *x) {
9355
return __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_3key___get__(o);
9358
static int __pyx_setprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_key(PyObject *o, PyObject *v, void *x) {
9360
return __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_3key_1__set__(o, v);
9363
return __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_3key_2__del__(o);
9367
static PyObject *__pyx_getprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_merge_depth(PyObject *o, void *x) {
9368
return __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_11merge_depth___get__(o);
9371
static int __pyx_setprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_merge_depth(PyObject *o, PyObject *v, void *x) {
9373
return __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_11merge_depth_1__set__(o, v);
9376
PyErr_SetString(PyExc_NotImplementedError, "__del__");
9381
static PyObject *__pyx_getprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_end_of_merge(PyObject *o, void *x) {
9382
return __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_12end_of_merge___get__(o);
9385
static int __pyx_setprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_end_of_merge(PyObject *o, PyObject *v, void *x) {
9387
return __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_12end_of_merge_1__set__(o, v);
9390
return __pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_12end_of_merge_2__del__(o);
9394
static PyMethodDef __pyx_methods_6bzrlib_16_known_graph_pyx__MergeSortNode[] = {
9398
static struct PyGetSetDef __pyx_getsets_6bzrlib_16_known_graph_pyx__MergeSortNode[] = {
9399
{(char *)"revno", __pyx_getprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_revno, 0, 0, 0},
9400
{(char *)"key", __pyx_getprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_key, __pyx_setprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_key, 0, 0},
9401
{(char *)"merge_depth", __pyx_getprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_merge_depth, __pyx_setprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_merge_depth, 0, 0},
9402
{(char *)"end_of_merge", __pyx_getprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_end_of_merge, __pyx_setprop_6bzrlib_16_known_graph_pyx_14_MergeSortNode_end_of_merge, 0, 0},
9406
static PyNumberMethods __pyx_tp_as_number__MergeSortNode = {
9410
#if PY_MAJOR_VERSION < 3
9426
#if PY_MAJOR_VERSION < 3
9430
#if PY_MAJOR_VERSION < 3
9436
#if PY_MAJOR_VERSION < 3
9439
#if PY_MAJOR_VERSION < 3
9442
0, /*nb_inplace_add*/
9443
0, /*nb_inplace_subtract*/
9444
0, /*nb_inplace_multiply*/
9445
#if PY_MAJOR_VERSION < 3
9446
0, /*nb_inplace_divide*/
9448
0, /*nb_inplace_remainder*/
9449
0, /*nb_inplace_power*/
9450
0, /*nb_inplace_lshift*/
9451
0, /*nb_inplace_rshift*/
9452
0, /*nb_inplace_and*/
9453
0, /*nb_inplace_xor*/
9454
0, /*nb_inplace_or*/
9455
0, /*nb_floor_divide*/
9456
0, /*nb_true_divide*/
9457
0, /*nb_inplace_floor_divide*/
9458
0, /*nb_inplace_true_divide*/
9459
#if PY_VERSION_HEX >= 0x02050000
9464
static PySequenceMethods __pyx_tp_as_sequence__MergeSortNode = {
9473
0, /*sq_inplace_concat*/
9474
0, /*sq_inplace_repeat*/
9477
static PyMappingMethods __pyx_tp_as_mapping__MergeSortNode = {
9480
0, /*mp_ass_subscript*/
9483
static PyBufferProcs __pyx_tp_as_buffer__MergeSortNode = {
9484
#if PY_MAJOR_VERSION < 3
9485
0, /*bf_getreadbuffer*/
9487
#if PY_MAJOR_VERSION < 3
9488
0, /*bf_getwritebuffer*/
9490
#if PY_MAJOR_VERSION < 3
9491
0, /*bf_getsegcount*/
9493
#if PY_MAJOR_VERSION < 3
9494
0, /*bf_getcharbuffer*/
9496
#if PY_VERSION_HEX >= 0x02060000
9499
#if PY_VERSION_HEX >= 0x02060000
9500
0, /*bf_releasebuffer*/
9504
static PyTypeObject __pyx_type_6bzrlib_16_known_graph_pyx__MergeSortNode = {
9505
PyVarObject_HEAD_INIT(0, 0)
9506
__Pyx_NAMESTR("bzrlib._known_graph_pyx._MergeSortNode"), /*tp_name*/
9507
sizeof(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode), /*tp_basicsize*/
9509
__pyx_tp_dealloc_6bzrlib_16_known_graph_pyx__MergeSortNode, /*tp_dealloc*/
9513
#if PY_MAJOR_VERSION < 3
9518
__pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode_1__repr__, /*tp_repr*/
9519
&__pyx_tp_as_number__MergeSortNode, /*tp_as_number*/
9520
&__pyx_tp_as_sequence__MergeSortNode, /*tp_as_sequence*/
9521
&__pyx_tp_as_mapping__MergeSortNode, /*tp_as_mapping*/
9527
&__pyx_tp_as_buffer__MergeSortNode, /*tp_as_buffer*/
9528
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
9529
__Pyx_DOCSTR("Tracks information about a node during the merge_sort operation."), /*tp_doc*/
9530
__pyx_tp_traverse_6bzrlib_16_known_graph_pyx__MergeSortNode, /*tp_traverse*/
9531
__pyx_tp_clear_6bzrlib_16_known_graph_pyx__MergeSortNode, /*tp_clear*/
9532
0, /*tp_richcompare*/
9533
0, /*tp_weaklistoffset*/
9536
__pyx_methods_6bzrlib_16_known_graph_pyx__MergeSortNode, /*tp_methods*/
9538
__pyx_getsets_6bzrlib_16_known_graph_pyx__MergeSortNode, /*tp_getset*/
9543
0, /*tp_dictoffset*/
9544
__pyx_pf_6bzrlib_16_known_graph_pyx_14_MergeSortNode___init__, /*tp_init*/
9546
__pyx_tp_new_6bzrlib_16_known_graph_pyx__MergeSortNode, /*tp_new*/
9552
0, /*tp_subclasses*/
9555
#if PY_VERSION_HEX >= 0x02060000
9556
0, /*tp_version_tag*/
9560
static PyMethodDef __pyx_methods[] = {
9564
#if PY_MAJOR_VERSION >= 3
9565
static struct PyModuleDef __pyx_moduledef = {
9566
PyModuleDef_HEAD_INIT,
9567
__Pyx_NAMESTR("_known_graph_pyx"),
9568
__Pyx_DOCSTR(__pyx_k_14), /* m_doc */
9570
__pyx_methods /* m_methods */,
9571
NULL, /* m_reload */
9572
NULL, /* m_traverse */
9578
static __Pyx_StringTabEntry __pyx_string_tab[] = {
9579
{&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
9580
{&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
9581
{&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
9582
{&__pyx_n_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 1},
9583
{&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
9584
{&__pyx_n_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 1},
9585
{&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
9586
{&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
9587
{&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
9588
{&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
9589
{&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
9590
{&__pyx_n_s__GraphCycleError, __pyx_k__GraphCycleError, sizeof(__pyx_k__GraphCycleError), 0, 0, 1, 1},
9591
{&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
9592
{&__pyx_n_s__NULL_REVISION, __pyx_k__NULL_REVISION, sizeof(__pyx_k__NULL_REVISION), 0, 0, 1, 1},
9593
{&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
9594
{&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
9595
{&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
9596
{&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
9597
{&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
9598
{&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
9599
{&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
9600
{&__pyx_n_s___depth_first_stack, __pyx_k___depth_first_stack, sizeof(__pyx_k___depth_first_stack), 0, 0, 1, 1},
9601
{&__pyx_n_s___find_gdfo, __pyx_k___find_gdfo, sizeof(__pyx_k___find_gdfo), 0, 0, 1, 1},
9602
{&__pyx_n_s___find_tails, __pyx_k___find_tails, sizeof(__pyx_k___find_tails), 0, 0, 1, 1},
9603
{&__pyx_n_s___find_tips, __pyx_k___find_tips, sizeof(__pyx_k___find_tips), 0, 0, 1, 1},
9604
{&__pyx_n_s___get_ms_node, __pyx_k___get_ms_node, sizeof(__pyx_k___get_ms_node), 0, 0, 1, 1},
9605
{&__pyx_n_s___get_or_create_node, __pyx_k___get_or_create_node, sizeof(__pyx_k___get_or_create_node), 0, 0, 1, 1},
9606
{&__pyx_n_s___initialize_nodes, __pyx_k___initialize_nodes, sizeof(__pyx_k___initialize_nodes), 0, 0, 1, 1},
9607
{&__pyx_n_s___known_heads, __pyx_k___known_heads, sizeof(__pyx_k___known_heads), 0, 0, 1, 1},
9608
{&__pyx_n_s___last_stack_item, __pyx_k___last_stack_item, sizeof(__pyx_k___last_stack_item), 0, 0, 1, 1},
9609
{&__pyx_n_s___nodes, __pyx_k___nodes, sizeof(__pyx_k___nodes), 0, 0, 1, 1},
9610
{&__pyx_n_s___pop_node, __pyx_k___pop_node, sizeof(__pyx_k___pop_node), 0, 0, 1, 1},
9611
{&__pyx_n_s___populate_parents, __pyx_k___populate_parents, sizeof(__pyx_k___populate_parents), 0, 0, 1, 1},
9612
{&__pyx_n_s___push_node, __pyx_k___push_node, sizeof(__pyx_k___push_node), 0, 0, 1, 1},
9613
{&__pyx_n_s___revno, __pyx_k___revno, sizeof(__pyx_k___revno), 0, 0, 1, 1},
9614
{&__pyx_n_s___revno_first, __pyx_k___revno_first, sizeof(__pyx_k___revno_first), 0, 0, 1, 1},
9615
{&__pyx_n_s___revno_last, __pyx_k___revno_last, sizeof(__pyx_k___revno_last), 0, 0, 1, 1},
9616
{&__pyx_n_s___revno_second, __pyx_k___revno_second, sizeof(__pyx_k___revno_second), 0, 0, 1, 1},
9617
{&__pyx_n_s___schedule_stack, __pyx_k___schedule_stack, sizeof(__pyx_k___schedule_stack), 0, 0, 1, 1},
9618
{&__pyx_n_s___scheduled_nodes, __pyx_k___scheduled_nodes, sizeof(__pyx_k___scheduled_nodes), 0, 0, 1, 1},
9619
{&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1},
9620
{&__pyx_n_s__bzrlib, __pyx_k__bzrlib, sizeof(__pyx_k__bzrlib), 0, 0, 1, 1},
9621
{&__pyx_n_s__child_keys, __pyx_k__child_keys, sizeof(__pyx_k__child_keys), 0, 0, 1, 1},
9622
{&__pyx_n_s__children, __pyx_k__children, sizeof(__pyx_k__children), 0, 0, 1, 1},
9623
{&__pyx_n_s__clear, __pyx_k__clear, sizeof(__pyx_k__clear), 0, 0, 1, 1},
9624
{&__pyx_n_s__clear_references, __pyx_k__clear_references, sizeof(__pyx_k__clear_references), 0, 0, 1, 1},
9625
{&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1},
9626
{&__pyx_n_s__completed, __pyx_k__completed, sizeof(__pyx_k__completed), 0, 0, 1, 1},
9627
{&__pyx_n_s__deque, __pyx_k__deque, sizeof(__pyx_k__deque), 0, 0, 1, 1},
9628
{&__pyx_n_s__do_cache, __pyx_k__do_cache, sizeof(__pyx_k__do_cache), 0, 0, 1, 1},
9629
{&__pyx_n_s__end_of_merge, __pyx_k__end_of_merge, sizeof(__pyx_k__end_of_merge), 0, 0, 1, 1},
9630
{&__pyx_n_s__errors, __pyx_k__errors, sizeof(__pyx_k__errors), 0, 0, 1, 1},
9631
{&__pyx_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 0, 0, 1, 1},
9632
{&__pyx_n_s__extra, __pyx_k__extra, sizeof(__pyx_k__extra), 0, 0, 1, 1},
9633
{&__pyx_n_s__gc, __pyx_k__gc, sizeof(__pyx_k__gc), 0, 0, 1, 1},
9634
{&__pyx_n_s__gdfo, __pyx_k__gdfo, sizeof(__pyx_k__gdfo), 0, 0, 1, 1},
9635
{&__pyx_n_s__get_key, __pyx_k__get_key, sizeof(__pyx_k__get_key), 0, 0, 1, 1},
9636
{&__pyx_n_s__graph, __pyx_k__graph, sizeof(__pyx_k__graph), 0, 0, 1, 1},
9637
{&__pyx_n_s__has_pending_parents, __pyx_k__has_pending_parents, sizeof(__pyx_k__has_pending_parents), 0, 0, 1, 1},
9638
{&__pyx_n_s__is_first_child, __pyx_k__is_first_child, sizeof(__pyx_k__is_first_child), 0, 0, 1, 1},
9639
{&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1},
9640
{&__pyx_n_s__known_graph, __pyx_k__known_graph, sizeof(__pyx_k__known_graph), 0, 0, 1, 1},
9641
{&__pyx_n_s__left_parent, __pyx_k__left_parent, sizeof(__pyx_k__left_parent), 0, 0, 1, 1},
9642
{&__pyx_n_s__left_pending_parent, __pyx_k__left_pending_parent, sizeof(__pyx_k__left_pending_parent), 0, 0, 1, 1},
9643
{&__pyx_n_s__merge_depth, __pyx_k__merge_depth, sizeof(__pyx_k__merge_depth), 0, 0, 1, 1},
9644
{&__pyx_n_s__parent_keys, __pyx_k__parent_keys, sizeof(__pyx_k__parent_keys), 0, 0, 1, 1},
9645
{&__pyx_n_s__parent_map, __pyx_k__parent_map, sizeof(__pyx_k__parent_map), 0, 0, 1, 1},
9646
{&__pyx_n_s__parents, __pyx_k__parents, sizeof(__pyx_k__parents), 0, 0, 1, 1},
9647
{&__pyx_n_s__pending_parents, __pyx_k__pending_parents, sizeof(__pyx_k__pending_parents), 0, 0, 1, 1},
9648
{&__pyx_n_s__pop, __pyx_k__pop, sizeof(__pyx_k__pop), 0, 0, 1, 1},
9649
{&__pyx_n_s__popleft, __pyx_k__popleft, sizeof(__pyx_k__popleft), 0, 0, 1, 1},
9650
{&__pyx_n_s__reverse, __pyx_k__reverse, sizeof(__pyx_k__reverse), 0, 0, 1, 1},
9651
{&__pyx_n_s__revision, __pyx_k__revision, sizeof(__pyx_k__revision), 0, 0, 1, 1},
9652
{&__pyx_n_s__seen, __pyx_k__seen, sizeof(__pyx_k__seen), 0, 0, 1, 1},
9653
{&__pyx_n_s__seen_by_child, __pyx_k__seen_by_child, sizeof(__pyx_k__seen_by_child), 0, 0, 1, 1},
9654
{&__pyx_n_s__sort, __pyx_k__sort, sizeof(__pyx_k__sort), 0, 0, 1, 1},
9655
{&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1},
9656
{&__pyx_n_s__tip_key, __pyx_k__tip_key, sizeof(__pyx_k__tip_key), 0, 0, 1, 1},
9657
{&__pyx_n_s__topo_order, __pyx_k__topo_order, sizeof(__pyx_k__topo_order), 0, 0, 1, 1},
9658
{0, 0, 0, 0, 0, 0, 0}
9660
static int __Pyx_InitCachedBuiltins(void) {
9661
__pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9662
__pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9663
__pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9664
__pyx_builtin_sorted = __Pyx_GetName(__pyx_b, __pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9665
__pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9671
static int __Pyx_InitCachedConstants(void) {
9672
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
9674
/* "bzrlib/_known_graph_pyx.pyx":156
9675
* is_tuple = PyTuple_CheckExact(lst_or_tpl)
9676
* if not (is_tuple or PyList_CheckExact(lst_or_tpl)):
9677
* raise TypeError('lst_or_tpl must be a list or tuple.') # <<<<<<<<<<<<<<
9678
* length = len(lst_or_tpl)
9679
* if length == 0 or length == 1:
9681
__pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9682
__Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3));
9683
__Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
9684
PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2));
9685
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
9686
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
9688
/* "bzrlib/_known_graph_pyx.pyx":273
9690
* if not PyDict_CheckExact(parent_map):
9691
* raise TypeError('parent_map should be a dict of {key:parent_keys}') # <<<<<<<<<<<<<<
9692
* # for key, parent_keys in parent_map.iteritems():
9695
__pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9696
__Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6));
9697
__Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
9698
PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_5));
9699
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
9700
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
9701
__Pyx_RefNannyFinishContext();
9704
__Pyx_RefNannyFinishContext();
9708
static int __Pyx_InitGlobals(void) {
9709
#if PY_VERSION_HEX < 0x02040000
9710
if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9712
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
9713
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
9714
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
9720
#if PY_MAJOR_VERSION < 3
9721
PyMODINIT_FUNC init_known_graph_pyx(void); /*proto*/
9722
PyMODINIT_FUNC init_known_graph_pyx(void)
9724
PyMODINIT_FUNC PyInit__known_graph_pyx(void); /*proto*/
9725
PyMODINIT_FUNC PyInit__known_graph_pyx(void)
9728
PyObject *__pyx_t_1 = NULL;
9729
PyObject *__pyx_t_2 = NULL;
9731
void* __pyx_refnanny = NULL;
9732
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
9733
if (!__Pyx_RefNanny) {
9735
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
9736
if (!__Pyx_RefNanny)
9737
Py_FatalError("failed to import 'refnanny' module");
9739
__pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__known_graph_pyx(void)", __LINE__, __FILE__);
9741
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9742
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9743
#ifdef __pyx_binding_PyCFunctionType_USED
9744
if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9746
/*--- Library function declarations ---*/
9747
/*--- Threads initialization code ---*/
9748
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
9749
#ifdef WITH_THREAD /* Python build with threading support? */
9750
PyEval_InitThreads();
9753
/*--- Module creation code ---*/
9754
#if PY_MAJOR_VERSION < 3
9755
__pyx_m = Py_InitModule4(__Pyx_NAMESTR("_known_graph_pyx"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_14), 0, PYTHON_API_VERSION);
9757
__pyx_m = PyModule_Create(&__pyx_moduledef);
9759
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
9760
#if PY_MAJOR_VERSION < 3
9763
__pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
9764
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
9765
if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
9766
/*--- Initialize various global constants etc. ---*/
9767
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9768
if (__pyx_module_is_main_bzrlib___known_graph_pyx) {
9769
if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
9771
/*--- Builtin init code ---*/
9772
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9773
/*--- Constants init code ---*/
9774
if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9775
/*--- Global init code ---*/
9776
__pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION = Py_None; Py_INCREF(Py_None);
9777
/*--- Function export code ---*/
9778
/*--- Type init code ---*/
9779
__pyx_vtabptr_6bzrlib_16_known_graph_pyx__KnownGraphNode = &__pyx_vtable_6bzrlib_16_known_graph_pyx__KnownGraphNode;
9780
__pyx_vtable_6bzrlib_16_known_graph_pyx__KnownGraphNode.clear_references = (PyObject *(*)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *))__pyx_f_6bzrlib_16_known_graph_pyx_15_KnownGraphNode_clear_references;
9781
if (PyType_Ready(&__pyx_type_6bzrlib_16_known_graph_pyx__KnownGraphNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9782
if (__Pyx_SetVtable(__pyx_type_6bzrlib_16_known_graph_pyx__KnownGraphNode.tp_dict, __pyx_vtabptr_6bzrlib_16_known_graph_pyx__KnownGraphNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9783
if (__Pyx_SetAttrString(__pyx_m, "_KnownGraphNode", (PyObject *)&__pyx_type_6bzrlib_16_known_graph_pyx__KnownGraphNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9784
__pyx_ptype_6bzrlib_16_known_graph_pyx__KnownGraphNode = &__pyx_type_6bzrlib_16_known_graph_pyx__KnownGraphNode;
9785
__pyx_vtabptr_6bzrlib_16_known_graph_pyx__MergeSorter = &__pyx_vtable_6bzrlib_16_known_graph_pyx__MergeSorter;
9786
__pyx_vtable_6bzrlib_16_known_graph_pyx__MergeSorter._get_ms_node = (struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *(*)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *, struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *))__pyx_f_6bzrlib_16_known_graph_pyx_12_MergeSorter__get_ms_node;
9787
__pyx_vtable_6bzrlib_16_known_graph_pyx__MergeSorter._push_node = (PyObject *(*)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *, struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *, long))__pyx_f_6bzrlib_16_known_graph_pyx_12_MergeSorter__push_node;
9788
__pyx_vtable_6bzrlib_16_known_graph_pyx__MergeSorter._pop_node = (PyObject *(*)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *))__pyx_f_6bzrlib_16_known_graph_pyx_12_MergeSorter__pop_node;
9789
__pyx_vtable_6bzrlib_16_known_graph_pyx__MergeSorter._schedule_stack = (PyObject *(*)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *))__pyx_f_6bzrlib_16_known_graph_pyx_12_MergeSorter__schedule_stack;
9790
__pyx_vtable_6bzrlib_16_known_graph_pyx__MergeSorter.topo_order = (PyObject *(*)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSorter *))__pyx_f_6bzrlib_16_known_graph_pyx_12_MergeSorter_topo_order;
9791
if (PyType_Ready(&__pyx_type_6bzrlib_16_known_graph_pyx__MergeSorter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9792
if (__Pyx_SetVtable(__pyx_type_6bzrlib_16_known_graph_pyx__MergeSorter.tp_dict, __pyx_vtabptr_6bzrlib_16_known_graph_pyx__MergeSorter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9793
if (__Pyx_SetAttrString(__pyx_m, "_MergeSorter", (PyObject *)&__pyx_type_6bzrlib_16_known_graph_pyx__MergeSorter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9794
__pyx_ptype_6bzrlib_16_known_graph_pyx__MergeSorter = &__pyx_type_6bzrlib_16_known_graph_pyx__MergeSorter;
9795
__pyx_vtabptr_6bzrlib_16_known_graph_pyx_KnownGraph = &__pyx_vtable_6bzrlib_16_known_graph_pyx_KnownGraph;
9796
__pyx_vtable_6bzrlib_16_known_graph_pyx_KnownGraph._get_or_create_node = (struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *(*)(struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *, PyObject *))__pyx_f_6bzrlib_16_known_graph_pyx_10KnownGraph__get_or_create_node;
9797
__pyx_vtable_6bzrlib_16_known_graph_pyx_KnownGraph._populate_parents = (PyObject *(*)(struct __pyx_obj_6bzrlib_16_known_graph_pyx_KnownGraph *, struct __pyx_obj_6bzrlib_16_known_graph_pyx__KnownGraphNode *, PyObject *))__pyx_f_6bzrlib_16_known_graph_pyx_10KnownGraph__populate_parents;
9798
if (PyType_Ready(&__pyx_type_6bzrlib_16_known_graph_pyx_KnownGraph) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9800
PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6bzrlib_16_known_graph_pyx_KnownGraph, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9801
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
9802
__pyx_wrapperbase_6bzrlib_16_known_graph_pyx_10KnownGraph___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
9803
__pyx_wrapperbase_6bzrlib_16_known_graph_pyx_10KnownGraph___init__.doc = __pyx_doc_6bzrlib_16_known_graph_pyx_10KnownGraph___init__;
9804
((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6bzrlib_16_known_graph_pyx_10KnownGraph___init__;
9807
if (__Pyx_SetVtable(__pyx_type_6bzrlib_16_known_graph_pyx_KnownGraph.tp_dict, __pyx_vtabptr_6bzrlib_16_known_graph_pyx_KnownGraph) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9808
if (__Pyx_SetAttrString(__pyx_m, "KnownGraph", (PyObject *)&__pyx_type_6bzrlib_16_known_graph_pyx_KnownGraph) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9809
__pyx_ptype_6bzrlib_16_known_graph_pyx_KnownGraph = &__pyx_type_6bzrlib_16_known_graph_pyx_KnownGraph;
9810
__pyx_vtabptr_6bzrlib_16_known_graph_pyx__MergeSortNode = &__pyx_vtable_6bzrlib_16_known_graph_pyx__MergeSortNode;
9811
__pyx_vtable_6bzrlib_16_known_graph_pyx__MergeSortNode.has_pending_parents = (int (*)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *))__pyx_f_6bzrlib_16_known_graph_pyx_14_MergeSortNode_has_pending_parents;
9812
__pyx_vtable_6bzrlib_16_known_graph_pyx__MergeSortNode._revno = (PyObject *(*)(struct __pyx_obj_6bzrlib_16_known_graph_pyx__MergeSortNode *))__pyx_f_6bzrlib_16_known_graph_pyx_14_MergeSortNode__revno;
9813
if (PyType_Ready(&__pyx_type_6bzrlib_16_known_graph_pyx__MergeSortNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9814
if (__Pyx_SetVtable(__pyx_type_6bzrlib_16_known_graph_pyx__MergeSortNode.tp_dict, __pyx_vtabptr_6bzrlib_16_known_graph_pyx__MergeSortNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9815
if (__Pyx_SetAttrString(__pyx_m, "_MergeSortNode", (PyObject *)&__pyx_type_6bzrlib_16_known_graph_pyx__MergeSortNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9816
__pyx_ptype_6bzrlib_16_known_graph_pyx__MergeSortNode = &__pyx_type_6bzrlib_16_known_graph_pyx__MergeSortNode;
9817
/*--- Type import code ---*/
9818
/*--- Function import code ---*/
9819
/*--- Execution code ---*/
9821
/* "bzrlib/_known_graph_pyx.pyx":54
9822
* void Py_INCREF(object)
9824
* from collections import deque # <<<<<<<<<<<<<<
9828
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9829
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
9830
__Pyx_INCREF(((PyObject *)__pyx_n_s__deque));
9831
PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__deque));
9832
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__deque));
9833
__pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9834
__Pyx_GOTREF(__pyx_t_2);
9835
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
9836
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__deque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9837
__Pyx_GOTREF(__pyx_t_1);
9838
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__deque, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9839
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9840
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9842
/* "bzrlib/_known_graph_pyx.pyx":55
9844
* from collections import deque
9845
* import gc # <<<<<<<<<<<<<<
9847
* from bzrlib import errors, revision
9849
__pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__gc), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9850
__Pyx_GOTREF(__pyx_t_2);
9851
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gc, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9852
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9854
/* "bzrlib/_known_graph_pyx.pyx":57
9857
* from bzrlib import errors, revision # <<<<<<<<<<<<<<
9859
* cdef object NULL_REVISION
9861
__pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9862
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
9863
__Pyx_INCREF(((PyObject *)__pyx_n_s__errors));
9864
PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__errors));
9865
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__errors));
9866
__Pyx_INCREF(((PyObject *)__pyx_n_s__revision));
9867
PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__revision));
9868
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__revision));
9869
__pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__bzrlib), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9870
__Pyx_GOTREF(__pyx_t_1);
9871
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
9872
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__errors); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9873
__Pyx_GOTREF(__pyx_t_2);
9874
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__errors, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9875
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9876
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__revision); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9877
__Pyx_GOTREF(__pyx_t_2);
9878
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__revision, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9879
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9880
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9882
/* "bzrlib/_known_graph_pyx.pyx":60
9884
* cdef object NULL_REVISION
9885
* NULL_REVISION = revision.NULL_REVISION # <<<<<<<<<<<<<<
9889
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__revision); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9890
__Pyx_GOTREF(__pyx_t_1);
9891
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__NULL_REVISION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9892
__Pyx_GOTREF(__pyx_t_2);
9893
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9894
__Pyx_GOTREF(__pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION);
9895
__Pyx_DECREF(__pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION);
9896
__Pyx_GIVEREF(__pyx_t_2);
9897
__pyx_v_6bzrlib_16_known_graph_pyx_NULL_REVISION = __pyx_t_2;
9900
/* "bzrlib/_known_graph_pyx.pyx":138
9903
* def get_key(node): # <<<<<<<<<<<<<<
9904
* cdef _KnownGraphNode real_node
9907
__pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6bzrlib_16_known_graph_pyx_get_key, NULL, __pyx_n_s_15); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9908
__Pyx_GOTREF(__pyx_t_2);
9909
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_key, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9910
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9912
/* "bzrlib/_known_graph_pyx.pyx":199
9913
* cdef public int do_cache
9915
* def __init__(self, parent_map, do_cache=True): # <<<<<<<<<<<<<<
9916
* """Create a new KnownGraph instance.
9919
__pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9920
__Pyx_GOTREF(__pyx_t_2);
9921
__pyx_k_4 = __pyx_t_2;
9922
__Pyx_GIVEREF(__pyx_t_2);
9925
/* "bzrlib/_known_graph_pyx.pyx":1
9926
* # Copyright (C) 2009, 2010 Canonical Ltd # <<<<<<<<<<<<<<
9928
* # This program is free software; you can redistribute it and/or modify
9930
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9931
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
9932
if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
9933
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
9936
__Pyx_XDECREF(__pyx_t_1);
9937
__Pyx_XDECREF(__pyx_t_2);
9939
__Pyx_AddTraceback("init bzrlib._known_graph_pyx");
9940
Py_DECREF(__pyx_m); __pyx_m = 0;
9941
} else if (!PyErr_Occurred()) {
9942
PyErr_SetString(PyExc_ImportError, "init bzrlib._known_graph_pyx");
9945
__Pyx_RefNannyFinishContext();
9946
#if PY_MAJOR_VERSION < 3
9953
/* Runtime support code */
9955
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
9957
result = PyObject_GetAttr(dict, name);
9959
PyErr_SetObject(PyExc_NameError, name);
9963
static void __Pyx_RaiseDoubleKeywordsError(
9964
const char* func_name,
9967
PyErr_Format(PyExc_TypeError,
9968
#if PY_MAJOR_VERSION >= 3
9969
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
9971
"%s() got multiple values for keyword argument '%s'", func_name,
9972
PyString_AS_STRING(kw_name));
9976
static int __Pyx_ParseOptionalKeywords(
9978
PyObject **argnames[],
9981
Py_ssize_t num_pos_args,
9982
const char* function_name)
9984
PyObject *key = 0, *value = 0;
9987
PyObject*** first_kw_arg = argnames + num_pos_args;
9989
while (PyDict_Next(kwds, &pos, &key, &value)) {
9990
name = first_kw_arg;
9991
while (*name && (**name != key)) name++;
9993
values[name-argnames] = value;
9995
#if PY_MAJOR_VERSION < 3
9996
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
9998
if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
10000
goto invalid_keyword_type;
10002
for (name = first_kw_arg; *name; name++) {
10003
#if PY_MAJOR_VERSION >= 3
10004
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
10005
PyUnicode_Compare(**name, key) == 0) break;
10007
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
10008
_PyString_Eq(**name, key)) break;
10012
values[name-argnames] = value;
10014
/* unexpected keyword found */
10015
for (name=argnames; name != first_kw_arg; name++) {
10016
if (**name == key) goto arg_passed_twice;
10017
#if PY_MAJOR_VERSION >= 3
10018
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
10019
PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
10021
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
10022
_PyString_Eq(**name, key)) goto arg_passed_twice;
10026
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
10028
goto invalid_keyword;
10036
__Pyx_RaiseDoubleKeywordsError(function_name, **name);
10038
invalid_keyword_type:
10039
PyErr_Format(PyExc_TypeError,
10040
"%s() keywords must be strings", function_name);
10043
PyErr_Format(PyExc_TypeError,
10044
#if PY_MAJOR_VERSION < 3
10045
"%s() got an unexpected keyword argument '%s'",
10046
function_name, PyString_AsString(key));
10048
"%s() got an unexpected keyword argument '%U'",
10049
function_name, key);
10055
static void __Pyx_RaiseArgtupleInvalid(
10056
const char* func_name,
10058
Py_ssize_t num_min,
10059
Py_ssize_t num_max,
10060
Py_ssize_t num_found)
10062
Py_ssize_t num_expected;
10063
const char *number, *more_or_less;
10065
if (num_found < num_min) {
10066
num_expected = num_min;
10067
more_or_less = "at least";
10069
num_expected = num_max;
10070
more_or_less = "at most";
10073
more_or_less = "exactly";
10075
number = (num_expected == 1) ? "" : "s";
10076
PyErr_Format(PyExc_TypeError,
10077
#if PY_VERSION_HEX < 0x02050000
10078
"%s() takes %s %d positional argument%s (%d given)",
10080
"%s() takes %s %zd positional argument%s (%zd given)",
10082
func_name, more_or_less, num_expected, number, num_found);
10085
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
10086
if (unlikely(!type)) {
10087
PyErr_Format(PyExc_SystemError, "Missing type object");
10090
if (likely(PyObject_TypeCheck(obj, type)))
10092
PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
10093
Py_TYPE(obj)->tp_name, type->tp_name);
10097
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
10098
PyObject *tmp_type, *tmp_value, *tmp_tb;
10099
PyThreadState *tstate = PyThreadState_GET();
10101
tmp_type = tstate->curexc_type;
10102
tmp_value = tstate->curexc_value;
10103
tmp_tb = tstate->curexc_traceback;
10104
tstate->curexc_type = type;
10105
tstate->curexc_value = value;
10106
tstate->curexc_traceback = tb;
10107
Py_XDECREF(tmp_type);
10108
Py_XDECREF(tmp_value);
10109
Py_XDECREF(tmp_tb);
10112
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
10113
PyThreadState *tstate = PyThreadState_GET();
10114
*type = tstate->curexc_type;
10115
*value = tstate->curexc_value;
10116
*tb = tstate->curexc_traceback;
10118
tstate->curexc_type = 0;
10119
tstate->curexc_value = 0;
10120
tstate->curexc_traceback = 0;
10124
#if PY_MAJOR_VERSION < 3
10125
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
10129
/* First, check the traceback argument, replacing None with NULL. */
10130
if (tb == Py_None) {
10134
else if (tb != NULL && !PyTraceBack_Check(tb)) {
10135
PyErr_SetString(PyExc_TypeError,
10136
"raise: arg 3 must be a traceback or None");
10139
/* Next, replace a missing value with None */
10140
if (value == NULL) {
10144
#if PY_VERSION_HEX < 0x02050000
10145
if (!PyClass_Check(type))
10147
if (!PyType_Check(type))
10150
/* Raising an instance. The value should be a dummy. */
10151
if (value != Py_None) {
10152
PyErr_SetString(PyExc_TypeError,
10153
"instance exception may not have a separate value");
10156
/* Normalize to raise <class>, <instance> */
10159
#if PY_VERSION_HEX < 0x02050000
10160
if (PyInstance_Check(type)) {
10161
type = (PyObject*) ((PyInstanceObject*)type)->in_class;
10166
PyErr_SetString(PyExc_TypeError,
10167
"raise: exception must be an old-style class or instance");
10171
type = (PyObject*) Py_TYPE(type);
10173
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
10174
PyErr_SetString(PyExc_TypeError,
10175
"raise: exception class must be a subclass of BaseException");
10181
__Pyx_ErrRestore(type, value, tb);
10190
#else /* Python 3+ */
10192
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
10193
if (tb == Py_None) {
10195
} else if (tb && !PyTraceBack_Check(tb)) {
10196
PyErr_SetString(PyExc_TypeError,
10197
"raise: arg 3 must be a traceback or None");
10200
if (value == Py_None)
10203
if (PyExceptionInstance_Check(type)) {
10205
PyErr_SetString(PyExc_TypeError,
10206
"instance exception may not have a separate value");
10210
type = (PyObject*) Py_TYPE(value);
10211
} else if (!PyExceptionClass_Check(type)) {
10212
PyErr_SetString(PyExc_TypeError,
10213
"raise: exception class must be a subclass of BaseException");
10217
PyErr_SetObject(type, value);
10220
PyThreadState *tstate = PyThreadState_GET();
10221
PyObject* tmp_tb = tstate->curexc_traceback;
10222
if (tb != tmp_tb) {
10224
tstate->curexc_traceback = tb;
10225
Py_XDECREF(tmp_tb);
10235
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
10236
PyObject *py_import = 0;
10237
PyObject *empty_list = 0;
10238
PyObject *module = 0;
10239
PyObject *global_dict = 0;
10240
PyObject *empty_dict = 0;
10242
py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
10248
empty_list = PyList_New(0);
10253
global_dict = PyModule_GetDict(__pyx_m);
10256
empty_dict = PyDict_New();
10259
module = PyObject_CallFunctionObjArgs(py_import,
10260
name, global_dict, empty_dict, list, NULL);
10262
Py_XDECREF(empty_list);
10263
Py_XDECREF(py_import);
10264
Py_XDECREF(empty_dict);
10268
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
10269
const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
10270
const int is_unsigned = neg_one > const_zero;
10271
if (sizeof(unsigned char) < sizeof(long)) {
10272
long val = __Pyx_PyInt_AsLong(x);
10273
if (unlikely(val != (long)(unsigned char)val)) {
10274
if (!unlikely(val == -1 && PyErr_Occurred())) {
10275
PyErr_SetString(PyExc_OverflowError,
10276
(is_unsigned && unlikely(val < 0)) ?
10277
"can't convert negative value to unsigned char" :
10278
"value too large to convert to unsigned char");
10280
return (unsigned char)-1;
10282
return (unsigned char)val;
10284
return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
10287
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
10288
const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
10289
const int is_unsigned = neg_one > const_zero;
10290
if (sizeof(unsigned short) < sizeof(long)) {
10291
long val = __Pyx_PyInt_AsLong(x);
10292
if (unlikely(val != (long)(unsigned short)val)) {
10293
if (!unlikely(val == -1 && PyErr_Occurred())) {
10294
PyErr_SetString(PyExc_OverflowError,
10295
(is_unsigned && unlikely(val < 0)) ?
10296
"can't convert negative value to unsigned short" :
10297
"value too large to convert to unsigned short");
10299
return (unsigned short)-1;
10301
return (unsigned short)val;
10303
return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
10306
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
10307
const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
10308
const int is_unsigned = neg_one > const_zero;
10309
if (sizeof(unsigned int) < sizeof(long)) {
10310
long val = __Pyx_PyInt_AsLong(x);
10311
if (unlikely(val != (long)(unsigned int)val)) {
10312
if (!unlikely(val == -1 && PyErr_Occurred())) {
10313
PyErr_SetString(PyExc_OverflowError,
10314
(is_unsigned && unlikely(val < 0)) ?
10315
"can't convert negative value to unsigned int" :
10316
"value too large to convert to unsigned int");
10318
return (unsigned int)-1;
10320
return (unsigned int)val;
10322
return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
10325
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
10326
const char neg_one = (char)-1, const_zero = 0;
10327
const int is_unsigned = neg_one > const_zero;
10328
if (sizeof(char) < sizeof(long)) {
10329
long val = __Pyx_PyInt_AsLong(x);
10330
if (unlikely(val != (long)(char)val)) {
10331
if (!unlikely(val == -1 && PyErr_Occurred())) {
10332
PyErr_SetString(PyExc_OverflowError,
10333
(is_unsigned && unlikely(val < 0)) ?
10334
"can't convert negative value to char" :
10335
"value too large to convert to char");
10341
return (char)__Pyx_PyInt_AsLong(x);
10344
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
10345
const short neg_one = (short)-1, const_zero = 0;
10346
const int is_unsigned = neg_one > const_zero;
10347
if (sizeof(short) < sizeof(long)) {
10348
long val = __Pyx_PyInt_AsLong(x);
10349
if (unlikely(val != (long)(short)val)) {
10350
if (!unlikely(val == -1 && PyErr_Occurred())) {
10351
PyErr_SetString(PyExc_OverflowError,
10352
(is_unsigned && unlikely(val < 0)) ?
10353
"can't convert negative value to short" :
10354
"value too large to convert to short");
10360
return (short)__Pyx_PyInt_AsLong(x);
10363
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
10364
const int neg_one = (int)-1, const_zero = 0;
10365
const int is_unsigned = neg_one > const_zero;
10366
if (sizeof(int) < sizeof(long)) {
10367
long val = __Pyx_PyInt_AsLong(x);
10368
if (unlikely(val != (long)(int)val)) {
10369
if (!unlikely(val == -1 && PyErr_Occurred())) {
10370
PyErr_SetString(PyExc_OverflowError,
10371
(is_unsigned && unlikely(val < 0)) ?
10372
"can't convert negative value to int" :
10373
"value too large to convert to int");
10379
return (int)__Pyx_PyInt_AsLong(x);
10382
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
10383
const signed char neg_one = (signed char)-1, const_zero = 0;
10384
const int is_unsigned = neg_one > const_zero;
10385
if (sizeof(signed char) < sizeof(long)) {
10386
long val = __Pyx_PyInt_AsLong(x);
10387
if (unlikely(val != (long)(signed char)val)) {
10388
if (!unlikely(val == -1 && PyErr_Occurred())) {
10389
PyErr_SetString(PyExc_OverflowError,
10390
(is_unsigned && unlikely(val < 0)) ?
10391
"can't convert negative value to signed char" :
10392
"value too large to convert to signed char");
10394
return (signed char)-1;
10396
return (signed char)val;
10398
return (signed char)__Pyx_PyInt_AsSignedLong(x);
10401
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
10402
const signed short neg_one = (signed short)-1, const_zero = 0;
10403
const int is_unsigned = neg_one > const_zero;
10404
if (sizeof(signed short) < sizeof(long)) {
10405
long val = __Pyx_PyInt_AsLong(x);
10406
if (unlikely(val != (long)(signed short)val)) {
10407
if (!unlikely(val == -1 && PyErr_Occurred())) {
10408
PyErr_SetString(PyExc_OverflowError,
10409
(is_unsigned && unlikely(val < 0)) ?
10410
"can't convert negative value to signed short" :
10411
"value too large to convert to signed short");
10413
return (signed short)-1;
10415
return (signed short)val;
10417
return (signed short)__Pyx_PyInt_AsSignedLong(x);
10420
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
10421
const signed int neg_one = (signed int)-1, const_zero = 0;
10422
const int is_unsigned = neg_one > const_zero;
10423
if (sizeof(signed int) < sizeof(long)) {
10424
long val = __Pyx_PyInt_AsLong(x);
10425
if (unlikely(val != (long)(signed int)val)) {
10426
if (!unlikely(val == -1 && PyErr_Occurred())) {
10427
PyErr_SetString(PyExc_OverflowError,
10428
(is_unsigned && unlikely(val < 0)) ?
10429
"can't convert negative value to signed int" :
10430
"value too large to convert to signed int");
10432
return (signed int)-1;
10434
return (signed int)val;
10436
return (signed int)__Pyx_PyInt_AsSignedLong(x);
10439
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
10440
const int neg_one = (int)-1, const_zero = 0;
10441
const int is_unsigned = neg_one > const_zero;
10442
if (sizeof(int) < sizeof(long)) {
10443
long val = __Pyx_PyInt_AsLong(x);
10444
if (unlikely(val != (long)(int)val)) {
10445
if (!unlikely(val == -1 && PyErr_Occurred())) {
10446
PyErr_SetString(PyExc_OverflowError,
10447
(is_unsigned && unlikely(val < 0)) ?
10448
"can't convert negative value to int" :
10449
"value too large to convert to int");
10455
return (int)__Pyx_PyInt_AsLong(x);
10458
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
10459
const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
10460
const int is_unsigned = neg_one > const_zero;
10461
#if PY_VERSION_HEX < 0x03000000
10462
if (likely(PyInt_Check(x))) {
10463
long val = PyInt_AS_LONG(x);
10464
if (is_unsigned && unlikely(val < 0)) {
10465
PyErr_SetString(PyExc_OverflowError,
10466
"can't convert negative value to unsigned long");
10467
return (unsigned long)-1;
10469
return (unsigned long)val;
10472
if (likely(PyLong_Check(x))) {
10474
if (unlikely(Py_SIZE(x) < 0)) {
10475
PyErr_SetString(PyExc_OverflowError,
10476
"can't convert negative value to unsigned long");
10477
return (unsigned long)-1;
10479
return PyLong_AsUnsignedLong(x);
10481
return PyLong_AsLong(x);
10485
PyObject *tmp = __Pyx_PyNumber_Int(x);
10486
if (!tmp) return (unsigned long)-1;
10487
val = __Pyx_PyInt_AsUnsignedLong(tmp);
10493
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
10494
const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
10495
const int is_unsigned = neg_one > const_zero;
10496
#if PY_VERSION_HEX < 0x03000000
10497
if (likely(PyInt_Check(x))) {
10498
long val = PyInt_AS_LONG(x);
10499
if (is_unsigned && unlikely(val < 0)) {
10500
PyErr_SetString(PyExc_OverflowError,
10501
"can't convert negative value to unsigned PY_LONG_LONG");
10502
return (unsigned PY_LONG_LONG)-1;
10504
return (unsigned PY_LONG_LONG)val;
10507
if (likely(PyLong_Check(x))) {
10509
if (unlikely(Py_SIZE(x) < 0)) {
10510
PyErr_SetString(PyExc_OverflowError,
10511
"can't convert negative value to unsigned PY_LONG_LONG");
10512
return (unsigned PY_LONG_LONG)-1;
10514
return PyLong_AsUnsignedLongLong(x);
10516
return PyLong_AsLongLong(x);
10519
unsigned PY_LONG_LONG val;
10520
PyObject *tmp = __Pyx_PyNumber_Int(x);
10521
if (!tmp) return (unsigned PY_LONG_LONG)-1;
10522
val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
10528
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
10529
const long neg_one = (long)-1, const_zero = 0;
10530
const int is_unsigned = neg_one > const_zero;
10531
#if PY_VERSION_HEX < 0x03000000
10532
if (likely(PyInt_Check(x))) {
10533
long val = PyInt_AS_LONG(x);
10534
if (is_unsigned && unlikely(val < 0)) {
10535
PyErr_SetString(PyExc_OverflowError,
10536
"can't convert negative value to long");
10542
if (likely(PyLong_Check(x))) {
10544
if (unlikely(Py_SIZE(x) < 0)) {
10545
PyErr_SetString(PyExc_OverflowError,
10546
"can't convert negative value to long");
10549
return PyLong_AsUnsignedLong(x);
10551
return PyLong_AsLong(x);
10555
PyObject *tmp = __Pyx_PyNumber_Int(x);
10556
if (!tmp) return (long)-1;
10557
val = __Pyx_PyInt_AsLong(tmp);
10563
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
10564
const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
10565
const int is_unsigned = neg_one > const_zero;
10566
#if PY_VERSION_HEX < 0x03000000
10567
if (likely(PyInt_Check(x))) {
10568
long val = PyInt_AS_LONG(x);
10569
if (is_unsigned && unlikely(val < 0)) {
10570
PyErr_SetString(PyExc_OverflowError,
10571
"can't convert negative value to PY_LONG_LONG");
10572
return (PY_LONG_LONG)-1;
10574
return (PY_LONG_LONG)val;
10577
if (likely(PyLong_Check(x))) {
10579
if (unlikely(Py_SIZE(x) < 0)) {
10580
PyErr_SetString(PyExc_OverflowError,
10581
"can't convert negative value to PY_LONG_LONG");
10582
return (PY_LONG_LONG)-1;
10584
return PyLong_AsUnsignedLongLong(x);
10586
return PyLong_AsLongLong(x);
10590
PyObject *tmp = __Pyx_PyNumber_Int(x);
10591
if (!tmp) return (PY_LONG_LONG)-1;
10592
val = __Pyx_PyInt_AsLongLong(tmp);
10598
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
10599
const signed long neg_one = (signed long)-1, const_zero = 0;
10600
const int is_unsigned = neg_one > const_zero;
10601
#if PY_VERSION_HEX < 0x03000000
10602
if (likely(PyInt_Check(x))) {
10603
long val = PyInt_AS_LONG(x);
10604
if (is_unsigned && unlikely(val < 0)) {
10605
PyErr_SetString(PyExc_OverflowError,
10606
"can't convert negative value to signed long");
10607
return (signed long)-1;
10609
return (signed long)val;
10612
if (likely(PyLong_Check(x))) {
10614
if (unlikely(Py_SIZE(x) < 0)) {
10615
PyErr_SetString(PyExc_OverflowError,
10616
"can't convert negative value to signed long");
10617
return (signed long)-1;
10619
return PyLong_AsUnsignedLong(x);
10621
return PyLong_AsLong(x);
10625
PyObject *tmp = __Pyx_PyNumber_Int(x);
10626
if (!tmp) return (signed long)-1;
10627
val = __Pyx_PyInt_AsSignedLong(tmp);
10633
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
10634
const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
10635
const int is_unsigned = neg_one > const_zero;
10636
#if PY_VERSION_HEX < 0x03000000
10637
if (likely(PyInt_Check(x))) {
10638
long val = PyInt_AS_LONG(x);
10639
if (is_unsigned && unlikely(val < 0)) {
10640
PyErr_SetString(PyExc_OverflowError,
10641
"can't convert negative value to signed PY_LONG_LONG");
10642
return (signed PY_LONG_LONG)-1;
10644
return (signed PY_LONG_LONG)val;
10647
if (likely(PyLong_Check(x))) {
10649
if (unlikely(Py_SIZE(x) < 0)) {
10650
PyErr_SetString(PyExc_OverflowError,
10651
"can't convert negative value to signed PY_LONG_LONG");
10652
return (signed PY_LONG_LONG)-1;
10654
return PyLong_AsUnsignedLongLong(x);
10656
return PyLong_AsLongLong(x);
10659
signed PY_LONG_LONG val;
10660
PyObject *tmp = __Pyx_PyNumber_Int(x);
10661
if (!tmp) return (signed PY_LONG_LONG)-1;
10662
val = __Pyx_PyInt_AsSignedLongLong(tmp);
10668
static void __Pyx_WriteUnraisable(const char *name) {
10669
PyObject *old_exc, *old_val, *old_tb;
10671
__Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
10672
#if PY_MAJOR_VERSION < 3
10673
ctx = PyString_FromString(name);
10675
ctx = PyUnicode_FromString(name);
10677
__Pyx_ErrRestore(old_exc, old_val, old_tb);
10679
PyErr_WriteUnraisable(Py_None);
10681
PyErr_WriteUnraisable(ctx);
10686
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
10687
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
10688
PyObject *ob = PyCapsule_New(vtable, 0, 0);
10690
PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
10694
if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
10703
#include "compile.h"
10704
#include "frameobject.h"
10705
#include "traceback.h"
10707
static void __Pyx_AddTraceback(const char *funcname) {
10708
PyObject *py_srcfile = 0;
10709
PyObject *py_funcname = 0;
10710
PyObject *py_globals = 0;
10711
PyCodeObject *py_code = 0;
10712
PyFrameObject *py_frame = 0;
10714
#if PY_MAJOR_VERSION < 3
10715
py_srcfile = PyString_FromString(__pyx_filename);
10717
py_srcfile = PyUnicode_FromString(__pyx_filename);
10719
if (!py_srcfile) goto bad;
10720
if (__pyx_clineno) {
10721
#if PY_MAJOR_VERSION < 3
10722
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
10724
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
10728
#if PY_MAJOR_VERSION < 3
10729
py_funcname = PyString_FromString(funcname);
10731
py_funcname = PyUnicode_FromString(funcname);
10734
if (!py_funcname) goto bad;
10735
py_globals = PyModule_GetDict(__pyx_m);
10736
if (!py_globals) goto bad;
10737
py_code = PyCode_New(
10738
0, /*int argcount,*/
10739
#if PY_MAJOR_VERSION >= 3
10740
0, /*int kwonlyargcount,*/
10742
0, /*int nlocals,*/
10743
0, /*int stacksize,*/
10745
__pyx_empty_bytes, /*PyObject *code,*/
10746
__pyx_empty_tuple, /*PyObject *consts,*/
10747
__pyx_empty_tuple, /*PyObject *names,*/
10748
__pyx_empty_tuple, /*PyObject *varnames,*/
10749
__pyx_empty_tuple, /*PyObject *freevars,*/
10750
__pyx_empty_tuple, /*PyObject *cellvars,*/
10751
py_srcfile, /*PyObject *filename,*/
10752
py_funcname, /*PyObject *name,*/
10753
__pyx_lineno, /*int firstlineno,*/
10754
__pyx_empty_bytes /*PyObject *lnotab*/
10756
if (!py_code) goto bad;
10757
py_frame = PyFrame_New(
10758
PyThreadState_GET(), /*PyThreadState *tstate,*/
10759
py_code, /*PyCodeObject *code,*/
10760
py_globals, /*PyObject *globals,*/
10761
0 /*PyObject *locals*/
10763
if (!py_frame) goto bad;
10764
py_frame->f_lineno = __pyx_lineno;
10765
PyTraceBack_Here(py_frame);
10767
Py_XDECREF(py_srcfile);
10768
Py_XDECREF(py_funcname);
10769
Py_XDECREF(py_code);
10770
Py_XDECREF(py_frame);
10773
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
10775
#if PY_MAJOR_VERSION < 3
10776
if (t->is_unicode) {
10777
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
10778
} else if (t->intern) {
10779
*t->p = PyString_InternFromString(t->s);
10781
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
10783
#else /* Python 3+ has unicode identifiers */
10784
if (t->is_unicode | t->is_str) {
10786
*t->p = PyUnicode_InternFromString(t->s);
10787
} else if (t->encoding) {
10788
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
10790
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
10793
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
10803
/* Type Conversion Functions */
10805
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
10806
int is_true = x == Py_True;
10807
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
10808
else return PyObject_IsTrue(x);
10811
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
10812
PyNumberMethods *m;
10813
const char *name = NULL;
10814
PyObject *res = NULL;
10815
#if PY_VERSION_HEX < 0x03000000
10816
if (PyInt_Check(x) || PyLong_Check(x))
10818
if (PyLong_Check(x))
10820
return Py_INCREF(x), x;
10821
m = Py_TYPE(x)->tp_as_number;
10822
#if PY_VERSION_HEX < 0x03000000
10823
if (m && m->nb_int) {
10825
res = PyNumber_Int(x);
10827
else if (m && m->nb_long) {
10829
res = PyNumber_Long(x);
10832
if (m && m->nb_int) {
10834
res = PyNumber_Long(x);
10838
#if PY_VERSION_HEX < 0x03000000
10839
if (!PyInt_Check(res) && !PyLong_Check(res)) {
10841
if (!PyLong_Check(res)) {
10843
PyErr_Format(PyExc_TypeError,
10844
"__%s__ returned non-%s (type %.200s)",
10845
name, name, Py_TYPE(res)->tp_name);
10850
else if (!PyErr_Occurred()) {
10851
PyErr_SetString(PyExc_TypeError,
10852
"an integer is required");
10857
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
10859
PyObject* x = PyNumber_Index(b);
10861
ival = PyInt_AsSsize_t(x);
10866
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
10867
#if PY_VERSION_HEX < 0x02050000
10868
if (ival <= LONG_MAX)
10869
return PyInt_FromLong((long)ival);
10871
unsigned char *bytes = (unsigned char *) &ival;
10872
int one = 1; int little = (int)*(unsigned char*)&one;
10873
return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
10876
return PyInt_FromSize_t(ival);
10880
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
10881
unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
10882
if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
10884
} else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
10885
PyErr_SetString(PyExc_OverflowError,
10886
"value too large to convert to size_t");
10889
return (size_t)val;
10893
#endif /* Py_PYTHON_H */