122 if includes: |
122 if includes: |
123 includes.add('.hg*') |
123 includes.add('.hg*') |
124 |
124 |
125 return includes, excludes, profiles |
125 return includes, excludes, profiles |
126 |
126 |
127 def activeprofiles(repo): |
127 def activeconfig(repo): |
|
128 """Determine the active sparse config rules. |
|
129 |
|
130 Rules are constructed by reading the current sparse config and bringing in |
|
131 referenced profiles from parents of the working directory. |
|
132 """ |
128 revs = [repo.changelog.rev(node) for node in |
133 revs = [repo.changelog.rev(node) for node in |
129 repo.dirstate.parents() if node != nullid] |
134 repo.dirstate.parents() if node != nullid] |
130 |
135 |
131 profiles = set() |
136 allincludes = set() |
|
137 allexcludes = set() |
|
138 allprofiles = set() |
|
139 |
132 for rev in revs: |
140 for rev in revs: |
133 profiles.update(patternsforrev(repo, rev)[2]) |
141 includes, excludes, profiles = patternsforrev(repo, rev) |
134 |
142 allincludes |= includes |
135 return profiles |
143 allexcludes |= excludes |
|
144 allprofiles |= set(profiles) |
|
145 |
|
146 return allincludes, allexcludes, allprofiles |
136 |
147 |
137 def configsignature(repo, includetemp=True): |
148 def configsignature(repo, includetemp=True): |
138 """Obtain the signature string for the current sparse configuration. |
149 """Obtain the signature string for the current sparse configuration. |
139 |
150 |
140 This is used to construct a cache key for matchers. |
151 This is used to construct a cache key for matchers. |
359 |
370 |
360 dirstate = repo.dirstate |
371 dirstate = repo.dirstate |
361 for file, flags, msg in actions: |
372 for file, flags, msg in actions: |
362 dirstate.normal(file) |
373 dirstate.normal(file) |
363 |
374 |
364 profiles = activeprofiles(repo) |
375 profiles = activeconfig(repo)[2] |
365 changedprofiles = profiles & files |
376 changedprofiles = profiles & files |
366 # If an active profile changed during the update, refresh the checkout. |
377 # If an active profile changed during the update, refresh the checkout. |
367 # Don't do this during a branch merge, since all incoming changes should |
378 # Don't do this during a branch merge, since all incoming changes should |
368 # have been handled by the temporary includes above. |
379 # have been handled by the temporary includes above. |
369 if changedprofiles and not branchmerge: |
380 if changedprofiles and not branchmerge: |