Show More
@@ -1388,8 +1388,7 b' static PyObject *find_deepest(indexObjec' | |||
|
1388 | 1388 | if (dict == NULL) |
|
1389 | 1389 | goto bail; |
|
1390 | 1390 | |
|
1391 | j = ninteresting; | |
|
1392 | for (i = 0; i < revcount && j > 0; i++) { | |
|
1391 | for (i = 0; i < revcount; i++) { | |
|
1393 | 1392 | PyObject *key; |
|
1394 | 1393 | |
|
1395 | 1394 | if ((final & (1 << i)) == 0) |
@@ -1403,7 +1402,6 b' static PyObject *find_deepest(indexObjec' | |||
|
1403 | 1402 | Py_DECREF(Py_None); |
|
1404 | 1403 | goto bail; |
|
1405 | 1404 | } |
|
1406 | j -= 1; | |
|
1407 | 1405 | } |
|
1408 | 1406 | |
|
1409 | 1407 | keys = PyDict_Keys(dict); |
@@ -1,4 +1,4 b'' | |||
|
1 | from mercurial import ancestor | |
|
1 | from mercurial import ancestor, commands, hg, ui, util | |
|
2 | 2 | |
|
3 | 3 | # graph is a dict of child->parent adjacency lists for this graph: |
|
4 | 4 | # o 13 |
@@ -101,6 +101,36 b' def test_lazyancestors():' | |||
|
101 | 101 | s = genlazyancestors([11, 13], stoprev=6, inclusive=True) |
|
102 | 102 | printlazyancestors(s, [11, 13, 7, 9, 8, 3, 6, 4, 1, -1, 0]) |
|
103 | 103 | |
|
104 | ||
|
105 | # The C gca algorithm requires a real repo. These are textual descriptions of | |
|
106 | # dags that have been known to be problematic. | |
|
107 | dagtests = [ | |
|
108 | '+2*2*2/*3/2', | |
|
109 | '+3*3/*2*2/*4*4/*4/2*4/2*2', | |
|
110 | ] | |
|
111 | def test_gca(): | |
|
112 | u = ui.ui() | |
|
113 | for i, dag in enumerate(dagtests): | |
|
114 | repo = hg.repository(u, 'gca%d' % i, create=1) | |
|
115 | cl = repo.changelog | |
|
116 | if not util.safehasattr(cl.index, 'ancestors'): | |
|
117 | # C version not available | |
|
118 | return | |
|
119 | ||
|
120 | commands.debugbuilddag(u, repo, dag) | |
|
121 | # Compare the results of the Python and C versions. This does not | |
|
122 | # include choosing a winner when more than one gca exists -- we make | |
|
123 | # sure both return exactly the same set of gcas. | |
|
124 | for a in cl: | |
|
125 | for b in cl: | |
|
126 | cgcas = sorted(cl.index.ancestors(a, b)) | |
|
127 | pygcas = sorted(ancestor.ancestors(cl.parentrevs, a, b)) | |
|
128 | if cgcas != pygcas: | |
|
129 | print "test_gca: for dag %s, gcas for %d, %d:" % (dag, a, b) | |
|
130 | print " C returned: %s" % cgcas | |
|
131 | print " Python returned: %s" % pygcas | |
|
132 | ||
|
104 | 133 | if __name__ == '__main__': |
|
105 | 134 | test_missingancestors() |
|
106 | 135 | test_lazyancestors() |
|
136 | test_gca() |
General Comments 0
You need to be logged in to leave comments.
Login now