Mercurial > public > mercurial-scm > hg-stable
diff mercurial/sparse.py @ 33301:ca4b78eb11e7
sparse: move active profiles function into core
Also includes some light formatting changes.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 06 Jul 2017 12:26:04 -0700 |
parents | f7a106b3f089 |
children | 36a415b5a4b2 |
line wrap: on
line diff
--- a/mercurial/sparse.py Thu Jul 06 12:15:14 2017 -0700 +++ b/mercurial/sparse.py Thu Jul 06 12:26:04 2017 -0700 @@ -8,6 +8,7 @@ from __future__ import absolute_import from .i18n import _ +from .node import nullid from . import ( error, ) @@ -115,3 +116,13 @@ includes.add('.hg*') return includes, excludes, profiles + +def activeprofiles(repo): + revs = [repo.changelog.rev(node) for node in + repo.dirstate.parents() if node != nullid] + + profiles = set() + for rev in revs: + profiles.update(patternsforrev(repo, rev)[2]) + + return profiles