##// END OF EJS Templates
revset: import set classes directly from smartset module...
Yuya Nishihara -
r31023:aea06029 default
parent child Browse files
Show More
@@ -22,8 +22,8 from mercurial import (
22 match as matchmod,
22 match as matchmod,
23 pathutil,
23 pathutil,
24 registrar,
24 registrar,
25 revset,
26 scmutil,
25 scmutil,
26 smartset,
27 util,
27 util,
28 )
28 )
29
29
@@ -855,7 +855,7 def pulledrevsetsymbol(repo, subset, x):
855 firstpulled = repo.firstpulled
855 firstpulled = repo.firstpulled
856 except AttributeError:
856 except AttributeError:
857 raise error.Abort(_("pulled() only available in --lfrev"))
857 raise error.Abort(_("pulled() only available in --lfrev"))
858 return revset.baseset([r for r in subset if r >= firstpulled])
858 return smartset.baseset([r for r in subset if r >= firstpulled])
859
859
860 def overrideclone(orig, ui, source, dest=None, **opts):
860 def overrideclone(orig, ui, source, dest=None, **opts):
861 d = dest
861 d = dest
@@ -91,6 +91,7 from mercurial import (
91 registrar,
91 registrar,
92 revset,
92 revset,
93 scmutil,
93 scmutil,
94 smartset,
94 subrepo,
95 subrepo,
95 util,
96 util,
96 )
97 )
@@ -3569,7 +3570,7 def revsetmq(repo, subset, x):
3569 """
3570 """
3570 revset.getargs(x, 0, 0, _("mq takes no arguments"))
3571 revset.getargs(x, 0, 0, _("mq takes no arguments"))
3571 applied = set([repo[r.node].rev() for r in repo.mq.applied])
3572 applied = set([repo[r.node].rev() for r in repo.mq.applied])
3572 return revset.baseset([r for r in subset if r in applied])
3573 return smartset.baseset([r for r in subset if r in applied])
3573
3574
3574 # tell hggettext to extract docstrings from these functions:
3575 # tell hggettext to extract docstrings from these functions:
3575 i18nfunctions = [revsetmq]
3576 i18nfunctions = [revsetmq]
@@ -47,6 +47,7 from mercurial import (
47 repoview,
47 repoview,
48 revset,
48 revset,
49 scmutil,
49 scmutil,
50 smartset,
50 util,
51 util,
51 )
52 )
52
53
@@ -118,8 +119,8 def _revsetdestrebase(repo, subset, x):
118 # i18n: "_rebasedefaultdest" is a keyword
119 # i18n: "_rebasedefaultdest" is a keyword
119 sourceset = None
120 sourceset = None
120 if x is not None:
121 if x is not None:
121 sourceset = revset.getset(repo, revset.fullreposet(repo), x)
122 sourceset = revset.getset(repo, smartset.fullreposet(repo), x)
122 return subset & revset.baseset([_destrebase(repo, sourceset)])
123 return subset & smartset.baseset([_destrebase(repo, sourceset)])
123
124
124 class rebaseruntime(object):
125 class rebaseruntime(object):
125 """This class is a container for rebase runtime state"""
126 """This class is a container for rebase runtime state"""
@@ -33,6 +33,7 from mercurial import (
33 revlog,
33 revlog,
34 revset,
34 revset,
35 scmutil,
35 scmutil,
36 smartset,
36 util,
37 util,
37 )
38 )
38
39
@@ -723,7 +724,7 def revsettransplanted(repo, subset, x):
723 s = revset.getset(repo, subset, x)
724 s = revset.getset(repo, subset, x)
724 else:
725 else:
725 s = subset
726 s = subset
726 return revset.baseset([r for r in s if
727 return smartset.baseset([r for r in s if
727 repo[r].extra().get('transplant_source')])
728 repo[r].extra().get('transplant_source')])
728
729
729 templatekeyword = registrar.templatekeyword()
730 templatekeyword = registrar.templatekeyword()
@@ -41,6 +41,7 from . import (
41 revlog,
41 revlog,
42 revset,
42 revset,
43 scmutil,
43 scmutil,
44 smartset,
44 templatekw,
45 templatekw,
45 templater,
46 templater,
46 util,
47 util,
@@ -2090,11 +2091,11 def _logrevs(repo, opts):
2090 if opts.get('rev'):
2091 if opts.get('rev'):
2091 revs = scmutil.revrange(repo, opts['rev'])
2092 revs = scmutil.revrange(repo, opts['rev'])
2092 elif follow and repo.dirstate.p1() == nullid:
2093 elif follow and repo.dirstate.p1() == nullid:
2093 revs = revset.baseset()
2094 revs = smartset.baseset()
2094 elif follow:
2095 elif follow:
2095 revs = repo.revs('reverse(:.)')
2096 revs = repo.revs('reverse(:.)')
2096 else:
2097 else:
2097 revs = revset.spanset(repo)
2098 revs = smartset.spanset(repo)
2098 revs.reverse()
2099 revs.reverse()
2099 return revs
2100 return revs
2100
2101
@@ -2109,7 +2110,7 def getgraphlogrevs(repo, pats, opts):
2109 limit = loglimit(opts)
2110 limit = loglimit(opts)
2110 revs = _logrevs(repo, opts)
2111 revs = _logrevs(repo, opts)
2111 if not revs:
2112 if not revs:
2112 return revset.baseset(), None, None
2113 return smartset.baseset(), None, None
2113 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
2114 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
2114 if opts.get('rev'):
2115 if opts.get('rev'):
2115 # User-specified revs might be unsorted, but don't sort before
2116 # User-specified revs might be unsorted, but don't sort before
@@ -2125,7 +2126,7 def getgraphlogrevs(repo, pats, opts):
2125 if idx >= limit:
2126 if idx >= limit:
2126 break
2127 break
2127 limitedrevs.append(rev)
2128 limitedrevs.append(rev)
2128 revs = revset.baseset(limitedrevs)
2129 revs = smartset.baseset(limitedrevs)
2129
2130
2130 return revs, expr, filematcher
2131 return revs, expr, filematcher
2131
2132
@@ -2140,7 +2141,7 def getlogrevs(repo, pats, opts):
2140 limit = loglimit(opts)
2141 limit = loglimit(opts)
2141 revs = _logrevs(repo, opts)
2142 revs = _logrevs(repo, opts)
2142 if not revs:
2143 if not revs:
2143 return revset.baseset([]), None, None
2144 return smartset.baseset([]), None, None
2144 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
2145 expr, filematcher = _makelogrevset(repo, pats, opts, revs)
2145 if expr:
2146 if expr:
2146 matcher = revset.match(repo.ui, expr, order=revset.followorder)
2147 matcher = revset.match(repo.ui, expr, order=revset.followorder)
@@ -2151,7 +2152,7 def getlogrevs(repo, pats, opts):
2151 if limit <= idx:
2152 if limit <= idx:
2152 break
2153 break
2153 limitedrevs.append(r)
2154 limitedrevs.append(r)
2154 revs = revset.baseset(limitedrevs)
2155 revs = smartset.baseset(limitedrevs)
2155
2156
2156 return revs, expr, filematcher
2157 return revs, expr, filematcher
2157
2158
@@ -22,6 +22,7 from __future__ import absolute_import
22 from .node import nullrev
22 from .node import nullrev
23 from . import (
23 from . import (
24 revset,
24 revset,
25 smartset,
25 util,
26 util,
26 )
27 )
27
28
@@ -67,8 +68,8 def dagwalker(repo, revs):
67 if gp is None:
68 if gp is None:
68 # precompute slow query as we know reachableroots() goes
69 # precompute slow query as we know reachableroots() goes
69 # through all revs (issue4782)
70 # through all revs (issue4782)
70 if not isinstance(revs, revset.baseset):
71 if not isinstance(revs, smartset.baseset):
71 revs = revset.baseset(revs)
72 revs = smartset.baseset(revs)
72 gp = gpcache[mpar] = sorted(set(revset.reachableroots(
73 gp = gpcache[mpar] = sorted(set(revset.reachableroots(
73 repo, revs, [mpar])))
74 repo, revs, [mpar])))
74 if not gp:
75 if not gp:
@@ -33,6 +33,7 from .. import (
33 graphmod,
33 graphmod,
34 revset,
34 revset,
35 scmutil,
35 scmutil,
36 smartset,
36 templatefilters,
37 templatefilters,
37 templater,
38 templater,
38 util,
39 util,
@@ -1148,7 +1149,7 def graph(web, req, tmpl):
1148 # We have to feed a baseset to dagwalker as it is expecting smartset
1149 # We have to feed a baseset to dagwalker as it is expecting smartset
1149 # object. This does not have a big impact on hgweb performance itself
1150 # object. This does not have a big impact on hgweb performance itself
1150 # since hgweb graphing code is not itself lazy yet.
1151 # since hgweb graphing code is not itself lazy yet.
1151 dag = graphmod.dagwalker(web.repo, revset.baseset(revs))
1152 dag = graphmod.dagwalker(web.repo, smartset.baseset(revs))
1152 # As we said one line above... not lazy.
1153 # As we said one line above... not lazy.
1153 tree = list(graphmod.colored(dag, web.repo))
1154 tree = list(graphmod.colored(dag, web.repo))
1154
1155
General Comments 0
You need to be logged in to leave comments. Login now