Show More
@@ -75,7 +75,6 b' certain files::' | |||
|
75 | 75 | from __future__ import absolute_import |
|
76 | 76 | |
|
77 | 77 | from mercurial.i18n import _ |
|
78 | from mercurial.node import nullid | |
|
79 | 78 | from mercurial import ( |
|
80 | 79 | cmdutil, |
|
81 | 80 | commands, |
@@ -448,23 +447,13 b' def _config(ui, repo, pats, opts, includ' | |||
|
448 | 447 | |
|
449 | 448 | def _import(ui, repo, files, opts, force=False): |
|
450 | 449 | with repo.wlock(): |
|
451 | # load union of current active profile | |
|
452 | revs = [repo.changelog.rev(node) for node in | |
|
453 | repo.dirstate.parents() if node != nullid] | |
|
454 | ||
|
455 | 450 | # read current configuration |
|
456 | 451 | raw = repo.vfs.tryread('sparse') |
|
457 | 452 | oincludes, oexcludes, oprofiles = sparse.parseconfig(ui, raw) |
|
458 | 453 | includes, excludes, profiles = map( |
|
459 | 454 | set, (oincludes, oexcludes, oprofiles)) |
|
460 | 455 | |
|
461 | # all active rules | |
|
462 | aincludes, aexcludes, aprofiles = set(), set(), set() | |
|
463 | for rev in revs: | |
|
464 | rincludes, rexcludes, rprofiles = sparse.patternsforrev(repo, rev) | |
|
465 | aincludes.update(rincludes) | |
|
466 | aexcludes.update(rexcludes) | |
|
467 | aprofiles.update(rprofiles) | |
|
456 | aincludes, aexcludes, aprofiles = sparse.activeconfig(repo) | |
|
468 | 457 | |
|
469 | 458 | # import rules on top; only take in rules that are not yet |
|
470 | 459 | # part of the active rules. |
@@ -124,15 +124,26 b' def patternsforrev(repo, rev):' | |||
|
124 | 124 | |
|
125 | 125 | return includes, excludes, profiles |
|
126 | 126 | |
|
127 |
def active |
|
|
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 | 133 | revs = [repo.changelog.rev(node) for node in |
|
129 | 134 | repo.dirstate.parents() if node != nullid] |
|
130 | 135 | |
|
131 |
|
|
|
136 | allincludes = set() | |
|
137 | allexcludes = set() | |
|
138 | allprofiles = set() | |
|
139 | ||
|
132 | 140 | for rev in revs: |
|
133 |
profiles |
|
|
141 | includes, excludes, profiles = patternsforrev(repo, rev) | |
|
142 | allincludes |= includes | |
|
143 | allexcludes |= excludes | |
|
144 | allprofiles |= set(profiles) | |
|
134 | 145 | |
|
135 | return profiles | |
|
146 | return allincludes, allexcludes, allprofiles | |
|
136 | 147 | |
|
137 | 148 | def configsignature(repo, includetemp=True): |
|
138 | 149 | """Obtain the signature string for the current sparse configuration. |
@@ -361,7 +372,7 b' def filterupdatesactions(repo, wctx, mct' | |||
|
361 | 372 | for file, flags, msg in actions: |
|
362 | 373 | dirstate.normal(file) |
|
363 | 374 | |
|
364 |
profiles = active |
|
|
375 | profiles = activeconfig(repo)[2] | |
|
365 | 376 | changedprofiles = profiles & files |
|
366 | 377 | # If an active profile changed during the update, refresh the checkout. |
|
367 | 378 | # Don't do this during a branch merge, since all incoming changes should |
General Comments 0
You need to be logged in to leave comments.
Login now