Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 14342:c0b6a734b4f3
revset: introduce filelog() to emulate log's fast path
filelog() only reports revisions present in the matching filelogs.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 16 May 2011 17:02:35 -0500 |
parents | 1f46be4689ed |
children | 9ed227f79e47 |
comparison
equal
deleted
inserted
replaced
14341:5c3de67e7402 | 14342:c0b6a734b4f3 |
---|---|
368 if not args: | 368 if not args: |
369 return [] | 369 return [] |
370 s = set(repo.changelog.descendants(*args)) | set(args) | 370 s = set(repo.changelog.descendants(*args)) | set(args) |
371 return [r for r in subset if r in s] | 371 return [r for r in subset if r in s] |
372 | 372 |
373 def filelog(repo, subset, x): | |
374 """``filelog(pattern)`` | |
375 Changesets connected to the specified filelog. | |
376 """ | |
377 | |
378 pat = getstring(x, _("filelog requires a pattern")) | |
379 m = matchmod.match(repo.root, repo.getcwd(), [pat], default='relpath') | |
380 s = set() | |
381 | |
382 if not m.anypats(): | |
383 for f in m.files(): | |
384 fl = repo.file(f) | |
385 for fr in fl: | |
386 s.add(fl.linkrev(fr)) | |
387 else: | |
388 for f in repo[None]: | |
389 if m(f): | |
390 fl = repo.file(f) | |
391 for fr in fl: | |
392 s.add(fl.linkrev(fr)) | |
393 | |
394 return [r for r in subset if r in s] | |
395 | |
373 def follow(repo, subset, x): | 396 def follow(repo, subset, x): |
374 """``follow()`` | 397 """``follow()`` |
375 An alias for ``::.`` (ancestors of the working copy's first parent). | 398 An alias for ``::.`` (ancestors of the working copy's first parent). |
376 """ | 399 """ |
377 # i18n: "follow" is a keyword | 400 # i18n: "follow" is a keyword |
778 "closed": closed, | 801 "closed": closed, |
779 "contains": contains, | 802 "contains": contains, |
780 "date": date, | 803 "date": date, |
781 "descendants": descendants, | 804 "descendants": descendants, |
782 "file": hasfile, | 805 "file": hasfile, |
806 "filelog": filelog, | |
783 "follow": follow, | 807 "follow": follow, |
784 "grep": grep, | 808 "grep": grep, |
785 "head": head, | 809 "head": head, |
786 "heads": heads, | 810 "heads": heads, |
787 "keyword": keyword, | 811 "keyword": keyword, |