|
@@
-53,9
+53,9
b' def _revsbetween(repo, roots, heads):'
|
|
53
|
"""Return all paths between roots and heads, inclusive of both endpoint
|
|
53
|
"""Return all paths between roots and heads, inclusive of both endpoint
|
|
54
|
sets."""
|
|
54
|
sets."""
|
|
55
|
if not roots:
|
|
55
|
if not roots:
|
|
56
|
return []
|
|
56
|
return baseset([])
|
|
57
|
parentrevs = repo.changelog.parentrevs
|
|
57
|
parentrevs = repo.changelog.parentrevs
|
|
58
|
visit = heads[:]
|
|
58
|
visit = baseset(heads)
|
|
59
|
reachable = set()
|
|
59
|
reachable = set()
|
|
60
|
seen = {}
|
|
60
|
seen = {}
|
|
61
|
minroot = min(roots)
|
|
61
|
minroot = min(roots)
|
|
@@
-72,12
+72,12
b' def _revsbetween(repo, roots, heads):'
|
|
72
|
if parent >= minroot and parent not in seen:
|
|
72
|
if parent >= minroot and parent not in seen:
|
|
73
|
visit.append(parent)
|
|
73
|
visit.append(parent)
|
|
74
|
if not reachable:
|
|
74
|
if not reachable:
|
|
75
|
return []
|
|
75
|
return baseset([])
|
|
76
|
for rev in sorted(seen):
|
|
76
|
for rev in sorted(seen):
|
|
77
|
for parent in seen[rev]:
|
|
77
|
for parent in seen[rev]:
|
|
78
|
if parent in reachable:
|
|
78
|
if parent in reachable:
|
|
79
|
reachable.add(rev)
|
|
79
|
reachable.add(rev)
|
|
80
|
return sorted(reachable)
|
|
80
|
return baseset(sorted(reachable))
|
|
81
|
|
|
81
|
|
|
82
|
elements = {
|
|
82
|
elements = {
|
|
83
|
"(": (20, ("group", 1, ")"), ("func", 1, ")")),
|
|
83
|
"(": (20, ("group", 1, ")"), ("func", 1, ")")),
|
|
@@
-195,7
+195,7
b' def getargs(x, min, max, err):'
|
|
195
|
def getset(repo, subset, x):
|
|
195
|
def getset(repo, subset, x):
|
|
196
|
if not x:
|
|
196
|
if not x:
|
|
197
|
raise error.ParseError(_("missing argument"))
|
|
197
|
raise error.ParseError(_("missing argument"))
|
|
198
|
return methods[x[0]](repo, subset, *x[1:])
|
|
198
|
return baseset(methods[x[0]](repo, subset, *x[1:]))
|
|
199
|
|
|
199
|
|
|
200
|
def _getrevsource(repo, r):
|
|
200
|
def _getrevsource(repo, r):
|
|
201
|
extra = repo[r].extra()
|
|
201
|
extra = repo[r].extra()
|
|
@@
-212,10
+212,10
b' def _getrevsource(repo, r):'
|
|
212
|
def stringset(repo, subset, x):
|
|
212
|
def stringset(repo, subset, x):
|
|
213
|
x = repo[x].rev()
|
|
213
|
x = repo[x].rev()
|
|
214
|
if x == -1 and len(subset) == len(repo):
|
|
214
|
if x == -1 and len(subset) == len(repo):
|
|
215
|
return [-1]
|
|
215
|
return baseset([-1])
|
|
216
|
if len(subset) == len(repo) or x in subset:
|
|
216
|
if len(subset) == len(repo) or x in subset:
|
|
217
|
return [x]
|
|
217
|
return baseset([x])
|
|
218
|
return []
|
|
218
|
return baseset([])
|
|
219
|
|
|
219
|
|
|
220
|
def symbolset(repo, subset, x):
|
|
220
|
def symbolset(repo, subset, x):
|
|
221
|
if x in symbols:
|
|
221
|
if x in symbols:
|
|
@@
-223,12
+223,12
b' def symbolset(repo, subset, x):'
|
|
223
|
return stringset(repo, subset, x)
|
|
223
|
return stringset(repo, subset, x)
|
|
224
|
|
|
224
|
|
|
225
|
def rangeset(repo, subset, x, y):
|
|
225
|
def rangeset(repo, subset, x, y):
|
|
226
|
cl = repo.changelog
|
|
226
|
cl = baseset(repo.changelog)
|
|
227
|
m = getset(repo, cl, x)
|
|
227
|
m = getset(repo, cl, x)
|
|
228
|
n = getset(repo, cl, y)
|
|
228
|
n = getset(repo, cl, y)
|
|
229
|
|
|
229
|
|
|
230
|
if not m or not n:
|
|
230
|
if not m or not n:
|
|
231
|
return []
|
|
231
|
return baseset([])
|
|
232
|
m, n = m[0], n[-1]
|
|
232
|
m, n = m[0], n[-1]
|
|
233
|
|
|
233
|
|
|
234
|
if m < n:
|
|
234
|
if m < n:
|
|
@@
-236,13
+236,13
b' def rangeset(repo, subset, x, y):'
|
|
236
|
else:
|
|
236
|
else:
|
|
237
|
r = range(m, n - 1, -1)
|
|
237
|
r = range(m, n - 1, -1)
|
|
238
|
s = set(subset)
|
|
238
|
s = set(subset)
|
|
239
|
return [x for x in r if x in s]
|
|
239
|
return baseset([x for x in r if x in s])
|
|
240
|
|
|
240
|
|
|
241
|
def dagrange(repo, subset, x, y):
|
|
241
|
def dagrange(repo, subset, x, y):
|
|
242
|
r = list(repo)
|
|
242
|
r = baseset(repo)
|
|
243
|
xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y))
|
|
243
|
xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y))
|
|
244
|
s = set(subset)
|
|
244
|
s = set(subset)
|
|
245
|
return [r for r in xs if r in s]
|
|
245
|
return baseset([r for r in xs if r in s])
|
|
246
|
|
|
246
|
|
|
247
|
def andset(repo, subset, x, y):
|
|
247
|
def andset(repo, subset, x, y):
|
|
248
|
return getset(repo, getset(repo, subset, x), y)
|
|
248
|
return getset(repo, getset(repo, subset, x), y)
|
|
@@
-251,11
+251,11
b' def orset(repo, subset, x, y):'
|
|
251
|
xl = getset(repo, subset, x)
|
|
251
|
xl = getset(repo, subset, x)
|
|
252
|
s = set(xl)
|
|
252
|
s = set(xl)
|
|
253
|
yl = getset(repo, [r for r in subset if r not in s], y)
|
|
253
|
yl = getset(repo, [r for r in subset if r not in s], y)
|
|
254
|
return xl + yl
|
|
254
|
return baseset(xl + yl)
|
|
255
|
|
|
255
|
|
|
256
|
def notset(repo, subset, x):
|
|
256
|
def notset(repo, subset, x):
|
|
257
|
s = set(getset(repo, subset, x))
|
|
257
|
s = set(getset(repo, subset, x))
|
|
258
|
return [r for r in subset if r not in s]
|
|
258
|
return baseset([r for r in subset if r not in s])
|
|
259
|
|
|
259
|
|
|
260
|
def listset(repo, subset, a, b):
|
|
260
|
def listset(repo, subset, a, b):
|
|
261
|
raise error.ParseError(_("can't use a list in this context"))
|
|
261
|
raise error.ParseError(_("can't use a list in this context"))
|
|
@@
-289,7
+289,7
b' def ancestor(repo, subset, x):'
|
|
289
|
"""
|
|
289
|
"""
|
|
290
|
# i18n: "ancestor" is a keyword
|
|
290
|
# i18n: "ancestor" is a keyword
|
|
291
|
l = getlist(x)
|
|
291
|
l = getlist(x)
|
|
292
|
rl = list(repo)
|
|
292
|
rl = baseset(repo)
|
|
293
|
anc = None
|
|
293
|
anc = None
|
|
294
|
|
|
294
|
|
|
295
|
# (getset(repo, rl, i) for i in l) generates a list of lists
|
|
295
|
# (getset(repo, rl, i) for i in l) generates a list of lists
|
|
@@
-304,15
+304,15
b' def ancestor(repo, subset, x):'
|
|
304
|
anc = rev(ancestor(node(anc), node(r)))
|
|
304
|
anc = rev(ancestor(node(anc), node(r)))
|
|
305
|
|
|
305
|
|
|
306
|
if anc is not None and anc in subset:
|
|
306
|
if anc is not None and anc in subset:
|
|
307
|
return [anc]
|
|
307
|
return baseset([anc])
|
|
308
|
return []
|
|
308
|
return baseset([])
|
|
309
|
|
|
309
|
|
|
310
|
def _ancestors(repo, subset, x, followfirst=False):
|
|
310
|
def _ancestors(repo, subset, x, followfirst=False):
|
|
311
|
args = getset(repo, list(repo), x)
|
|
311
|
args = getset(repo, baseset(repo), x)
|
|
312
|
if not args:
|
|
312
|
if not args:
|
|
313
|
return []
|
|
313
|
return baseset([])
|
|
314
|
s = set(_revancestors(repo, args, followfirst)) | set(args)
|
|
314
|
s = set(_revancestors(repo, args, followfirst)) | set(args)
|
|
315
|
return [r for r in subset if r in s]
|
|
315
|
return baseset([r for r in subset if r in s])
|
|
316
|
|
|
316
|
|
|
317
|
def ancestors(repo, subset, x):
|
|
317
|
def ancestors(repo, subset, x):
|
|
318
|
"""``ancestors(set)``
|
|
318
|
"""``ancestors(set)``
|
|
@@
-340,7
+340,7
b' def ancestorspec(repo, subset, x, n):'
|
|
340
|
for i in range(n):
|
|
340
|
for i in range(n):
|
|
341
|
r = cl.parentrevs(r)[0]
|
|
341
|
r = cl.parentrevs(r)[0]
|
|
342
|
ps.add(r)
|
|
342
|
ps.add(r)
|
|
343
|
return [r for r in subset if r in ps]
|
|
343
|
return baseset([r for r in subset if r in ps])
|
|
344
|
|
|
344
|
|
|
345
|
def author(repo, subset, x):
|
|
345
|
def author(repo, subset, x):
|
|
346
|
"""``author(string)``
|
|
346
|
"""``author(string)``
|
|
@@
-349,7
+349,8
b' def author(repo, subset, x):'
|
|
349
|
# i18n: "author" is a keyword
|
|
349
|
# i18n: "author" is a keyword
|
|
350
|
n = encoding.lower(getstring(x, _("author requires a string")))
|
|
350
|
n = encoding.lower(getstring(x, _("author requires a string")))
|
|
351
|
kind, pattern, matcher = _substringmatcher(n)
|
|
351
|
kind, pattern, matcher = _substringmatcher(n)
|
|
352
|
return [r for r in subset if matcher(encoding.lower(repo[r].user()))]
|
|
352
|
return baseset([r for r in subset if
|
|
|
|
|
353
|
matcher(encoding.lower(repo[r].user()))])
|
|
353
|
|
|
354
|
|
|
354
|
def bisect(repo, subset, x):
|
|
355
|
def bisect(repo, subset, x):
|
|
355
|
"""``bisect(string)``
|
|
356
|
"""``bisect(string)``
|
|
@@
-366,7
+367,7
b' def bisect(repo, subset, x):'
|
|
366
|
# i18n: "bisect" is a keyword
|
|
367
|
# i18n: "bisect" is a keyword
|
|
367
|
status = getstring(x, _("bisect requires a string")).lower()
|
|
368
|
status = getstring(x, _("bisect requires a string")).lower()
|
|
368
|
state = set(hbisect.get(repo, status))
|
|
369
|
state = set(hbisect.get(repo, status))
|
|
369
|
return [r for r in subset if r in state]
|
|
370
|
return baseset([r for r in subset if r in state])
|
|
370
|
|
|
371
|
|
|
371
|
# Backward-compatibility
|
|
372
|
# Backward-compatibility
|
|
372
|
# - no help entry so that we do not advertise it any more
|
|
373
|
# - no help entry so that we do not advertise it any more
|
|
@@
-393,7
+394,7
b' def bookmark(repo, subset, x):'
|
|
393
|
if not bmrev:
|
|
394
|
if not bmrev:
|
|
394
|
raise util.Abort(_("bookmark '%s' does not exist") % bm)
|
|
395
|
raise util.Abort(_("bookmark '%s' does not exist") % bm)
|
|
395
|
bmrev = repo[bmrev].rev()
|
|
396
|
bmrev = repo[bmrev].rev()
|
|
396
|
return [r for r in subset if r == bmrev]
|
|
397
|
return baseset([r for r in subset if r == bmrev])
|
|
397
|
else:
|
|
398
|
else:
|
|
398
|
matchrevs = set()
|
|
399
|
matchrevs = set()
|
|
399
|
for name, bmrev in repo._bookmarks.iteritems():
|
|
400
|
for name, bmrev in repo._bookmarks.iteritems():
|
|
@@
-405,11
+406,11
b' def bookmark(repo, subset, x):'
|
|
405
|
bmrevs = set()
|
|
406
|
bmrevs = set()
|
|
406
|
for bmrev in matchrevs:
|
|
407
|
for bmrev in matchrevs:
|
|
407
|
bmrevs.add(repo[bmrev].rev())
|
|
408
|
bmrevs.add(repo[bmrev].rev())
|
|
408
|
return [r for r in subset if r in bmrevs]
|
|
409
|
return baseset([r for r in subset if r in bmrevs])
|
|
409
|
|
|
410
|
|
|
410
|
bms = set([repo[r].rev()
|
|
411
|
bms = set([repo[r].rev()
|
|
411
|
for r in repo._bookmarks.values()])
|
|
412
|
for r in repo._bookmarks.values()])
|
|
412
|
return [r for r in subset if r in bms]
|
|
413
|
return baseset([r for r in subset if r in bms])
|
|
413
|
|
|
414
|
|
|
414
|
def branch(repo, subset, x):
|
|
415
|
def branch(repo, subset, x):
|
|
415
|
"""``branch(string or set)``
|
|
416
|
"""``branch(string or set)``
|
|
@@
-431,16
+432,16
b' def branch(repo, subset, x):'
|
|
431
|
# note: falls through to the revspec case if no branch with
|
|
432
|
# note: falls through to the revspec case if no branch with
|
|
432
|
# this name exists
|
|
433
|
# this name exists
|
|
433
|
if pattern in repo.branchmap():
|
|
434
|
if pattern in repo.branchmap():
|
|
434
|
return [r for r in subset if matcher(repo[r].branch())]
|
|
435
|
return baseset([r for r in subset if matcher(repo[r].branch())])
|
|
435
|
else:
|
|
436
|
else:
|
|
436
|
return [r for r in subset if matcher(repo[r].branch())]
|
|
437
|
return baseset([r for r in subset if matcher(repo[r].branch())])
|
|
437
|
|
|
438
|
|
|
438
|
s = getset(repo, list(repo), x)
|
|
439
|
s = getset(repo, baseset(repo), x)
|
|
439
|
b = set()
|
|
440
|
b = set()
|
|
440
|
for r in s:
|
|
441
|
for r in s:
|
|
441
|
b.add(repo[r].branch())
|
|
442
|
b.add(repo[r].branch())
|
|
442
|
s = set(s)
|
|
443
|
s = set(s)
|
|
443
|
return [r for r in subset if r in s or repo[r].branch() in b]
|
|
444
|
return baseset([r for r in subset if r in s or repo[r].branch() in b])
|
|
444
|
|
|
445
|
|
|
445
|
def bumped(repo, subset, x):
|
|
446
|
def bumped(repo, subset, x):
|
|
446
|
"""``bumped()``
|
|
447
|
"""``bumped()``
|
|
@@
-451,7
+452,7
b' def bumped(repo, subset, x):'
|
|
451
|
# i18n: "bumped" is a keyword
|
|
452
|
# i18n: "bumped" is a keyword
|
|
452
|
getargs(x, 0, 0, _("bumped takes no arguments"))
|
|
453
|
getargs(x, 0, 0, _("bumped takes no arguments"))
|
|
453
|
bumped = obsmod.getrevs(repo, 'bumped')
|
|
454
|
bumped = obsmod.getrevs(repo, 'bumped')
|
|
454
|
return [r for r in subset if r in bumped]
|
|
455
|
return baseset([r for r in subset if r in bumped])
|
|
455
|
|
|
456
|
|
|
456
|
def bundle(repo, subset, x):
|
|
457
|
def bundle(repo, subset, x):
|
|
457
|
"""``bundle()``
|
|
458
|
"""``bundle()``
|
|
@@
-463,7
+464,7
b' def bundle(repo, subset, x):'
|
|
463
|
bundlerevs = repo.changelog.bundlerevs
|
|
464
|
bundlerevs = repo.changelog.bundlerevs
|
|
464
|
except AttributeError:
|
|
465
|
except AttributeError:
|
|
465
|
raise util.Abort(_("no bundle provided - specify with -R"))
|
|
466
|
raise util.Abort(_("no bundle provided - specify with -R"))
|
|
466
|
return [r for r in subset if r in bundlerevs]
|
|
467
|
return baseset([r for r in subset if r in bundlerevs])
|
|
467
|
|
|
468
|
|
|
468
|
def checkstatus(repo, subset, pat, field):
|
|
469
|
def checkstatus(repo, subset, pat, field):
|
|
469
|
m = None
|
|
470
|
m = None
|
|
@@
-494,12
+495,12
b' def checkstatus(repo, subset, pat, field'
|
|
494
|
if m(f):
|
|
495
|
if m(f):
|
|
495
|
s.append(r)
|
|
496
|
s.append(r)
|
|
496
|
break
|
|
497
|
break
|
|
497
|
return s
|
|
498
|
return baseset(s)
|
|
498
|
|
|
499
|
|
|
499
|
def _children(repo, narrow, parentset):
|
|
500
|
def _children(repo, narrow, parentset):
|
|
500
|
cs = set()
|
|
501
|
cs = set()
|
|
501
|
if not parentset:
|
|
502
|
if not parentset:
|
|
502
|
return cs
|
|
503
|
return baseset(cs)
|
|
503
|
pr = repo.changelog.parentrevs
|
|
504
|
pr = repo.changelog.parentrevs
|
|
504
|
minrev = min(parentset)
|
|
505
|
minrev = min(parentset)
|
|
505
|
for r in narrow:
|
|
506
|
for r in narrow:
|
|
@@
-508,15
+509,15
b' def _children(repo, narrow, parentset):'
|
|
508
|
for p in pr(r):
|
|
509
|
for p in pr(r):
|
|
509
|
if p in parentset:
|
|
510
|
if p in parentset:
|
|
510
|
cs.add(r)
|
|
511
|
cs.add(r)
|
|
511
|
return cs
|
|
512
|
return baseset(cs)
|
|
512
|
|
|
513
|
|
|
513
|
def children(repo, subset, x):
|
|
514
|
def children(repo, subset, x):
|
|
514
|
"""``children(set)``
|
|
515
|
"""``children(set)``
|
|
515
|
Child changesets of changesets in set.
|
|
516
|
Child changesets of changesets in set.
|
|
516
|
"""
|
|
517
|
"""
|
|
517
|
s = set(getset(repo, list(repo), x))
|
|
518
|
s = set(getset(repo, baseset(repo), x))
|
|
518
|
cs = _children(repo, subset, s)
|
|
519
|
cs = _children(repo, subset, s)
|
|
519
|
return [r for r in subset if r in cs]
|
|
520
|
return baseset([r for r in subset if r in cs])
|
|
520
|
|
|
521
|
|
|
521
|
def closed(repo, subset, x):
|
|
522
|
def closed(repo, subset, x):
|
|
522
|
"""``closed()``
|
|
523
|
"""``closed()``
|
|
@@
-524,7
+525,7
b' def closed(repo, subset, x):'
|
|
524
|
"""
|
|
525
|
"""
|
|
525
|
# i18n: "closed" is a keyword
|
|
526
|
# i18n: "closed" is a keyword
|
|
526
|
getargs(x, 0, 0, _("closed takes no arguments"))
|
|
527
|
getargs(x, 0, 0, _("closed takes no arguments"))
|
|
527
|
return [r for r in subset if repo[r].closesbranch()]
|
|
528
|
return baseset([r for r in subset if repo[r].closesbranch()])
|
|
528
|
|
|
529
|
|
|
529
|
def contains(repo, subset, x):
|
|
530
|
def contains(repo, subset, x):
|
|
530
|
"""``contains(pattern)``
|
|
531
|
"""``contains(pattern)``
|
|
@@
-553,7
+554,7
b' def contains(repo, subset, x):'
|
|
553
|
if m(f):
|
|
554
|
if m(f):
|
|
554
|
s.append(r)
|
|
555
|
s.append(r)
|
|
555
|
break
|
|
556
|
break
|
|
556
|
return s
|
|
557
|
return baseset(s)
|
|
557
|
|
|
558
|
|
|
558
|
def converted(repo, subset, x):
|
|
559
|
def converted(repo, subset, x):
|
|
559
|
"""``converted([id])``
|
|
560
|
"""``converted([id])``
|
|
@@
-575,7
+576,7
b' def converted(repo, subset, x):'
|
|
575
|
source = repo[r].extra().get('convert_revision', None)
|
|
576
|
source = repo[r].extra().get('convert_revision', None)
|
|
576
|
return source is not None and (rev is None or source.startswith(rev))
|
|
577
|
return source is not None and (rev is None or source.startswith(rev))
|
|
577
|
|
|
578
|
|
|
578
|
return [r for r in subset if _matchvalue(r)]
|
|
579
|
return baseset([r for r in subset if _matchvalue(r)])
|
|
579
|
|
|
580
|
|
|
580
|
def date(repo, subset, x):
|
|
581
|
def date(repo, subset, x):
|
|
581
|
"""``date(interval)``
|
|
582
|
"""``date(interval)``
|
|
@@
-584,7
+585,7
b' def date(repo, subset, x):'
|
|
584
|
# i18n: "date" is a keyword
|
|
585
|
# i18n: "date" is a keyword
|
|
585
|
ds = getstring(x, _("date requires a string"))
|
|
586
|
ds = getstring(x, _("date requires a string"))
|
|
586
|
dm = util.matchdate(ds)
|
|
587
|
dm = util.matchdate(ds)
|
|
587
|
return [r for r in subset if dm(repo[r].date()[0])]
|
|
588
|
return baseset([r for r in subset if dm(repo[r].date()[0])])
|
|
588
|
|
|
589
|
|
|
589
|
def desc(repo, subset, x):
|
|
590
|
def desc(repo, subset, x):
|
|
590
|
"""``desc(string)``
|
|
591
|
"""``desc(string)``
|
|
@@
-597,14
+598,14
b' def desc(repo, subset, x):'
|
|
597
|
c = repo[r]
|
|
598
|
c = repo[r]
|
|
598
|
if ds in encoding.lower(c.description()):
|
|
599
|
if ds in encoding.lower(c.description()):
|
|
599
|
l.append(r)
|
|
600
|
l.append(r)
|
|
600
|
return l
|
|
601
|
return baseset(l)
|
|
601
|
|
|
602
|
|
|
602
|
def _descendants(repo, subset, x, followfirst=False):
|
|
603
|
def _descendants(repo, subset, x, followfirst=False):
|
|
603
|
args = getset(repo, list(repo), x)
|
|
604
|
args = getset(repo, baseset(repo), x)
|
|
604
|
if not args:
|
|
605
|
if not args:
|
|
605
|
return []
|
|
606
|
return baseset([])
|
|
606
|
s = set(_revdescendants(repo, args, followfirst)) | set(args)
|
|
607
|
s = set(_revdescendants(repo, args, followfirst)) | set(args)
|
|
607
|
return [r for r in subset if r in s]
|
|
608
|
return baseset([r for r in subset if r in s])
|
|
608
|
|
|
609
|
|
|
609
|
def descendants(repo, subset, x):
|
|
610
|
def descendants(repo, subset, x):
|
|
610
|
"""``descendants(set)``
|
|
611
|
"""``descendants(set)``
|
|
@@
-624,9
+625,9
b' def destination(repo, subset, x):'
|
|
624
|
is the same as passing all().
|
|
625
|
is the same as passing all().
|
|
625
|
"""
|
|
626
|
"""
|
|
626
|
if x is not None:
|
|
627
|
if x is not None:
|
|
627
|
args = set(getset(repo, list(repo), x))
|
|
628
|
args = set(getset(repo, baseset(repo), x))
|
|
628
|
else:
|
|
629
|
else:
|
|
629
|
args = set(getall(repo, list(repo), x))
|
|
630
|
args = set(getall(repo, baseset(repo), x))
|
|
630
|
|
|
631
|
|
|
631
|
dests = set()
|
|
632
|
dests = set()
|
|
632
|
|
|
633
|
|
|
@@
-659,7
+660,7
b' def destination(repo, subset, x):'
|
|
659
|
r = src
|
|
660
|
r = src
|
|
660
|
src = _getrevsource(repo, r)
|
|
661
|
src = _getrevsource(repo, r)
|
|
661
|
|
|
662
|
|
|
662
|
return [r for r in subset if r in dests]
|
|
663
|
return baseset([r for r in subset if r in dests])
|
|
663
|
|
|
664
|
|
|
664
|
def divergent(repo, subset, x):
|
|
665
|
def divergent(repo, subset, x):
|
|
665
|
"""``divergent()``
|
|
666
|
"""``divergent()``
|
|
@@
-668,7
+669,7
b' def divergent(repo, subset, x):'
|
|
668
|
# i18n: "divergent" is a keyword
|
|
669
|
# i18n: "divergent" is a keyword
|
|
669
|
getargs(x, 0, 0, _("divergent takes no arguments"))
|
|
670
|
getargs(x, 0, 0, _("divergent takes no arguments"))
|
|
670
|
divergent = obsmod.getrevs(repo, 'divergent')
|
|
671
|
divergent = obsmod.getrevs(repo, 'divergent')
|
|
671
|
return [r for r in subset if r in divergent]
|
|
672
|
return baseset([r for r in subset if r in divergent])
|
|
672
|
|
|
673
|
|
|
673
|
def draft(repo, subset, x):
|
|
674
|
def draft(repo, subset, x):
|
|
674
|
"""``draft()``
|
|
675
|
"""``draft()``
|
|
@@
-676,7
+677,7
b' def draft(repo, subset, x):'
|
|
676
|
# i18n: "draft" is a keyword
|
|
677
|
# i18n: "draft" is a keyword
|
|
677
|
getargs(x, 0, 0, _("draft takes no arguments"))
|
|
678
|
getargs(x, 0, 0, _("draft takes no arguments"))
|
|
678
|
pc = repo._phasecache
|
|
679
|
pc = repo._phasecache
|
|
679
|
return [r for r in subset if pc.phase(repo, r) == phases.draft]
|
|
680
|
return baseset([r for r in subset if pc.phase(repo, r) == phases.draft])
|
|
680
|
|
|
681
|
|
|
681
|
def extinct(repo, subset, x):
|
|
682
|
def extinct(repo, subset, x):
|
|
682
|
"""``extinct()``
|
|
683
|
"""``extinct()``
|
|
@@
-685,7
+686,7
b' def extinct(repo, subset, x):'
|
|
685
|
# i18n: "extinct" is a keyword
|
|
686
|
# i18n: "extinct" is a keyword
|
|
686
|
getargs(x, 0, 0, _("extinct takes no arguments"))
|
|
687
|
getargs(x, 0, 0, _("extinct takes no arguments"))
|
|
687
|
extincts = obsmod.getrevs(repo, 'extinct')
|
|
688
|
extincts = obsmod.getrevs(repo, 'extinct')
|
|
688
|
return [r for r in subset if r in extincts]
|
|
689
|
return baseset([r for r in subset if r in extincts])
|
|
689
|
|
|
690
|
|
|
690
|
def extra(repo, subset, x):
|
|
691
|
def extra(repo, subset, x):
|
|
691
|
"""``extra(label, [value])``
|
|
692
|
"""``extra(label, [value])``
|
|
@@
-712,7
+713,7
b' def extra(repo, subset, x):'
|
|
712
|
extra = repo[r].extra()
|
|
713
|
extra = repo[r].extra()
|
|
713
|
return label in extra and (value is None or matcher(extra[label]))
|
|
714
|
return label in extra and (value is None or matcher(extra[label]))
|
|
714
|
|
|
715
|
|
|
715
|
return [r for r in subset if _matchvalue(r)]
|
|
716
|
return baseset([r for r in subset if _matchvalue(r)])
|
|
716
|
|
|
717
|
|
|
717
|
def filelog(repo, subset, x):
|
|
718
|
def filelog(repo, subset, x):
|
|
718
|
"""``filelog(pattern)``
|
|
719
|
"""``filelog(pattern)``
|
|
@@
-744,7
+745,7
b' def filelog(repo, subset, x):'
|
|
744
|
for fr in fl:
|
|
745
|
for fr in fl:
|
|
745
|
s.add(fl.linkrev(fr))
|
|
746
|
s.add(fl.linkrev(fr))
|
|
746
|
|
|
747
|
|
|
747
|
return [r for r in subset if r in s]
|
|
748
|
return baseset([r for r in subset if r in s])
|
|
748
|
|
|
749
|
|
|
749
|
def first(repo, subset, x):
|
|
750
|
def first(repo, subset, x):
|
|
750
|
"""``first(set, [n])``
|
|
751
|
"""``first(set, [n])``
|
|
@@
-763,11
+764,11
b' def _follow(repo, subset, x, name, follo'
|
|
763
|
# include the revision responsible for the most recent version
|
|
764
|
# include the revision responsible for the most recent version
|
|
764
|
s.add(cx.linkrev())
|
|
765
|
s.add(cx.linkrev())
|
|
765
|
else:
|
|
766
|
else:
|
|
766
|
return []
|
|
767
|
return baseset([])
|
|
767
|
else:
|
|
768
|
else:
|
|
768
|
s = set(_revancestors(repo, [c.rev()], followfirst)) | set([c.rev()])
|
|
769
|
s = set(_revancestors(repo, [c.rev()], followfirst)) | set([c.rev()])
|
|
769
|
|
|
770
|
|
|
770
|
return [r for r in subset if r in s]
|
|
771
|
return baseset([r for r in subset if r in s])
|
|
771
|
|
|
772
|
|
|
772
|
def follow(repo, subset, x):
|
|
773
|
def follow(repo, subset, x):
|
|
773
|
"""``follow([file])``
|
|
774
|
"""``follow([file])``
|
|
@@
-809,7
+810,7
b' def grep(repo, subset, x):'
|
|
809
|
if gr.search(e):
|
|
810
|
if gr.search(e):
|
|
810
|
l.append(r)
|
|
811
|
l.append(r)
|
|
811
|
break
|
|
812
|
break
|
|
812
|
return l
|
|
813
|
return baseset(l)
|
|
813
|
|
|
814
|
|
|
814
|
def _matchfiles(repo, subset, x):
|
|
815
|
def _matchfiles(repo, subset, x):
|
|
815
|
# _matchfiles takes a revset list of prefixed arguments:
|
|
816
|
# _matchfiles takes a revset list of prefixed arguments:
|
|
@@
-872,7
+873,7
b' def _matchfiles(repo, subset, x):'
|
|
872
|
if m(f):
|
|
873
|
if m(f):
|
|
873
|
s.append(r)
|
|
874
|
s.append(r)
|
|
874
|
break
|
|
875
|
break
|
|
875
|
return s
|
|
876
|
return baseset(s)
|
|
876
|
|
|
877
|
|
|
877
|
def hasfile(repo, subset, x):
|
|
878
|
def hasfile(repo, subset, x):
|
|
878
|
"""``file(pattern)``
|
|
879
|
"""``file(pattern)``
|
|
@@
-896,7
+897,7
b' def head(repo, subset, x):'
|
|
896
|
hs = set()
|
|
897
|
hs = set()
|
|
897
|
for b, ls in repo.branchmap().iteritems():
|
|
898
|
for b, ls in repo.branchmap().iteritems():
|
|
898
|
hs.update(repo[h].rev() for h in ls)
|
|
899
|
hs.update(repo[h].rev() for h in ls)
|
|
899
|
return [r for r in subset if r in hs]
|
|
900
|
return baseset([r for r in subset if r in hs])
|
|
900
|
|
|
901
|
|
|
901
|
def heads(repo, subset, x):
|
|
902
|
def heads(repo, subset, x):
|
|
902
|
"""``heads(set)``
|
|
903
|
"""``heads(set)``
|
|
@@
-904,7
+905,7
b' def heads(repo, subset, x):'
|
|
904
|
"""
|
|
905
|
"""
|
|
905
|
s = getset(repo, subset, x)
|
|
906
|
s = getset(repo, subset, x)
|
|
906
|
ps = set(parents(repo, subset, x))
|
|
907
|
ps = set(parents(repo, subset, x))
|
|
907
|
return [r for r in s if r not in ps]
|
|
908
|
return baseset([r for r in s if r not in ps])
|
|
908
|
|
|
909
|
|
|
909
|
def hidden(repo, subset, x):
|
|
910
|
def hidden(repo, subset, x):
|
|
910
|
"""``hidden()``
|
|
911
|
"""``hidden()``
|
|
@@
-913,7
+914,7
b' def hidden(repo, subset, x):'
|
|
913
|
# i18n: "hidden" is a keyword
|
|
914
|
# i18n: "hidden" is a keyword
|
|
914
|
getargs(x, 0, 0, _("hidden takes no arguments"))
|
|
915
|
getargs(x, 0, 0, _("hidden takes no arguments"))
|
|
915
|
hiddenrevs = repoview.filterrevs(repo, 'visible')
|
|
916
|
hiddenrevs = repoview.filterrevs(repo, 'visible')
|
|
916
|
return [r for r in subset if r in hiddenrevs]
|
|
917
|
return baseset([r for r in subset if r in hiddenrevs])
|
|
917
|
|
|
918
|
|
|
918
|
def keyword(repo, subset, x):
|
|
919
|
def keyword(repo, subset, x):
|
|
919
|
"""``keyword(string)``
|
|
920
|
"""``keyword(string)``
|
|
@@
-928,7
+929,7
b' def keyword(repo, subset, x):'
|
|
928
|
if util.any(kw in encoding.lower(t)
|
|
929
|
if util.any(kw in encoding.lower(t)
|
|
929
|
for t in c.files() + [c.user(), c.description()]):
|
|
930
|
for t in c.files() + [c.user(), c.description()]):
|
|
930
|
l.append(r)
|
|
931
|
l.append(r)
|
|
931
|
return l
|
|
932
|
return baseset(l)
|
|
932
|
|
|
933
|
|
|
933
|
def limit(repo, subset, x):
|
|
934
|
def limit(repo, subset, x):
|
|
934
|
"""``limit(set, [n])``
|
|
935
|
"""``limit(set, [n])``
|
|
@@
-945,8
+946,8
b' def limit(repo, subset, x):'
|
|
945
|
# i18n: "limit" is a keyword
|
|
946
|
# i18n: "limit" is a keyword
|
|
946
|
raise error.ParseError(_("limit expects a number"))
|
|
947
|
raise error.ParseError(_("limit expects a number"))
|
|
947
|
ss = set(subset)
|
|
948
|
ss = set(subset)
|
|
948
|
os = getset(repo, list(repo), l[0])[:lim]
|
|
949
|
os = getset(repo, baseset(repo), l[0])[:lim]
|
|
949
|
return [r for r in os if r in ss]
|
|
950
|
return baseset([r for r in os if r in ss])
|
|
950
|
|
|
951
|
|
|
951
|
def last(repo, subset, x):
|
|
952
|
def last(repo, subset, x):
|
|
952
|
"""``last(set, [n])``
|
|
953
|
"""``last(set, [n])``
|
|
@@
-963,19
+964,19
b' def last(repo, subset, x):'
|
|
963
|
# i18n: "last" is a keyword
|
|
964
|
# i18n: "last" is a keyword
|
|
964
|
raise error.ParseError(_("last expects a number"))
|
|
965
|
raise error.ParseError(_("last expects a number"))
|
|
965
|
ss = set(subset)
|
|
966
|
ss = set(subset)
|
|
966
|
os = getset(repo, list(repo), l[0])[-lim:]
|
|
967
|
os = getset(repo, baseset(repo), l[0])[-lim:]
|
|
967
|
return [r for r in os if r in ss]
|
|
968
|
return baseset([r for r in os if r in ss])
|
|
968
|
|
|
969
|
|
|
969
|
def maxrev(repo, subset, x):
|
|
970
|
def maxrev(repo, subset, x):
|
|
970
|
"""``max(set)``
|
|
971
|
"""``max(set)``
|
|
971
|
Changeset with highest revision number in set.
|
|
972
|
Changeset with highest revision number in set.
|
|
972
|
"""
|
|
973
|
"""
|
|
973
|
os = getset(repo, list(repo), x)
|
|
974
|
os = getset(repo, baseset(repo), x)
|
|
974
|
if os:
|
|
975
|
if os:
|
|
975
|
m = max(os)
|
|
976
|
m = max(os)
|
|
976
|
if m in subset:
|
|
977
|
if m in subset:
|
|
977
|
return [m]
|
|
978
|
return baseset([m])
|
|
978
|
return []
|
|
979
|
return baseset([])
|
|
979
|
|
|
980
|
|
|
980
|
def merge(repo, subset, x):
|
|
981
|
def merge(repo, subset, x):
|
|
981
|
"""``merge()``
|
|
982
|
"""``merge()``
|
|
@@
-984,7
+985,7
b' def merge(repo, subset, x):'
|
|
984
|
# i18n: "merge" is a keyword
|
|
985
|
# i18n: "merge" is a keyword
|
|
985
|
getargs(x, 0, 0, _("merge takes no arguments"))
|
|
986
|
getargs(x, 0, 0, _("merge takes no arguments"))
|
|
986
|
cl = repo.changelog
|
|
987
|
cl = repo.changelog
|
|
987
|
return [r for r in subset if cl.parentrevs(r)[1] != -1]
|
|
988
|
return baseset([r for r in subset if cl.parentrevs(r)[1] != -1])
|
|
988
|
|
|
989
|
|
|
989
|
def branchpoint(repo, subset, x):
|
|
990
|
def branchpoint(repo, subset, x):
|
|
990
|
"""``branchpoint()``
|
|
991
|
"""``branchpoint()``
|
|
@@
-994,25
+995,25
b' def branchpoint(repo, subset, x):'
|
|
994
|
getargs(x, 0, 0, _("branchpoint takes no arguments"))
|
|
995
|
getargs(x, 0, 0, _("branchpoint takes no arguments"))
|
|
995
|
cl = repo.changelog
|
|
996
|
cl = repo.changelog
|
|
996
|
if not subset:
|
|
997
|
if not subset:
|
|
997
|
return []
|
|
998
|
return baseset([])
|
|
998
|
baserev = min(subset)
|
|
999
|
baserev = min(subset)
|
|
999
|
parentscount = [0]*(len(repo) - baserev)
|
|
1000
|
parentscount = [0]*(len(repo) - baserev)
|
|
1000
|
for r in cl.revs(start=baserev + 1):
|
|
1001
|
for r in cl.revs(start=baserev + 1):
|
|
1001
|
for p in cl.parentrevs(r):
|
|
1002
|
for p in cl.parentrevs(r):
|
|
1002
|
if p >= baserev:
|
|
1003
|
if p >= baserev:
|
|
1003
|
parentscount[p - baserev] += 1
|
|
1004
|
parentscount[p - baserev] += 1
|
|
1004
|
return [r for r in subset if (parentscount[r - baserev] > 1)]
|
|
1005
|
return baseset([r for r in subset if (parentscount[r - baserev] > 1)])
|
|
1005
|
|
|
1006
|
|
|
1006
|
def minrev(repo, subset, x):
|
|
1007
|
def minrev(repo, subset, x):
|
|
1007
|
"""``min(set)``
|
|
1008
|
"""``min(set)``
|
|
1008
|
Changeset with lowest revision number in set.
|
|
1009
|
Changeset with lowest revision number in set.
|
|
1009
|
"""
|
|
1010
|
"""
|
|
1010
|
os = getset(repo, list(repo), x)
|
|
1011
|
os = getset(repo, baseset(repo), x)
|
|
1011
|
if os:
|
|
1012
|
if os:
|
|
1012
|
m = min(os)
|
|
1013
|
m = min(os)
|
|
1013
|
if m in subset:
|
|
1014
|
if m in subset:
|
|
1014
|
return [m]
|
|
1015
|
return baseset([m])
|
|
1015
|
return []
|
|
1016
|
return baseset([])
|
|
1016
|
|
|
1017
|
|
|
1017
|
def modifies(repo, subset, x):
|
|
1018
|
def modifies(repo, subset, x):
|
|
1018
|
"""``modifies(pattern)``
|
|
1019
|
"""``modifies(pattern)``
|
|
@@
-1042,7
+1043,7
b' def node_(repo, subset, x):'
|
|
1042
|
if pm is not None:
|
|
1043
|
if pm is not None:
|
|
1043
|
rn = repo.changelog.rev(pm)
|
|
1044
|
rn = repo.changelog.rev(pm)
|
|
1044
|
|
|
1045
|
|
|
1045
|
return [r for r in subset if r == rn]
|
|
1046
|
return baseset([r for r in subset if r == rn])
|
|
1046
|
|
|
1047
|
|
|
1047
|
def obsolete(repo, subset, x):
|
|
1048
|
def obsolete(repo, subset, x):
|
|
1048
|
"""``obsolete()``
|
|
1049
|
"""``obsolete()``
|
|
@@
-1050,7
+1051,7
b' def obsolete(repo, subset, x):'
|
|
1050
|
# i18n: "obsolete" is a keyword
|
|
1051
|
# i18n: "obsolete" is a keyword
|
|
1051
|
getargs(x, 0, 0, _("obsolete takes no arguments"))
|
|
1052
|
getargs(x, 0, 0, _("obsolete takes no arguments"))
|
|
1052
|
obsoletes = obsmod.getrevs(repo, 'obsolete')
|
|
1053
|
obsoletes = obsmod.getrevs(repo, 'obsolete')
|
|
1053
|
return [r for r in subset if r in obsoletes]
|
|
1054
|
return baseset([r for r in subset if r in obsoletes])
|
|
1054
|
|
|
1055
|
|
|
1055
|
def origin(repo, subset, x):
|
|
1056
|
def origin(repo, subset, x):
|
|
1056
|
"""``origin([set])``
|
|
1057
|
"""``origin([set])``
|
|
@@
-1061,9
+1062,9
b' def origin(repo, subset, x):'
|
|
1061
|
for the first operation is selected.
|
|
1062
|
for the first operation is selected.
|
|
1062
|
"""
|
|
1063
|
"""
|
|
1063
|
if x is not None:
|
|
1064
|
if x is not None:
|
|
1064
|
args = set(getset(repo, list(repo), x))
|
|
1065
|
args = set(getset(repo, baseset(repo), x))
|
|
1065
|
else:
|
|
1066
|
else:
|
|
1066
|
args = set(getall(repo, list(repo), x))
|
|
1067
|
args = set(getall(repo, baseset(repo), x))
|
|
1067
|
|
|
1068
|
|
|
1068
|
def _firstsrc(rev):
|
|
1069
|
def _firstsrc(rev):
|
|
1069
|
src = _getrevsource(repo, rev)
|
|
1070
|
src = _getrevsource(repo, rev)
|
|
@@
-1078,7
+1079,7
b' def origin(repo, subset, x):'
|
|
1078
|
src = prev
|
|
1079
|
src = prev
|
|
1079
|
|
|
1080
|
|
|
1080
|
o = set([_firstsrc(r) for r in args])
|
|
1081
|
o = set([_firstsrc(r) for r in args])
|
|
1081
|
return [r for r in subset if r in o]
|
|
1082
|
return baseset([r for r in subset if r in o])
|
|
1082
|
|
|
1083
|
|
|
1083
|
def outgoing(repo, subset, x):
|
|
1084
|
def outgoing(repo, subset, x):
|
|
1084
|
"""``outgoing([path])``
|
|
1085
|
"""``outgoing([path])``
|
|
@@
-1101,7
+1102,7
b' def outgoing(repo, subset, x):'
|
|
1101
|
repo.ui.popbuffer()
|
|
1102
|
repo.ui.popbuffer()
|
|
1102
|
cl = repo.changelog
|
|
1103
|
cl = repo.changelog
|
|
1103
|
o = set([cl.rev(r) for r in outgoing.missing])
|
|
1104
|
o = set([cl.rev(r) for r in outgoing.missing])
|
|
1104
|
return [r for r in subset if r in o]
|
|
1105
|
return baseset([r for r in subset if r in o])
|
|
1105
|
|
|
1106
|
|
|
1106
|
def p1(repo, subset, x):
|
|
1107
|
def p1(repo, subset, x):
|
|
1107
|
"""``p1([set])``
|
|
1108
|
"""``p1([set])``
|
|
@@
-1109,13
+1110,13
b' def p1(repo, subset, x):'
|
|
1109
|
"""
|
|
1110
|
"""
|
|
1110
|
if x is None:
|
|
1111
|
if x is None:
|
|
1111
|
p = repo[x].p1().rev()
|
|
1112
|
p = repo[x].p1().rev()
|
|
1112
|
return [r for r in subset if r == p]
|
|
1113
|
return baseset([r for r in subset if r == p])
|
|
1113
|
|
|
1114
|
|
|
1114
|
ps = set()
|
|
1115
|
ps = set()
|
|
1115
|
cl = repo.changelog
|
|
1116
|
cl = repo.changelog
|
|
1116
|
for r in getset(repo, list(repo), x):
|
|
1117
|
for r in getset(repo, baseset(repo), x):
|
|
1117
|
ps.add(cl.parentrevs(r)[0])
|
|
1118
|
ps.add(cl.parentrevs(r)[0])
|
|
1118
|
return [r for r in subset if r in ps]
|
|
1119
|
return baseset([r for r in subset if r in ps])
|
|
1119
|
|
|
1120
|
|
|
1120
|
def p2(repo, subset, x):
|
|
1121
|
def p2(repo, subset, x):
|
|
1121
|
"""``p2([set])``
|
|
1122
|
"""``p2([set])``
|
|
@@
-1125,15
+1126,15
b' def p2(repo, subset, x):'
|
|
1125
|
ps = repo[x].parents()
|
|
1126
|
ps = repo[x].parents()
|
|
1126
|
try:
|
|
1127
|
try:
|
|
1127
|
p = ps[1].rev()
|
|
1128
|
p = ps[1].rev()
|
|
1128
|
return [r for r in subset if r == p]
|
|
1129
|
return baseset([r for r in subset if r == p])
|
|
1129
|
except IndexError:
|
|
1130
|
except IndexError:
|
|
1130
|
return []
|
|
1131
|
return baseset([])
|
|
1131
|
|
|
1132
|
|
|
1132
|
ps = set()
|
|
1133
|
ps = set()
|
|
1133
|
cl = repo.changelog
|
|
1134
|
cl = repo.changelog
|
|
1134
|
for r in getset(repo, list(repo), x):
|
|
1135
|
for r in getset(repo, baseset(repo), x):
|
|
1135
|
ps.add(cl.parentrevs(r)[1])
|
|
1136
|
ps.add(cl.parentrevs(r)[1])
|
|
1136
|
return [r for r in subset if r in ps]
|
|
1137
|
return baseset([r for r in subset if r in ps])
|
|
1137
|
|
|
1138
|
|
|
1138
|
def parents(repo, subset, x):
|
|
1139
|
def parents(repo, subset, x):
|
|
1139
|
"""``parents([set])``
|
|
1140
|
"""``parents([set])``
|
|
@@
-1141,13
+1142,13
b' def parents(repo, subset, x):'
|
|
1141
|
"""
|
|
1142
|
"""
|
|
1142
|
if x is None:
|
|
1143
|
if x is None:
|
|
1143
|
ps = tuple(p.rev() for p in repo[x].parents())
|
|
1144
|
ps = tuple(p.rev() for p in repo[x].parents())
|
|
1144
|
return [r for r in subset if r in ps]
|
|
1145
|
return baseset([r for r in subset if r in ps])
|
|
1145
|
|
|
1146
|
|
|
1146
|
ps = set()
|
|
1147
|
ps = set()
|
|
1147
|
cl = repo.changelog
|
|
1148
|
cl = repo.changelog
|
|
1148
|
for r in getset(repo, list(repo), x):
|
|
1149
|
for r in getset(repo, baseset(repo), x):
|
|
1149
|
ps.update(cl.parentrevs(r))
|
|
1150
|
ps.update(cl.parentrevs(r))
|
|
1150
|
return [r for r in subset if r in ps]
|
|
1151
|
return baseset([r for r in subset if r in ps])
|
|
1151
|
|
|
1152
|
|
|
1152
|
def parentspec(repo, subset, x, n):
|
|
1153
|
def parentspec(repo, subset, x, n):
|
|
1153
|
"""``set^0``
|
|
1154
|
"""``set^0``
|
|
@@
-1163,7
+1164,7
b' def parentspec(repo, subset, x, n):'
|
|
1163
|
raise error.ParseError(_("^ expects a number 0, 1, or 2"))
|
|
1164
|
raise error.ParseError(_("^ expects a number 0, 1, or 2"))
|
|
1164
|
ps = set()
|
|
1165
|
ps = set()
|
|
1165
|
cl = repo.changelog
|
|
1166
|
cl = repo.changelog
|
|
1166
|
for r in getset(repo, cl, x):
|
|
1167
|
for r in getset(repo, baseset(cl), x):
|
|
1167
|
if n == 0:
|
|
1168
|
if n == 0:
|
|
1168
|
ps.add(r)
|
|
1169
|
ps.add(r)
|
|
1169
|
elif n == 1:
|
|
1170
|
elif n == 1:
|
|
@@
-1172,7
+1173,7
b' def parentspec(repo, subset, x, n):'
|
|
1172
|
parents = cl.parentrevs(r)
|
|
1173
|
parents = cl.parentrevs(r)
|
|
1173
|
if len(parents) > 1:
|
|
1174
|
if len(parents) > 1:
|
|
1174
|
ps.add(parents[1])
|
|
1175
|
ps.add(parents[1])
|
|
1175
|
return [r for r in subset if r in ps]
|
|
1176
|
return baseset([r for r in subset if r in ps])
|
|
1176
|
|
|
1177
|
|
|
1177
|
def present(repo, subset, x):
|
|
1178
|
def present(repo, subset, x):
|
|
1178
|
"""``present(set)``
|
|
1179
|
"""``present(set)``
|
|
@@
-1186,7
+1187,7
b' def present(repo, subset, x):'
|
|
1186
|
try:
|
|
1187
|
try:
|
|
1187
|
return getset(repo, subset, x)
|
|
1188
|
return getset(repo, subset, x)
|
|
1188
|
except error.RepoLookupError:
|
|
1189
|
except error.RepoLookupError:
|
|
1189
|
return []
|
|
1190
|
return baseset([])
|
|
1190
|
|
|
1191
|
|
|
1191
|
def public(repo, subset, x):
|
|
1192
|
def public(repo, subset, x):
|
|
1192
|
"""``public()``
|
|
1193
|
"""``public()``
|
|
@@
-1194,7
+1195,7
b' def public(repo, subset, x):'
|
|
1194
|
# i18n: "public" is a keyword
|
|
1195
|
# i18n: "public" is a keyword
|
|
1195
|
getargs(x, 0, 0, _("public takes no arguments"))
|
|
1196
|
getargs(x, 0, 0, _("public takes no arguments"))
|
|
1196
|
pc = repo._phasecache
|
|
1197
|
pc = repo._phasecache
|
|
1197
|
return [r for r in subset if pc.phase(repo, r) == phases.public]
|
|
1198
|
return baseset([r for r in subset if pc.phase(repo, r) == phases.public])
|
|
1198
|
|
|
1199
|
|
|
1199
|
def remote(repo, subset, x):
|
|
1200
|
def remote(repo, subset, x):
|
|
1200
|
"""``remote([id [,path]])``
|
|
1201
|
"""``remote([id [,path]])``
|
|
@@
-1228,8
+1229,8
b' def remote(repo, subset, x):'
|
|
1228
|
if n in repo:
|
|
1229
|
if n in repo:
|
|
1229
|
r = repo[n].rev()
|
|
1230
|
r = repo[n].rev()
|
|
1230
|
if r in subset:
|
|
1231
|
if r in subset:
|
|
1231
|
return [r]
|
|
1232
|
return baseset([r])
|
|
1232
|
return []
|
|
1233
|
return baseset([])
|
|
1233
|
|
|
1234
|
|
|
1234
|
def removes(repo, subset, x):
|
|
1235
|
def removes(repo, subset, x):
|
|
1235
|
"""``removes(pattern)``
|
|
1236
|
"""``removes(pattern)``
|
|
@@
-1255,7
+1256,7
b' def rev(repo, subset, x):'
|
|
1255
|
except (TypeError, ValueError):
|
|
1256
|
except (TypeError, ValueError):
|
|
1256
|
# i18n: "rev" is a keyword
|
|
1257
|
# i18n: "rev" is a keyword
|
|
1257
|
raise error.ParseError(_("rev expects a number"))
|
|
1258
|
raise error.ParseError(_("rev expects a number"))
|
|
1258
|
return [r for r in subset if r == l]
|
|
1259
|
return baseset([r for r in subset if r == l])
|
|
1259
|
|
|
1260
|
|
|
1260
|
def matching(repo, subset, x):
|
|
1261
|
def matching(repo, subset, x):
|
|
1261
|
"""``matching(revision [, field])``
|
|
1262
|
"""``matching(revision [, field])``
|
|
@@
-1285,7
+1286,7
b' def matching(repo, subset, x):'
|
|
1285
|
# i18n: "matching" is a keyword
|
|
1286
|
# i18n: "matching" is a keyword
|
|
1286
|
l = getargs(x, 1, 2, _("matching takes 1 or 2 arguments"))
|
|
1287
|
l = getargs(x, 1, 2, _("matching takes 1 or 2 arguments"))
|
|
1287
|
|
|
1288
|
|
|
1288
|
revs = getset(repo, repo.changelog, l[0])
|
|
1289
|
revs = getset(repo, baseset(repo.changelog), l[0])
|
|
1289
|
|
|
1290
|
|
|
1290
|
fieldlist = ['metadata']
|
|
1291
|
fieldlist = ['metadata']
|
|
1291
|
if len(l) > 1:
|
|
1292
|
if len(l) > 1:
|
|
@@
-1367,7
+1368,7
b' def matching(repo, subset, x):'
|
|
1367
|
break
|
|
1368
|
break
|
|
1368
|
if match:
|
|
1369
|
if match:
|
|
1369
|
matches.add(r)
|
|
1370
|
matches.add(r)
|
|
1370
|
return [r for r in subset if r in matches]
|
|
1371
|
return baseset([r for r in subset if r in matches])
|
|
1371
|
|
|
1372
|
|
|
1372
|
def reverse(repo, subset, x):
|
|
1373
|
def reverse(repo, subset, x):
|
|
1373
|
"""``reverse(set)``
|
|
1374
|
"""``reverse(set)``
|
|
@@
-1375,7
+1376,7
b' def reverse(repo, subset, x):'
|
|
1375
|
"""
|
|
1376
|
"""
|
|
1376
|
l = getset(repo, subset, x)
|
|
1377
|
l = getset(repo, subset, x)
|
|
1377
|
if not isinstance(l, list):
|
|
1378
|
if not isinstance(l, list):
|
|
1378
|
l = list(l)
|
|
1379
|
l = baseset(l)
|
|
1379
|
l.reverse()
|
|
1380
|
l.reverse()
|
|
1380
|
return l
|
|
1381
|
return l
|
|
1381
|
|
|
1382
|
|
|
@@
-1383,10
+1384,10
b' def roots(repo, subset, x):'
|
|
1383
|
"""``roots(set)``
|
|
1384
|
"""``roots(set)``
|
|
1384
|
Changesets in set with no parent changeset in set.
|
|
1385
|
Changesets in set with no parent changeset in set.
|
|
1385
|
"""
|
|
1386
|
"""
|
|
1386
|
s = set(getset(repo, repo.changelog, x))
|
|
1387
|
s = set(getset(repo, baseset(repo.changelog), x))
|
|
1387
|
subset = [r for r in subset if r in s]
|
|
1388
|
subset = baseset([r for r in subset if r in s])
|
|
1388
|
cs = _children(repo, subset, s)
|
|
1389
|
cs = _children(repo, subset, s)
|
|
1389
|
return [r for r in subset if r not in cs]
|
|
1390
|
return baseset([r for r in subset if r not in cs])
|
|
1390
|
|
|
1391
|
|
|
1391
|
def secret(repo, subset, x):
|
|
1392
|
def secret(repo, subset, x):
|
|
1392
|
"""``secret()``
|
|
1393
|
"""``secret()``
|
|
@@
-1394,7
+1395,7
b' def secret(repo, subset, x):'
|
|
1394
|
# i18n: "secret" is a keyword
|
|
1395
|
# i18n: "secret" is a keyword
|
|
1395
|
getargs(x, 0, 0, _("secret takes no arguments"))
|
|
1396
|
getargs(x, 0, 0, _("secret takes no arguments"))
|
|
1396
|
pc = repo._phasecache
|
|
1397
|
pc = repo._phasecache
|
|
1397
|
return [r for r in subset if pc.phase(repo, r) == phases.secret]
|
|
1398
|
return baseset([r for r in subset if pc.phase(repo, r) == phases.secret])
|
|
1398
|
|
|
1399
|
|
|
1399
|
def sort(repo, subset, x):
|
|
1400
|
def sort(repo, subset, x):
|
|
1400
|
"""``sort(set[, [-]key...])``
|
|
1401
|
"""``sort(set[, [-]key...])``
|
|
@@
-1450,7
+1451,7
b' def sort(repo, subset, x):'
|
|
1450
|
e.append(r)
|
|
1451
|
e.append(r)
|
|
1451
|
l.append(e)
|
|
1452
|
l.append(e)
|
|
1452
|
l.sort()
|
|
1453
|
l.sort()
|
|
1453
|
return [e[-1] for e in l]
|
|
1454
|
return baseset([e[-1] for e in l])
|
|
1454
|
|
|
1455
|
|
|
1455
|
def _stringmatcher(pattern):
|
|
1456
|
def _stringmatcher(pattern):
|
|
1456
|
"""
|
|
1457
|
"""
|
|
@@
-1519,7
+1520,7
b' def tag(repo, subset, x):'
|
|
1519
|
s = set([cl.rev(n) for t, n in repo.tagslist() if matcher(t)])
|
|
1520
|
s = set([cl.rev(n) for t, n in repo.tagslist() if matcher(t)])
|
|
1520
|
else:
|
|
1521
|
else:
|
|
1521
|
s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip'])
|
|
1522
|
s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip'])
|
|
1522
|
return [r for r in subset if r in s]
|
|
1523
|
return baseset([r for r in subset if r in s])
|
|
1523
|
|
|
1524
|
|
|
1524
|
def tagged(repo, subset, x):
|
|
1525
|
def tagged(repo, subset, x):
|
|
1525
|
return tag(repo, subset, x)
|
|
1526
|
return tag(repo, subset, x)
|
|
@@
-1531,7
+1532,7
b' def unstable(repo, subset, x):'
|
|
1531
|
# i18n: "unstable" is a keyword
|
|
1532
|
# i18n: "unstable" is a keyword
|
|
1532
|
getargs(x, 0, 0, _("unstable takes no arguments"))
|
|
1533
|
getargs(x, 0, 0, _("unstable takes no arguments"))
|
|
1533
|
unstables = obsmod.getrevs(repo, 'unstable')
|
|
1534
|
unstables = obsmod.getrevs(repo, 'unstable')
|
|
1534
|
return [r for r in subset if r in unstables]
|
|
1535
|
return baseset([r for r in subset if r in unstables])
|
|
1535
|
|
|
1536
|
|
|
1536
|
|
|
1537
|
|
|
1537
|
def user(repo, subset, x):
|
|
1538
|
def user(repo, subset, x):
|
|
@@
-1548,11
+1549,11
b' def user(repo, subset, x):'
|
|
1548
|
def _list(repo, subset, x):
|
|
1549
|
def _list(repo, subset, x):
|
|
1549
|
s = getstring(x, "internal error")
|
|
1550
|
s = getstring(x, "internal error")
|
|
1550
|
if not s:
|
|
1551
|
if not s:
|
|
1551
|
return []
|
|
1552
|
return baseset([])
|
|
1552
|
if not isinstance(subset, set):
|
|
1553
|
if not isinstance(subset, set):
|
|
1553
|
subset = set(subset)
|
|
1554
|
subset = set(subset)
|
|
1554
|
ls = [repo[r].rev() for r in s.split('\0')]
|
|
1555
|
ls = [repo[r].rev() for r in s.split('\0')]
|
|
1555
|
return [r for r in ls if r in subset]
|
|
1556
|
return baseset([r for r in ls if r in subset])
|
|
1556
|
|
|
1557
|
|
|
1557
|
symbols = {
|
|
1558
|
symbols = {
|
|
1558
|
"adds": adds,
|
|
1559
|
"adds": adds,
|
|
@@
-2046,5
+2047,8
b' def funcsused(tree):'
|
|
2046
|
funcs.add(tree[1][1])
|
|
2047
|
funcs.add(tree[1][1])
|
|
2047
|
return funcs
|
|
2048
|
return funcs
|
|
2048
|
|
|
2049
|
|
|
|
|
|
2050
|
class baseset(list):
|
|
|
|
|
2051
|
pass
|
|
|
|
|
2052
|
|
|
2049
|
# tell hggettext to extract docstrings from these functions:
|
|
2053
|
# tell hggettext to extract docstrings from these functions:
|
|
2050
|
i18nfunctions = symbols.values()
|
|
2054
|
i18nfunctions = symbols.values()
|