##// END OF EJS Templates
remotenames: inline _parseargs() into _revsetutil()...
Yuya Nishihara -
r40101:25533575 default
parent child Browse files
Show More
@@ -347,8 +347,14 b' def remotebrancheskw(context, mapping):'
347 347 return templateutil.compatlist(context, mapping, 'remotebranch',
348 348 remotebranches, plural='remotebranches')
349 349
350 def _revsetutil(repo, subset, x, rtypes, matcher):
350 def _revsetutil(repo, subset, x, rtypes):
351 351 """utility function to return a set of revs based on the rtypes"""
352 args = revsetlang.getargs(x, 0, 1, _('only one argument accepted'))
353 if args:
354 kind, pattern, matcher = stringutil.stringmatcher(
355 revsetlang.getstring(args[0], _('argument must be a string')))
356 else:
357 matcher = lambda a: True
352 358
353 359 revs = set()
354 360 cl = repo.changelog
@@ -363,18 +369,6 b' def _revsetutil(repo, subset, x, rtypes,'
363 369 results = (cl.rev(n) for n in revs if cl.hasnode(n))
364 370 return subset & smartset.baseset(sorted(results))
365 371
366 def _parseargs(x):
367 """parses the argument passed in revsets
368
369 Returns a matcher for the passed pattern.
370 """
371 args = revsetlang.getargs(x, 0, 1, _('only one argument accepted'))
372 for arg in args:
373 kind, pattern, matcher = stringutil.stringmatcher(
374 revsetlang.getstring(arg, _('argument must be a string')))
375 return matcher
376 return lambda a: True
377
378 372 @revsetpredicate('remotenames([name])')
379 373 def remotenamesrevset(repo, subset, x):
380 374 """All changesets which have a remotename on them. If `name` is
@@ -382,8 +376,7 b' def remotenamesrevset(repo, subset, x):'
382 376
383 377 Pattern matching is supported for `name`. See :hg:`help revisions.patterns`.
384 378 """
385 return _revsetutil(repo, subset, x, ('remotebookmarks', 'remotebranches'),
386 _parseargs(x))
379 return _revsetutil(repo, subset, x, ('remotebookmarks', 'remotebranches'))
387 380
388 381 @revsetpredicate('remotebranches([name])')
389 382 def remotebranchesrevset(repo, subset, x):
@@ -392,9 +385,7 b' def remotebranchesrevset(repo, subset, x'
392 385
393 386 Pattern matching is supported for `name`. See :hg:`help revisions.patterns`.
394 387 """
395
396 args = _parseargs(x)
397 return _revsetutil(repo, subset, x, ('remotebranches',), args)
388 return _revsetutil(repo, subset, x, ('remotebranches',))
398 389
399 390 @revsetpredicate('remotebookmarks([name])')
400 391 def remotebmarksrevset(repo, subset, x):
@@ -403,6 +394,4 b' def remotebmarksrevset(repo, subset, x):'
403 394
404 395 Pattern matching is supported for `name`. See :hg:`help revisions.patterns`.
405 396 """
406
407 args = _parseargs(x)
408 return _revsetutil(repo, subset, x, ('remotebookmarks',), args)
397 return _revsetutil(repo, subset, x, ('remotebookmarks',))
General Comments 0
You need to be logged in to leave comments. Login now