##// END OF EJS Templates
sparse: move active profiles function into core...
Gregory Szorc -
r33301:ca4b78eb default
parent child Browse files
Show More
@@ -213,7 +213,7 b' def _setupupdates(ui):'
213 for file, flags, msg in actions:
213 for file, flags, msg in actions:
214 dirstate.normal(file)
214 dirstate.normal(file)
215
215
216 profiles = repo.getactiveprofiles()
216 profiles = sparse.activeprofiles(repo)
217 changedprofiles = profiles & files
217 changedprofiles = profiles & files
218 # If an active profile changed during the update, refresh the checkout.
218 # If an active profile changed during the update, refresh the checkout.
219 # Don't do this during a branch merge, since all incoming changes should
219 # Don't do this during a branch merge, since all incoming changes should
@@ -517,17 +517,6 b' def _wraprepo(ui, repo):'
517
517
518 return result
518 return result
519
519
520 def getactiveprofiles(self):
521 revs = [self.changelog.rev(node) for node in
522 self.dirstate.parents() if node != nullid]
523
524 activeprofiles = set()
525 for rev in revs:
526 _, _, profiles = sparse.patternsforrev(self, rev)
527 activeprofiles.update(profiles)
528
529 return activeprofiles
530
531 def writesparseconfig(self, include, exclude, profiles):
520 def writesparseconfig(self, include, exclude, profiles):
532 raw = '%s[include]\n%s\n[exclude]\n%s\n' % (
521 raw = '%s[include]\n%s\n[exclude]\n%s\n' % (
533 ''.join(['%%include %s\n' % p for p in sorted(profiles)]),
522 ''.join(['%%include %s\n' % p for p in sorted(profiles)]),
@@ -8,6 +8,7 b''
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 from .i18n import _
10 from .i18n import _
11 from .node import nullid
11 from . import (
12 from . import (
12 error,
13 error,
13 )
14 )
@@ -115,3 +116,13 b' def patternsforrev(repo, rev):'
115 includes.add('.hg*')
116 includes.add('.hg*')
116
117
117 return includes, excludes, profiles
118 return includes, excludes, profiles
119
120 def activeprofiles(repo):
121 revs = [repo.changelog.rev(node) for node in
122 repo.dirstate.parents() if node != nullid]
123
124 profiles = set()
125 for rev in revs:
126 profiles.update(patternsforrev(repo, rev)[2])
127
128 return profiles
General Comments 0
You need to be logged in to leave comments. Login now