Mercurial > hg
annotate tests/test-ancestor.py @ 20275:2123d27ff75d
backout: avoid update on simple case.
Before the changeset the backout process was:
1) go to <target>
2) revert to <target> parent
3) update back to changeset we came from
The two update steps can takes a very long time to move back and forth unrelated
file change between <target> and current working directory.
The new process is just merging current working directory with the parent of
<target> using <target> as ancestor. This give the very same result but skip
the two updates. On big repo with a lot of files and changes that save a lots of
time (x20 for one week window).
The "merge" version (hg backout --merge) is still done with upgrades. We could
imagine using in memory commit to speed it up but this is another fish.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 08 Jan 2014 14:53:46 -0800 |
parents | 2fa303619b4d |
children | 7731a2281cf0 |
rev | line source |
---|---|
19504
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
1 from mercurial import ancestor, commands, hg, ui, util |
18079
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
2 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
3 # graph is a dict of child->parent adjacency lists for this graph: |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
4 # o 13 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
5 # | |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
6 # | o 12 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
7 # | | |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
8 # | | o 11 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
9 # | | |\ |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
10 # | | | | o 10 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
11 # | | | | | |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
12 # | o---+ | 9 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
13 # | | | | | |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
14 # o | | | | 8 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
15 # / / / / |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
16 # | | o | 7 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
17 # | | | | |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
18 # o---+ | 6 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
19 # / / / |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
20 # | | o 5 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
21 # | |/ |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
22 # | o 4 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
23 # | | |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
24 # o | 3 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
25 # | | |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
26 # | o 2 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
27 # |/ |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
28 # o 1 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
29 # | |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
30 # o 0 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
31 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
32 graph = {0: [-1], 1: [0], 2: [1], 3: [1], 4: [2], 5: [4], 6: [4], |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
33 7: [4], 8: [-1], 9: [6, 7], 10: [5], 11: [3, 7], 12: [9], |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
34 13: [8]} |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
35 pfunc = graph.get |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
36 |
18091
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
37 class mockchangelog(object): |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
38 parentrevs = graph.get |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
39 |
18079
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
40 def runmissingancestors(revs, bases): |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
41 print "%% ancestors of %s and not of %s" % (revs, bases) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
42 print ancestor.missingancestors(revs, bases, pfunc) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
43 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
44 def test_missingancestors(): |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
45 # Empty revs |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
46 runmissingancestors([], [1]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
47 runmissingancestors([], []) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
48 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
49 # If bases is empty, it's the same as if it were [nullrev] |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
50 runmissingancestors([12], []) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
51 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
52 # Trivial case: revs == bases |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
53 runmissingancestors([0], [0]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
54 runmissingancestors([4, 5, 6], [6, 5, 4]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
55 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
56 # With nullrev |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
57 runmissingancestors([-1], [12]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
58 runmissingancestors([12], [-1]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
59 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
60 # 9 is a parent of 12. 7 is a parent of 9, so an ancestor of 12. 6 is an |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
61 # ancestor of 12 but not of 7. |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
62 runmissingancestors([12], [9]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
63 runmissingancestors([9], [12]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
64 runmissingancestors([12, 9], [7]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
65 runmissingancestors([7, 6], [12]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
66 |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
67 # More complex cases |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
68 runmissingancestors([10], [11, 12]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
69 runmissingancestors([11], [10]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
70 runmissingancestors([11], [10, 12]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
71 runmissingancestors([12], [10]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
72 runmissingancestors([12], [11]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
73 runmissingancestors([10, 11, 12], [13]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
74 runmissingancestors([13], [10, 11, 12]) |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
75 |
18091
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
76 def genlazyancestors(revs, stoprev=0, inclusive=False): |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
77 print ("%% lazy ancestor set for %s, stoprev = %s, inclusive = %s" % |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
78 (revs, stoprev, inclusive)) |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
79 return ancestor.lazyancestors(mockchangelog, revs, stoprev=stoprev, |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
80 inclusive=inclusive) |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
81 |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
82 def printlazyancestors(s, l): |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
83 print [n for n in l if n in s] |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
84 |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
85 def test_lazyancestors(): |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
86 # Empty revs |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
87 s = genlazyancestors([]) |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
88 printlazyancestors(s, [3, 0, -1]) |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
89 |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
90 # Standard example |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
91 s = genlazyancestors([11, 13]) |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
92 printlazyancestors(s, [11, 13, 7, 9, 8, 3, 6, 4, 1, -1, 0]) |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
93 |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
94 # Including revs |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
95 s = genlazyancestors([11, 13], inclusive=True) |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
96 printlazyancestors(s, [11, 13, 7, 9, 8, 3, 6, 4, 1, -1, 0]) |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
97 |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
98 # Test with stoprev |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
99 s = genlazyancestors([11, 13], stoprev=6) |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
100 printlazyancestors(s, [11, 13, 7, 9, 8, 3, 6, 4, 1, -1, 0]) |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
101 s = genlazyancestors([11, 13], stoprev=6, inclusive=True) |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
102 printlazyancestors(s, [11, 13, 7, 9, 8, 3, 6, 4, 1, -1, 0]) |
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
103 |
19504
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
104 |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
105 # The C gca algorithm requires a real repo. These are textual descriptions of |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
106 # dags that have been known to be problematic. |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
107 dagtests = [ |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
108 '+2*2*2/*3/2', |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
109 '+3*3/*2*2/*4*4/*4/2*4/2*2', |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
110 ] |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
111 def test_gca(): |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
112 u = ui.ui() |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
113 for i, dag in enumerate(dagtests): |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
114 repo = hg.repository(u, 'gca%d' % i, create=1) |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
115 cl = repo.changelog |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
116 if not util.safehasattr(cl.index, 'ancestors'): |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
117 # C version not available |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
118 return |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
119 |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
120 commands.debugbuilddag(u, repo, dag) |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
121 # Compare the results of the Python and C versions. This does not |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
122 # include choosing a winner when more than one gca exists -- we make |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
123 # sure both return exactly the same set of gcas. |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
124 for a in cl: |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
125 for b in cl: |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
126 cgcas = sorted(cl.index.ancestors(a, b)) |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
127 pygcas = sorted(ancestor.ancestors(cl.parentrevs, a, b)) |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
128 if cgcas != pygcas: |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
129 print "test_gca: for dag %s, gcas for %d, %d:" % (dag, a, b) |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
130 print " C returned: %s" % cgcas |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
131 print " Python returned: %s" % pygcas |
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
132 |
18079
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
133 if __name__ == '__main__': |
b3ba69692f8a
ancestor: move missingancestors doctest out into a separate file
Siddharth Agarwal <sid0@fb.com>
parents:
diff
changeset
|
134 test_missingancestors() |
18091
f7f8159caad3
ancestor: add lazy membership testing to lazyancestors
Siddharth Agarwal <sid0@fb.com>
parents:
18079
diff
changeset
|
135 test_lazyancestors() |
19504
2fa303619b4d
ancestor.deepest: ignore ninteresting while building result (issue3984)
Siddharth Agarwal <sid0@fb.com>
parents:
18091
diff
changeset
|
136 test_gca() |