diff hgext/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/hgext/sparse.py	Thu Jul 06 12:15:14 2017 -0700
+++ b/hgext/sparse.py	Thu Jul 06 12:26:04 2017 -0700
@@ -213,7 +213,7 @@
             for file, flags, msg in actions:
                 dirstate.normal(file)
 
-        profiles = repo.getactiveprofiles()
+        profiles = sparse.activeprofiles(repo)
         changedprofiles = profiles & files
         # If an active profile changed during the update, refresh the checkout.
         # Don't do this during a branch merge, since all incoming changes should
@@ -517,17 +517,6 @@
 
             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):
             raw = '%s[include]\n%s\n[exclude]\n%s\n' % (
                 ''.join(['%%include %s\n' % p for p in sorted(profiles)]),