##// END OF EJS Templates
revset: stop serializing node when using "%ln"...
marmoute -
r52469:de5bf3fe default
parent child Browse files
Show More
@@ -149,6 +149,22 b' def rawsmartset(repo, subset, x, order):'
149 149 return x & subset
150 150
151 151
152 def raw_node_set(repo, subset, x, order):
153 """argument is a list of nodeid, resolve and use them"""
154 nodes = _ordered_node_set(repo, x)
155 if order == followorder:
156 return subset & nodes
157 else:
158 return nodes & subset
159
160
161 def _ordered_node_set(repo, nodes):
162 if not nodes:
163 return baseset()
164 to_rev = repo.changelog.index.rev
165 return baseset([to_rev(r) for r in nodes])
166
167
152 168 def rangeset(repo, subset, x, y, order):
153 169 m = getset(repo, fullreposet(repo), x)
154 170 n = getset(repo, fullreposet(repo), y)
@@ -2772,6 +2788,7 b' methods = {'
2772 2788 b"parent": parentspec,
2773 2789 b"parentpost": parentpost,
2774 2790 b"smartset": rawsmartset,
2791 b"nodeset": raw_node_set,
2775 2792 }
2776 2793
2777 2794 relations = {
@@ -392,7 +392,7 b' def _analyze(x):'
392 392 elif op == b'negate':
393 393 s = getstring(x[1], _(b"can't negate that"))
394 394 return _analyze((b'string', b'-' + s))
395 elif op in (b'string', b'symbol', b'smartset'):
395 elif op in (b'string', b'symbol', b'smartset', b'nodeset'):
396 396 return x
397 397 elif op == b'rangeall':
398 398 return (op, None)
@@ -441,8 +441,9 b' def _optimize(x):'
441 441 return 0, x
442 442
443 443 op = x[0]
444 if op in (b'string', b'symbol', b'smartset'):
445 return 0.5, x # single revisions are small
444 if op in (b'string', b'symbol', b'smartset', b'nodeset'):
445 # single revisions are small, and set of already computed revision are assumed to be cheap.
446 return 0.5, x
446 447 elif op == b'and':
447 448 wa, ta = _optimize(x[1])
448 449 wb, tb = _optimize(x[2])
@@ -784,6 +785,8 b' def formatspec(expr, *args):'
784 785 if isinstance(arg, set):
785 786 arg = sorted(arg)
786 787 ret.append(_formatintlist(list(arg)))
788 elif t == b'nodeset':
789 ret.append(_formatlistexp(list(arg), b"n"))
787 790 else:
788 791 raise error.ProgrammingError(b"unknown revspec item type: %r" % t)
789 792 return b''.join(ret)
@@ -801,6 +804,10 b' def spectree(expr, *args):'
801 804 newtree = (b'smartset', smartset.baseset(arg))
802 805 inputs.append(newtree)
803 806 ret.append(b"$")
807 elif t == b'nodeset':
808 newtree = (b'nodeset', arg)
809 inputs.append(newtree)
810 ret.append(b"$")
804 811 else:
805 812 raise error.ProgrammingError(b"unknown revspec item type: %r" % t)
806 813 expr = b''.join(ret)
@@ -863,6 +870,12 b' def _parseargs(expr, args):'
863 870 ret.append((b'baseset', arg))
864 871 pos += 1
865 872 continue
873 elif islist and d == b'n' and arg:
874 # we cannot turn the node into revision yet, but not
875 # serializing them will same a lot of time for large set.
876 ret.append((b'nodeset', arg))
877 pos += 1
878 continue
866 879 try:
867 880 ret.append((None, f(list(arg), d)))
868 881 except (TypeError, ValueError):
General Comments 0
You need to be logged in to leave comments. Login now