##// END OF EJS Templates
revset: improves time complexity of 'roots(xxx)'...
Pierre-Yves David -
r25647:46a96dd4 default
parent child Browse files
Show More
@@ -23,8 +23,6 b' parents(20000)'
23 # Used in revision 911f5a6579d1
23 # Used in revision 911f5a6579d1
24 p1(20000)
24 p1(20000)
25 p2(10000)
25 p2(10000)
26 # Used in revision f140d6207cca
27 roots(0:tip)
28 # Used in revision b6dc3b79bb25
26 # Used in revision b6dc3b79bb25
29 0::
27 0::
30 # Used in revision faf4f63533ff
28 # Used in revision faf4f63533ff
@@ -101,15 +99,12 b' draft()'
101 ::tip
99 ::tip
102 draft() and ::tip
100 draft() and ::tip
103 ::tip and draft()
101 ::tip and draft()
104 roots(0::tip)
105 author(lmoscovicz)
102 author(lmoscovicz)
106 author(mpm)
103 author(mpm)
107 42:68 and roots(42:tip)
108 ::p1(p1(tip))::
104 ::p1(p1(tip))::
109 public()
105 public()
110 :10000 and public()
106 :10000 and public()
111 :10000 and draft()
107 :10000 and draft()
112 roots((0:tip)::)
113 (not public() - obsolete())
108 (not public() - obsolete())
114
109
115 # The one below is used by rebase
110 # The one below is used by rebase
@@ -119,6 +114,18 b' roots((0:tip)::)'
119 roots((tip~100::) - (tip~100::tip))
114 roots((tip~100::) - (tip~100::tip))
120 roots((0::) - (0::tip))
115 roots((0::) - (0::tip))
121
116
117 # more roots testing
118 roots(tip~100:)
119 roots(:42)
120 roots(not public())
121 roots((0:tip)::)
122 roots(0::tip)
123 42:68 and roots(42:tip)
124 # Used in revision f140d6207cca
125 roots(0:tip)
126 # test disjoint set with multiple roots
127 roots((:42) + (tip~42:))
128
122 # Testing the behavior of "head()" in various situations
129 # Testing the behavior of "head()" in various situations
123 head()
130 head()
124 head() - public()
131 head() - public()
@@ -1755,9 +1755,13 b' def roots(repo, subset, x):'
1755 Changesets in set with no parent changeset in set.
1755 Changesets in set with no parent changeset in set.
1756 """
1756 """
1757 s = getset(repo, fullreposet(repo), x)
1757 s = getset(repo, fullreposet(repo), x)
1758 subset = subset & s# baseset([r for r in s if r in subset])
1758 parents = repo.changelog.parentrevs
1759 cs = _children(repo, subset, s)
1759 def filter(r):
1760 return subset - cs
1760 for p in parents(r):
1761 if 0 <= p and p in s:
1762 return False
1763 return True
1764 return subset & s.filter(filter)
1761
1765
1762 def sort(repo, subset, x):
1766 def sort(repo, subset, x):
1763 """``sort(set[, [-]key...])``
1767 """``sort(set[, [-]key...])``
General Comments 0
You need to be logged in to leave comments. Login now