##// END OF EJS Templates
narrowspec: move module into core...
Gregory Szorc -
r36178:9fd8c2a3 default
parent child Browse files
Show More
@@ -24,6 +24,7 from mercurial import (
24 error,
24 error,
25 exchange,
25 exchange,
26 extensions,
26 extensions,
27 narrowspec,
27 repair,
28 repair,
28 util,
29 util,
29 wireproto,
30 wireproto,
@@ -31,7 +32,6 from mercurial import (
31
32
32 from . import (
33 from . import (
33 narrowrepo,
34 narrowrepo,
34 narrowspec,
35 )
35 )
36
36
37 NARROWCAP = 'narrow'
37 NARROWCAP = 'narrow'
@@ -18,6 +18,7 from mercurial import (
18 extensions,
18 extensions,
19 hg,
19 hg,
20 merge,
20 merge,
21 narrowspec,
21 node,
22 node,
22 pycompat,
23 pycompat,
23 registrar,
24 registrar,
@@ -29,7 +30,6 from mercurial import (
29 from . import (
30 from . import (
30 narrowbundle2,
31 narrowbundle2,
31 narrowrepo,
32 narrowrepo,
32 narrowspec,
33 )
33 )
34
34
35 table = {}
35 table = {}
@@ -13,11 +13,10 from mercurial import (
13 error,
13 error,
14 extensions,
14 extensions,
15 match as matchmod,
15 match as matchmod,
16 narrowspec,
16 util as hgutil,
17 util as hgutil,
17 )
18 )
18
19
19 from . import narrowspec
20
21 def setup(repo):
20 def setup(repo):
22 """Add narrow spec dirstate ignore, block changes outside narrow spec."""
21 """Add narrow spec dirstate ignore, block changes outside narrow spec."""
23
22
@@ -12,12 +12,12 from mercurial import (
12 hg,
12 hg,
13 localrepo,
13 localrepo,
14 match as matchmod,
14 match as matchmod,
15 narrowspec,
15 scmutil,
16 scmutil,
16 )
17 )
17
18
18 from . import (
19 from . import (
19 narrowrevlog,
20 narrowrevlog,
20 narrowspec,
21 )
21 )
22
22
23 # When narrowing is finalized and no longer subject to format changes,
23 # When narrowing is finalized and no longer subject to format changes,
@@ -12,11 +12,10 from mercurial import (
12 error,
12 error,
13 extensions,
13 extensions,
14 hg,
14 hg,
15 narrowspec,
15 node,
16 node,
16 )
17 )
17
18
18 from . import narrowspec
19
20 def uisetup():
19 def uisetup():
21 def peersetup(ui, peer):
20 def peersetup(ui, peer):
22 # We must set up the expansion before reposetup below, since it's used
21 # We must set up the expansion before reposetup below, since it's used
@@ -9,8 +9,8 from __future__ import absolute_import
9
9
10 import errno
10 import errno
11
11
12 from mercurial.i18n import _
12 from .i18n import _
13 from mercurial import (
13 from . import (
14 error,
14 error,
15 hg,
15 hg,
16 match as matchmod,
16 match as matchmod,
@@ -89,7 +89,7 def _validatepattern(pat):
89 # We use newlines as separators in the narrowspec file, so don't allow them
89 # We use newlines as separators in the narrowspec file, so don't allow them
90 # in patterns.
90 # in patterns.
91 if _numlines(pat) > 1:
91 if _numlines(pat) > 1:
92 raise error.Abort('newlines are not allowed in narrowspec paths')
92 raise error.Abort(_('newlines are not allowed in narrowspec paths'))
93
93
94 components = pat.split('/')
94 components = pat.split('/')
95 if '.' in components or '..' in components:
95 if '.' in components or '..' in components:
@@ -51,6 +51,7 have this method available in narrowhg p
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 >
@@ -59,14 +60,13 have this method available in narrowhg p
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)
General Comments 0
You need to be logged in to leave comments. Login now