49 > import sys |
49 > import sys |
50 > |
50 > |
51 > from mercurial import extensions |
51 > from mercurial import extensions |
52 > from mercurial import localrepo |
52 > from mercurial import localrepo |
53 > from mercurial import match as matchmod |
53 > from mercurial import match as matchmod |
|
54 > from mercurial import narrowspec |
54 > from mercurial import patch |
55 > from mercurial import patch |
55 > from mercurial import util as hgutil |
56 > from mercurial import util as hgutil |
56 > |
57 > |
57 > def expandnarrowspec(ui, repo, newincludes=None): |
58 > def expandnarrowspec(ui, repo, newincludes=None): |
58 > if not newincludes: |
59 > if not newincludes: |
59 > return |
60 > return |
60 > import sys |
61 > import sys |
61 > newincludes = set([newincludes]) |
62 > newincludes = set([newincludes]) |
62 > narrowhg = extensions.find('narrow') |
|
63 > includes, excludes = repo.narrowpats |
63 > includes, excludes = repo.narrowpats |
64 > currentmatcher = narrowhg.narrowspec.match(repo.root, includes, excludes) |
64 > currentmatcher = narrowspec.match(repo.root, includes, excludes) |
65 > includes = includes | newincludes |
65 > includes = includes | newincludes |
66 > if not repo.currenttransaction(): |
66 > if not repo.currenttransaction(): |
67 > ui.develwarn('expandnarrowspec called outside of transaction!') |
67 > ui.develwarn('expandnarrowspec called outside of transaction!') |
68 > repo.setnarrowpats(includes, excludes) |
68 > repo.setnarrowpats(includes, excludes) |
69 > newmatcher = narrowhg.narrowspec.match(repo.root, includes, excludes) |
69 > newmatcher = narrowspec.match(repo.root, includes, excludes) |
70 > added = matchmod.differencematcher(newmatcher, currentmatcher) |
70 > added = matchmod.differencematcher(newmatcher, currentmatcher) |
71 > for f in repo['.'].manifest().walk(added): |
71 > for f in repo['.'].manifest().walk(added): |
72 > repo.dirstate.normallookup(f) |
72 > repo.dirstate.normallookup(f) |
73 > |
73 > |
74 > def makeds(ui, repo): |
74 > def makeds(ui, repo): |