mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
sparse: move active profiles function into core
Also includes some light formatting changes.
This commit is contained in:
parent
b77eafa212
commit
82797a75d4
@ -213,7 +213,7 @@ def _setupupdates(ui):
|
|||||||
for file, flags, msg in actions:
|
for file, flags, msg in actions:
|
||||||
dirstate.normal(file)
|
dirstate.normal(file)
|
||||||
|
|
||||||
profiles = repo.getactiveprofiles()
|
profiles = sparse.activeprofiles(repo)
|
||||||
changedprofiles = profiles & files
|
changedprofiles = profiles & files
|
||||||
# If an active profile changed during the update, refresh the checkout.
|
# If an active profile changed during the update, refresh the checkout.
|
||||||
# Don't do this during a branch merge, since all incoming changes should
|
# Don't do this during a branch merge, since all incoming changes should
|
||||||
@ -517,17 +517,6 @@ def _wraprepo(ui, repo):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def getactiveprofiles(self):
|
|
||||||
revs = [self.changelog.rev(node) for node in
|
|
||||||
self.dirstate.parents() if node != nullid]
|
|
||||||
|
|
||||||
activeprofiles = set()
|
|
||||||
for rev in revs:
|
|
||||||
_, _, profiles = sparse.patternsforrev(self, rev)
|
|
||||||
activeprofiles.update(profiles)
|
|
||||||
|
|
||||||
return activeprofiles
|
|
||||||
|
|
||||||
def writesparseconfig(self, include, exclude, profiles):
|
def writesparseconfig(self, include, exclude, profiles):
|
||||||
raw = '%s[include]\n%s\n[exclude]\n%s\n' % (
|
raw = '%s[include]\n%s\n[exclude]\n%s\n' % (
|
||||||
''.join(['%%include %s\n' % p for p in sorted(profiles)]),
|
''.join(['%%include %s\n' % p for p in sorted(profiles)]),
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
|
from .node import nullid
|
||||||
from . import (
|
from . import (
|
||||||
error,
|
error,
|
||||||
)
|
)
|
||||||
@ -115,3 +116,13 @@ def patternsforrev(repo, rev):
|
|||||||
includes.add('.hg*')
|
includes.add('.hg*')
|
||||||
|
|
||||||
return includes, excludes, profiles
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user