##// END OF EJS Templates
narrow: fix typo "respositories"...
Martin von Zweigbergk -
r43075:383fdfa6 default
parent child Browse files
Show More
@@ -1,478 +1,478 b''
1 # narrowcommands.py - command modifications for narrowhg extension
1 # narrowcommands.py - command modifications for narrowhg extension
2 #
2 #
3 # Copyright 2017 Google, Inc.
3 # Copyright 2017 Google, Inc.
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7 from __future__ import absolute_import
7 from __future__ import absolute_import
8
8
9 import itertools
9 import itertools
10 import os
10 import os
11
11
12 from mercurial.i18n import _
12 from mercurial.i18n import _
13 from mercurial import (
13 from mercurial import (
14 bundle2,
14 bundle2,
15 cmdutil,
15 cmdutil,
16 commands,
16 commands,
17 discovery,
17 discovery,
18 encoding,
18 encoding,
19 error,
19 error,
20 exchange,
20 exchange,
21 extensions,
21 extensions,
22 hg,
22 hg,
23 narrowspec,
23 narrowspec,
24 node,
24 node,
25 pycompat,
25 pycompat,
26 registrar,
26 registrar,
27 repair,
27 repair,
28 repository,
28 repository,
29 repoview,
29 repoview,
30 sparse,
30 sparse,
31 util,
31 util,
32 wireprototypes,
32 wireprototypes,
33 )
33 )
34
34
35 table = {}
35 table = {}
36 command = registrar.command(table)
36 command = registrar.command(table)
37
37
38 def setup():
38 def setup():
39 """Wraps user-facing mercurial commands with narrow-aware versions."""
39 """Wraps user-facing mercurial commands with narrow-aware versions."""
40
40
41 entry = extensions.wrapcommand(commands.table, 'clone', clonenarrowcmd)
41 entry = extensions.wrapcommand(commands.table, 'clone', clonenarrowcmd)
42 entry[1].append(('', 'narrow', None,
42 entry[1].append(('', 'narrow', None,
43 _("create a narrow clone of select files")))
43 _("create a narrow clone of select files")))
44 entry[1].append(('', 'depth', '',
44 entry[1].append(('', 'depth', '',
45 _("limit the history fetched by distance from heads")))
45 _("limit the history fetched by distance from heads")))
46 entry[1].append(('', 'narrowspec', '',
46 entry[1].append(('', 'narrowspec', '',
47 _("read narrowspecs from file")))
47 _("read narrowspecs from file")))
48 # TODO(durin42): unify sparse/narrow --include/--exclude logic a bit
48 # TODO(durin42): unify sparse/narrow --include/--exclude logic a bit
49 if 'sparse' not in extensions.enabled():
49 if 'sparse' not in extensions.enabled():
50 entry[1].append(('', 'include', [],
50 entry[1].append(('', 'include', [],
51 _("specifically fetch this file/directory")))
51 _("specifically fetch this file/directory")))
52 entry[1].append(
52 entry[1].append(
53 ('', 'exclude', [],
53 ('', 'exclude', [],
54 _("do not fetch this file/directory, even if included")))
54 _("do not fetch this file/directory, even if included")))
55
55
56 entry = extensions.wrapcommand(commands.table, 'pull', pullnarrowcmd)
56 entry = extensions.wrapcommand(commands.table, 'pull', pullnarrowcmd)
57 entry[1].append(('', 'depth', '',
57 entry[1].append(('', 'depth', '',
58 _("limit the history fetched by distance from heads")))
58 _("limit the history fetched by distance from heads")))
59
59
60 extensions.wrapcommand(commands.table, 'archive', archivenarrowcmd)
60 extensions.wrapcommand(commands.table, 'archive', archivenarrowcmd)
61
61
62 def clonenarrowcmd(orig, ui, repo, *args, **opts):
62 def clonenarrowcmd(orig, ui, repo, *args, **opts):
63 """Wraps clone command, so 'hg clone' first wraps localrepo.clone()."""
63 """Wraps clone command, so 'hg clone' first wraps localrepo.clone()."""
64 opts = pycompat.byteskwargs(opts)
64 opts = pycompat.byteskwargs(opts)
65 wrappedextraprepare = util.nullcontextmanager()
65 wrappedextraprepare = util.nullcontextmanager()
66 narrowspecfile = opts['narrowspec']
66 narrowspecfile = opts['narrowspec']
67
67
68 if narrowspecfile:
68 if narrowspecfile:
69 filepath = os.path.join(encoding.getcwd(), narrowspecfile)
69 filepath = os.path.join(encoding.getcwd(), narrowspecfile)
70 ui.status(_("reading narrowspec from '%s'\n") % filepath)
70 ui.status(_("reading narrowspec from '%s'\n") % filepath)
71 try:
71 try:
72 fdata = util.readfile(filepath)
72 fdata = util.readfile(filepath)
73 except IOError as inst:
73 except IOError as inst:
74 raise error.Abort(_("cannot read narrowspecs from '%s': %s") %
74 raise error.Abort(_("cannot read narrowspecs from '%s': %s") %
75 (filepath, encoding.strtolocal(inst.strerror)))
75 (filepath, encoding.strtolocal(inst.strerror)))
76
76
77 includes, excludes, profiles = sparse.parseconfig(ui, fdata, 'narrow')
77 includes, excludes, profiles = sparse.parseconfig(ui, fdata, 'narrow')
78 if profiles:
78 if profiles:
79 raise error.Abort(_("cannot specify other files using '%include' in"
79 raise error.Abort(_("cannot specify other files using '%include' in"
80 " narrowspec"))
80 " narrowspec"))
81
81
82 narrowspec.validatepatterns(includes)
82 narrowspec.validatepatterns(includes)
83 narrowspec.validatepatterns(excludes)
83 narrowspec.validatepatterns(excludes)
84
84
85 # narrowspec is passed so we should assume that user wants narrow clone
85 # narrowspec is passed so we should assume that user wants narrow clone
86 opts['narrow'] = True
86 opts['narrow'] = True
87 opts['include'].extend(includes)
87 opts['include'].extend(includes)
88 opts['exclude'].extend(excludes)
88 opts['exclude'].extend(excludes)
89
89
90 if opts['narrow']:
90 if opts['narrow']:
91 def pullbundle2extraprepare_widen(orig, pullop, kwargs):
91 def pullbundle2extraprepare_widen(orig, pullop, kwargs):
92 orig(pullop, kwargs)
92 orig(pullop, kwargs)
93
93
94 if opts.get('depth'):
94 if opts.get('depth'):
95 kwargs['depth'] = opts['depth']
95 kwargs['depth'] = opts['depth']
96 wrappedextraprepare = extensions.wrappedfunction(exchange,
96 wrappedextraprepare = extensions.wrappedfunction(exchange,
97 '_pullbundle2extraprepare', pullbundle2extraprepare_widen)
97 '_pullbundle2extraprepare', pullbundle2extraprepare_widen)
98
98
99 with wrappedextraprepare:
99 with wrappedextraprepare:
100 return orig(ui, repo, *args, **pycompat.strkwargs(opts))
100 return orig(ui, repo, *args, **pycompat.strkwargs(opts))
101
101
102 def pullnarrowcmd(orig, ui, repo, *args, **opts):
102 def pullnarrowcmd(orig, ui, repo, *args, **opts):
103 """Wraps pull command to allow modifying narrow spec."""
103 """Wraps pull command to allow modifying narrow spec."""
104 wrappedextraprepare = util.nullcontextmanager()
104 wrappedextraprepare = util.nullcontextmanager()
105 if repository.NARROW_REQUIREMENT in repo.requirements:
105 if repository.NARROW_REQUIREMENT in repo.requirements:
106
106
107 def pullbundle2extraprepare_widen(orig, pullop, kwargs):
107 def pullbundle2extraprepare_widen(orig, pullop, kwargs):
108 orig(pullop, kwargs)
108 orig(pullop, kwargs)
109 if opts.get(r'depth'):
109 if opts.get(r'depth'):
110 kwargs['depth'] = opts[r'depth']
110 kwargs['depth'] = opts[r'depth']
111 wrappedextraprepare = extensions.wrappedfunction(exchange,
111 wrappedextraprepare = extensions.wrappedfunction(exchange,
112 '_pullbundle2extraprepare', pullbundle2extraprepare_widen)
112 '_pullbundle2extraprepare', pullbundle2extraprepare_widen)
113
113
114 with wrappedextraprepare:
114 with wrappedextraprepare:
115 return orig(ui, repo, *args, **opts)
115 return orig(ui, repo, *args, **opts)
116
116
117 def archivenarrowcmd(orig, ui, repo, *args, **opts):
117 def archivenarrowcmd(orig, ui, repo, *args, **opts):
118 """Wraps archive command to narrow the default includes."""
118 """Wraps archive command to narrow the default includes."""
119 if repository.NARROW_REQUIREMENT in repo.requirements:
119 if repository.NARROW_REQUIREMENT in repo.requirements:
120 repo_includes, repo_excludes = repo.narrowpats
120 repo_includes, repo_excludes = repo.narrowpats
121 includes = set(opts.get(r'include', []))
121 includes = set(opts.get(r'include', []))
122 excludes = set(opts.get(r'exclude', []))
122 excludes = set(opts.get(r'exclude', []))
123 includes, excludes, unused_invalid = narrowspec.restrictpatterns(
123 includes, excludes, unused_invalid = narrowspec.restrictpatterns(
124 includes, excludes, repo_includes, repo_excludes)
124 includes, excludes, repo_includes, repo_excludes)
125 if includes:
125 if includes:
126 opts[r'include'] = includes
126 opts[r'include'] = includes
127 if excludes:
127 if excludes:
128 opts[r'exclude'] = excludes
128 opts[r'exclude'] = excludes
129 return orig(ui, repo, *args, **opts)
129 return orig(ui, repo, *args, **opts)
130
130
131 def pullbundle2extraprepare(orig, pullop, kwargs):
131 def pullbundle2extraprepare(orig, pullop, kwargs):
132 repo = pullop.repo
132 repo = pullop.repo
133 if repository.NARROW_REQUIREMENT not in repo.requirements:
133 if repository.NARROW_REQUIREMENT not in repo.requirements:
134 return orig(pullop, kwargs)
134 return orig(pullop, kwargs)
135
135
136 if wireprototypes.NARROWCAP not in pullop.remote.capabilities():
136 if wireprototypes.NARROWCAP not in pullop.remote.capabilities():
137 raise error.Abort(_("server does not support narrow clones"))
137 raise error.Abort(_("server does not support narrow clones"))
138 orig(pullop, kwargs)
138 orig(pullop, kwargs)
139 kwargs['narrow'] = True
139 kwargs['narrow'] = True
140 include, exclude = repo.narrowpats
140 include, exclude = repo.narrowpats
141 kwargs['oldincludepats'] = include
141 kwargs['oldincludepats'] = include
142 kwargs['oldexcludepats'] = exclude
142 kwargs['oldexcludepats'] = exclude
143 if include:
143 if include:
144 kwargs['includepats'] = include
144 kwargs['includepats'] = include
145 if exclude:
145 if exclude:
146 kwargs['excludepats'] = exclude
146 kwargs['excludepats'] = exclude
147 # calculate known nodes only in ellipses cases because in non-ellipses cases
147 # calculate known nodes only in ellipses cases because in non-ellipses cases
148 # we have all the nodes
148 # we have all the nodes
149 if wireprototypes.ELLIPSESCAP1 in pullop.remote.capabilities():
149 if wireprototypes.ELLIPSESCAP1 in pullop.remote.capabilities():
150 kwargs['known'] = [node.hex(ctx.node()) for ctx in
150 kwargs['known'] = [node.hex(ctx.node()) for ctx in
151 repo.set('::%ln', pullop.common)
151 repo.set('::%ln', pullop.common)
152 if ctx.node() != node.nullid]
152 if ctx.node() != node.nullid]
153 if not kwargs['known']:
153 if not kwargs['known']:
154 # Mercurial serializes an empty list as '' and deserializes it as
154 # Mercurial serializes an empty list as '' and deserializes it as
155 # [''], so delete it instead to avoid handling the empty string on
155 # [''], so delete it instead to avoid handling the empty string on
156 # the server.
156 # the server.
157 del kwargs['known']
157 del kwargs['known']
158
158
159 extensions.wrapfunction(exchange,'_pullbundle2extraprepare',
159 extensions.wrapfunction(exchange,'_pullbundle2extraprepare',
160 pullbundle2extraprepare)
160 pullbundle2extraprepare)
161
161
162 def _narrow(ui, repo, remote, commoninc, oldincludes, oldexcludes,
162 def _narrow(ui, repo, remote, commoninc, oldincludes, oldexcludes,
163 newincludes, newexcludes, force):
163 newincludes, newexcludes, force):
164 oldmatch = narrowspec.match(repo.root, oldincludes, oldexcludes)
164 oldmatch = narrowspec.match(repo.root, oldincludes, oldexcludes)
165 newmatch = narrowspec.match(repo.root, newincludes, newexcludes)
165 newmatch = narrowspec.match(repo.root, newincludes, newexcludes)
166
166
167 # This is essentially doing "hg outgoing" to find all local-only
167 # This is essentially doing "hg outgoing" to find all local-only
168 # commits. We will then check that the local-only commits don't
168 # commits. We will then check that the local-only commits don't
169 # have any changes to files that will be untracked.
169 # have any changes to files that will be untracked.
170 unfi = repo.unfiltered()
170 unfi = repo.unfiltered()
171 outgoing = discovery.findcommonoutgoing(unfi, remote,
171 outgoing = discovery.findcommonoutgoing(unfi, remote,
172 commoninc=commoninc)
172 commoninc=commoninc)
173 ui.status(_('looking for local changes to affected paths\n'))
173 ui.status(_('looking for local changes to affected paths\n'))
174 localnodes = []
174 localnodes = []
175 for n in itertools.chain(outgoing.missing, outgoing.excluded):
175 for n in itertools.chain(outgoing.missing, outgoing.excluded):
176 if any(oldmatch(f) and not newmatch(f) for f in unfi[n].files()):
176 if any(oldmatch(f) and not newmatch(f) for f in unfi[n].files()):
177 localnodes.append(n)
177 localnodes.append(n)
178 revstostrip = unfi.revs('descendants(%ln)', localnodes)
178 revstostrip = unfi.revs('descendants(%ln)', localnodes)
179 hiddenrevs = repoview.filterrevs(repo, 'visible')
179 hiddenrevs = repoview.filterrevs(repo, 'visible')
180 visibletostrip = list(repo.changelog.node(r)
180 visibletostrip = list(repo.changelog.node(r)
181 for r in (revstostrip - hiddenrevs))
181 for r in (revstostrip - hiddenrevs))
182 if visibletostrip:
182 if visibletostrip:
183 ui.status(_('The following changeset(s) or their ancestors have '
183 ui.status(_('The following changeset(s) or their ancestors have '
184 'local changes not on the remote:\n'))
184 'local changes not on the remote:\n'))
185 maxnodes = 10
185 maxnodes = 10
186 if ui.verbose or len(visibletostrip) <= maxnodes:
186 if ui.verbose or len(visibletostrip) <= maxnodes:
187 for n in visibletostrip:
187 for n in visibletostrip:
188 ui.status('%s\n' % node.short(n))
188 ui.status('%s\n' % node.short(n))
189 else:
189 else:
190 for n in visibletostrip[:maxnodes]:
190 for n in visibletostrip[:maxnodes]:
191 ui.status('%s\n' % node.short(n))
191 ui.status('%s\n' % node.short(n))
192 ui.status(_('...and %d more, use --verbose to list all\n') %
192 ui.status(_('...and %d more, use --verbose to list all\n') %
193 (len(visibletostrip) - maxnodes))
193 (len(visibletostrip) - maxnodes))
194 if not force:
194 if not force:
195 raise error.Abort(_('local changes found'),
195 raise error.Abort(_('local changes found'),
196 hint=_('use --force-delete-local-changes to '
196 hint=_('use --force-delete-local-changes to '
197 'ignore'))
197 'ignore'))
198
198
199 with ui.uninterruptible():
199 with ui.uninterruptible():
200 if revstostrip:
200 if revstostrip:
201 tostrip = [unfi.changelog.node(r) for r in revstostrip]
201 tostrip = [unfi.changelog.node(r) for r in revstostrip]
202 if repo['.'].node() in tostrip:
202 if repo['.'].node() in tostrip:
203 # stripping working copy, so move to a different commit first
203 # stripping working copy, so move to a different commit first
204 urev = max(repo.revs('(::%n) - %ln + null',
204 urev = max(repo.revs('(::%n) - %ln + null',
205 repo['.'].node(), visibletostrip))
205 repo['.'].node(), visibletostrip))
206 hg.clean(repo, urev)
206 hg.clean(repo, urev)
207 overrides = {('devel', 'strip-obsmarkers'): False}
207 overrides = {('devel', 'strip-obsmarkers'): False}
208 with ui.configoverride(overrides, 'narrow'):
208 with ui.configoverride(overrides, 'narrow'):
209 repair.strip(ui, unfi, tostrip, topic='narrow')
209 repair.strip(ui, unfi, tostrip, topic='narrow')
210
210
211 todelete = []
211 todelete = []
212 for f, f2, size in repo.store.datafiles():
212 for f, f2, size in repo.store.datafiles():
213 if f.startswith('data/'):
213 if f.startswith('data/'):
214 file = f[5:-2]
214 file = f[5:-2]
215 if not newmatch(file):
215 if not newmatch(file):
216 todelete.append(f)
216 todelete.append(f)
217 elif f.startswith('meta/'):
217 elif f.startswith('meta/'):
218 dir = f[5:-13]
218 dir = f[5:-13]
219 dirs = sorted(util.dirs({dir})) + [dir]
219 dirs = sorted(util.dirs({dir})) + [dir]
220 include = True
220 include = True
221 for d in dirs:
221 for d in dirs:
222 visit = newmatch.visitdir(d)
222 visit = newmatch.visitdir(d)
223 if not visit:
223 if not visit:
224 include = False
224 include = False
225 break
225 break
226 if visit == 'all':
226 if visit == 'all':
227 break
227 break
228 if not include:
228 if not include:
229 todelete.append(f)
229 todelete.append(f)
230
230
231 repo.destroying()
231 repo.destroying()
232
232
233 with repo.transaction('narrowing'):
233 with repo.transaction('narrowing'):
234 # Update narrowspec before removing revlogs, so repo won't be
234 # Update narrowspec before removing revlogs, so repo won't be
235 # corrupt in case of crash
235 # corrupt in case of crash
236 repo.setnarrowpats(newincludes, newexcludes)
236 repo.setnarrowpats(newincludes, newexcludes)
237
237
238 for f in todelete:
238 for f in todelete:
239 ui.status(_('deleting %s\n') % f)
239 ui.status(_('deleting %s\n') % f)
240 util.unlinkpath(repo.svfs.join(f))
240 util.unlinkpath(repo.svfs.join(f))
241 repo.store.markremoved(f)
241 repo.store.markremoved(f)
242
242
243 narrowspec.updateworkingcopy(repo, assumeclean=True)
243 narrowspec.updateworkingcopy(repo, assumeclean=True)
244 narrowspec.copytoworkingcopy(repo)
244 narrowspec.copytoworkingcopy(repo)
245
245
246 repo.destroyed()
246 repo.destroyed()
247
247
248 def _widen(ui, repo, remote, commoninc, oldincludes, oldexcludes,
248 def _widen(ui, repo, remote, commoninc, oldincludes, oldexcludes,
249 newincludes, newexcludes):
249 newincludes, newexcludes):
250 # for now we assume that if a server has ellipses enabled, we will be
250 # for now we assume that if a server has ellipses enabled, we will be
251 # exchanging ellipses nodes. In future we should add ellipses as a client
251 # exchanging ellipses nodes. In future we should add ellipses as a client
252 # side requirement (maybe) to distinguish a client is shallow or not and
252 # side requirement (maybe) to distinguish a client is shallow or not and
253 # then send that information to server whether we want ellipses or not.
253 # then send that information to server whether we want ellipses or not.
254 # Theoretically a non-ellipses repo should be able to use narrow
254 # Theoretically a non-ellipses repo should be able to use narrow
255 # functionality from an ellipses enabled server
255 # functionality from an ellipses enabled server
256 remotecap = remote.capabilities()
256 remotecap = remote.capabilities()
257 ellipsesremote = any(cap in remotecap
257 ellipsesremote = any(cap in remotecap
258 for cap in wireprototypes.SUPPORTED_ELLIPSESCAP)
258 for cap in wireprototypes.SUPPORTED_ELLIPSESCAP)
259
259
260 # check whether we are talking to a server which supports old version of
260 # check whether we are talking to a server which supports old version of
261 # ellipses capabilities
261 # ellipses capabilities
262 isoldellipses = (ellipsesremote and wireprototypes.ELLIPSESCAP1 in
262 isoldellipses = (ellipsesremote and wireprototypes.ELLIPSESCAP1 in
263 remotecap and wireprototypes.ELLIPSESCAP not in remotecap)
263 remotecap and wireprototypes.ELLIPSESCAP not in remotecap)
264
264
265 def pullbundle2extraprepare_widen(orig, pullop, kwargs):
265 def pullbundle2extraprepare_widen(orig, pullop, kwargs):
266 orig(pullop, kwargs)
266 orig(pullop, kwargs)
267 # The old{in,ex}cludepats have already been set by orig()
267 # The old{in,ex}cludepats have already been set by orig()
268 kwargs['includepats'] = newincludes
268 kwargs['includepats'] = newincludes
269 kwargs['excludepats'] = newexcludes
269 kwargs['excludepats'] = newexcludes
270 wrappedextraprepare = extensions.wrappedfunction(exchange,
270 wrappedextraprepare = extensions.wrappedfunction(exchange,
271 '_pullbundle2extraprepare', pullbundle2extraprepare_widen)
271 '_pullbundle2extraprepare', pullbundle2extraprepare_widen)
272
272
273 # define a function that narrowbundle2 can call after creating the
273 # define a function that narrowbundle2 can call after creating the
274 # backup bundle, but before applying the bundle from the server
274 # backup bundle, but before applying the bundle from the server
275 def setnewnarrowpats():
275 def setnewnarrowpats():
276 repo.setnarrowpats(newincludes, newexcludes)
276 repo.setnarrowpats(newincludes, newexcludes)
277 repo.setnewnarrowpats = setnewnarrowpats
277 repo.setnewnarrowpats = setnewnarrowpats
278 # silence the devel-warning of applying an empty changegroup
278 # silence the devel-warning of applying an empty changegroup
279 overrides = {('devel', 'all-warnings'): False}
279 overrides = {('devel', 'all-warnings'): False}
280
280
281 common = commoninc[0]
281 common = commoninc[0]
282 with ui.uninterruptible():
282 with ui.uninterruptible():
283 if ellipsesremote:
283 if ellipsesremote:
284 ds = repo.dirstate
284 ds = repo.dirstate
285 p1, p2 = ds.p1(), ds.p2()
285 p1, p2 = ds.p1(), ds.p2()
286 with ds.parentchange():
286 with ds.parentchange():
287 ds.setparents(node.nullid, node.nullid)
287 ds.setparents(node.nullid, node.nullid)
288 if isoldellipses:
288 if isoldellipses:
289 with wrappedextraprepare:
289 with wrappedextraprepare:
290 exchange.pull(repo, remote, heads=common)
290 exchange.pull(repo, remote, heads=common)
291 else:
291 else:
292 known = []
292 known = []
293 if ellipsesremote:
293 if ellipsesremote:
294 known = [node.hex(ctx.node()) for ctx in
294 known = [node.hex(ctx.node()) for ctx in
295 repo.set('::%ln', common)
295 repo.set('::%ln', common)
296 if ctx.node() != node.nullid]
296 if ctx.node() != node.nullid]
297 with remote.commandexecutor() as e:
297 with remote.commandexecutor() as e:
298 bundle = e.callcommand('narrow_widen', {
298 bundle = e.callcommand('narrow_widen', {
299 'oldincludes': oldincludes,
299 'oldincludes': oldincludes,
300 'oldexcludes': oldexcludes,
300 'oldexcludes': oldexcludes,
301 'newincludes': newincludes,
301 'newincludes': newincludes,
302 'newexcludes': newexcludes,
302 'newexcludes': newexcludes,
303 'cgversion': '03',
303 'cgversion': '03',
304 'commonheads': common,
304 'commonheads': common,
305 'known': known,
305 'known': known,
306 'ellipses': ellipsesremote,
306 'ellipses': ellipsesremote,
307 }).result()
307 }).result()
308
308
309 trmanager = exchange.transactionmanager(repo, 'widen', remote.url())
309 trmanager = exchange.transactionmanager(repo, 'widen', remote.url())
310 with trmanager, repo.ui.configoverride(overrides, 'widen'):
310 with trmanager, repo.ui.configoverride(overrides, 'widen'):
311 op = bundle2.bundleoperation(repo, trmanager.transaction,
311 op = bundle2.bundleoperation(repo, trmanager.transaction,
312 source='widen')
312 source='widen')
313 # TODO: we should catch error.Abort here
313 # TODO: we should catch error.Abort here
314 bundle2.processbundle(repo, bundle, op=op)
314 bundle2.processbundle(repo, bundle, op=op)
315
315
316 if ellipsesremote:
316 if ellipsesremote:
317 with ds.parentchange():
317 with ds.parentchange():
318 ds.setparents(p1, p2)
318 ds.setparents(p1, p2)
319
319
320 with repo.transaction('widening'):
320 with repo.transaction('widening'):
321 repo.setnewnarrowpats()
321 repo.setnewnarrowpats()
322 narrowspec.updateworkingcopy(repo)
322 narrowspec.updateworkingcopy(repo)
323 narrowspec.copytoworkingcopy(repo)
323 narrowspec.copytoworkingcopy(repo)
324
324
325 # TODO(rdamazio): Make new matcher format and update description
325 # TODO(rdamazio): Make new matcher format and update description
326 @command('tracked',
326 @command('tracked',
327 [('', 'addinclude', [], _('new paths to include')),
327 [('', 'addinclude', [], _('new paths to include')),
328 ('', 'removeinclude', [], _('old paths to no longer include')),
328 ('', 'removeinclude', [], _('old paths to no longer include')),
329 ('', 'addexclude', [], _('new paths to exclude')),
329 ('', 'addexclude', [], _('new paths to exclude')),
330 ('', 'import-rules', '', _('import narrowspecs from a file')),
330 ('', 'import-rules', '', _('import narrowspecs from a file')),
331 ('', 'removeexclude', [], _('old paths to no longer exclude')),
331 ('', 'removeexclude', [], _('old paths to no longer exclude')),
332 ('', 'clear', False, _('whether to replace the existing narrowspec')),
332 ('', 'clear', False, _('whether to replace the existing narrowspec')),
333 ('', 'force-delete-local-changes', False,
333 ('', 'force-delete-local-changes', False,
334 _('forces deletion of local changes when narrowing')),
334 _('forces deletion of local changes when narrowing')),
335 ('', 'update-working-copy', False,
335 ('', 'update-working-copy', False,
336 _('update working copy when the store has changed')),
336 _('update working copy when the store has changed')),
337 ] + commands.remoteopts,
337 ] + commands.remoteopts,
338 _('[OPTIONS]... [REMOTE]'),
338 _('[OPTIONS]... [REMOTE]'),
339 inferrepo=True)
339 inferrepo=True)
340 def trackedcmd(ui, repo, remotepath=None, *pats, **opts):
340 def trackedcmd(ui, repo, remotepath=None, *pats, **opts):
341 """show or change the current narrowspec
341 """show or change the current narrowspec
342
342
343 With no argument, shows the current narrowspec entries, one per line. Each
343 With no argument, shows the current narrowspec entries, one per line. Each
344 line will be prefixed with 'I' or 'X' for included or excluded patterns,
344 line will be prefixed with 'I' or 'X' for included or excluded patterns,
345 respectively.
345 respectively.
346
346
347 The narrowspec is comprised of expressions to match remote files and/or
347 The narrowspec is comprised of expressions to match remote files and/or
348 directories that should be pulled into your client.
348 directories that should be pulled into your client.
349 The narrowspec has *include* and *exclude* expressions, with excludes always
349 The narrowspec has *include* and *exclude* expressions, with excludes always
350 trumping includes: that is, if a file matches an exclude expression, it will
350 trumping includes: that is, if a file matches an exclude expression, it will
351 be excluded even if it also matches an include expression.
351 be excluded even if it also matches an include expression.
352 Excluding files that were never included has no effect.
352 Excluding files that were never included has no effect.
353
353
354 Each included or excluded entry is in the format described by
354 Each included or excluded entry is in the format described by
355 'hg help patterns'.
355 'hg help patterns'.
356
356
357 The options allow you to add or remove included and excluded expressions.
357 The options allow you to add or remove included and excluded expressions.
358
358
359 If --clear is specified, then all previous includes and excludes are DROPPED
359 If --clear is specified, then all previous includes and excludes are DROPPED
360 and replaced by the new ones specified to --addinclude and --addexclude.
360 and replaced by the new ones specified to --addinclude and --addexclude.
361 If --clear is specified without any further options, the narrowspec will be
361 If --clear is specified without any further options, the narrowspec will be
362 empty and will not match any files.
362 empty and will not match any files.
363
363
364 --import-rules accepts a path to a file containing rules, allowing you to
364 --import-rules accepts a path to a file containing rules, allowing you to
365 add --addinclude, --addexclude rules in bulk. Like the other include and
365 add --addinclude, --addexclude rules in bulk. Like the other include and
366 exclude switches, the changes are applied immediately.
366 exclude switches, the changes are applied immediately.
367 """
367 """
368 opts = pycompat.byteskwargs(opts)
368 opts = pycompat.byteskwargs(opts)
369 if repository.NARROW_REQUIREMENT not in repo.requirements:
369 if repository.NARROW_REQUIREMENT not in repo.requirements:
370 raise error.Abort(_('the tracked command is only supported on '
370 raise error.Abort(_('the tracked command is only supported on '
371 'respositories cloned with --narrow'))
371 'repositories cloned with --narrow'))
372
372
373 # Before supporting, decide whether it "hg tracked --clear" should mean
373 # Before supporting, decide whether it "hg tracked --clear" should mean
374 # tracking no paths or all paths.
374 # tracking no paths or all paths.
375 if opts['clear']:
375 if opts['clear']:
376 raise error.Abort(_('the --clear option is not yet supported'))
376 raise error.Abort(_('the --clear option is not yet supported'))
377
377
378 # import rules from a file
378 # import rules from a file
379 newrules = opts.get('import_rules')
379 newrules = opts.get('import_rules')
380 if newrules:
380 if newrules:
381 try:
381 try:
382 filepath = os.path.join(encoding.getcwd(), newrules)
382 filepath = os.path.join(encoding.getcwd(), newrules)
383 fdata = util.readfile(filepath)
383 fdata = util.readfile(filepath)
384 except IOError as inst:
384 except IOError as inst:
385 raise error.Abort(_("cannot read narrowspecs from '%s': %s") %
385 raise error.Abort(_("cannot read narrowspecs from '%s': %s") %
386 (filepath, encoding.strtolocal(inst.strerror)))
386 (filepath, encoding.strtolocal(inst.strerror)))
387 includepats, excludepats, profiles = sparse.parseconfig(ui, fdata,
387 includepats, excludepats, profiles = sparse.parseconfig(ui, fdata,
388 'narrow')
388 'narrow')
389 if profiles:
389 if profiles:
390 raise error.Abort(_("including other spec files using '%include' "
390 raise error.Abort(_("including other spec files using '%include' "
391 "is not supported in narrowspec"))
391 "is not supported in narrowspec"))
392 opts['addinclude'].extend(includepats)
392 opts['addinclude'].extend(includepats)
393 opts['addexclude'].extend(excludepats)
393 opts['addexclude'].extend(excludepats)
394
394
395 addedincludes = narrowspec.parsepatterns(opts['addinclude'])
395 addedincludes = narrowspec.parsepatterns(opts['addinclude'])
396 removedincludes = narrowspec.parsepatterns(opts['removeinclude'])
396 removedincludes = narrowspec.parsepatterns(opts['removeinclude'])
397 addedexcludes = narrowspec.parsepatterns(opts['addexclude'])
397 addedexcludes = narrowspec.parsepatterns(opts['addexclude'])
398 removedexcludes = narrowspec.parsepatterns(opts['removeexclude'])
398 removedexcludes = narrowspec.parsepatterns(opts['removeexclude'])
399
399
400 update_working_copy = opts['update_working_copy']
400 update_working_copy = opts['update_working_copy']
401 only_show = not (addedincludes or removedincludes or addedexcludes or
401 only_show = not (addedincludes or removedincludes or addedexcludes or
402 removedexcludes or newrules or update_working_copy)
402 removedexcludes or newrules or update_working_copy)
403
403
404 oldincludes, oldexcludes = repo.narrowpats
404 oldincludes, oldexcludes = repo.narrowpats
405
405
406 # filter the user passed additions and deletions into actual additions and
406 # filter the user passed additions and deletions into actual additions and
407 # deletions of excludes and includes
407 # deletions of excludes and includes
408 addedincludes -= oldincludes
408 addedincludes -= oldincludes
409 removedincludes &= oldincludes
409 removedincludes &= oldincludes
410 addedexcludes -= oldexcludes
410 addedexcludes -= oldexcludes
411 removedexcludes &= oldexcludes
411 removedexcludes &= oldexcludes
412
412
413 widening = addedincludes or removedexcludes
413 widening = addedincludes or removedexcludes
414 narrowing = removedincludes or addedexcludes
414 narrowing = removedincludes or addedexcludes
415
415
416 # Only print the current narrowspec.
416 # Only print the current narrowspec.
417 if only_show:
417 if only_show:
418 ui.pager('tracked')
418 ui.pager('tracked')
419 fm = ui.formatter('narrow', opts)
419 fm = ui.formatter('narrow', opts)
420 for i in sorted(oldincludes):
420 for i in sorted(oldincludes):
421 fm.startitem()
421 fm.startitem()
422 fm.write('status', '%s ', 'I', label='narrow.included')
422 fm.write('status', '%s ', 'I', label='narrow.included')
423 fm.write('pat', '%s\n', i, label='narrow.included')
423 fm.write('pat', '%s\n', i, label='narrow.included')
424 for i in sorted(oldexcludes):
424 for i in sorted(oldexcludes):
425 fm.startitem()
425 fm.startitem()
426 fm.write('status', '%s ', 'X', label='narrow.excluded')
426 fm.write('status', '%s ', 'X', label='narrow.excluded')
427 fm.write('pat', '%s\n', i, label='narrow.excluded')
427 fm.write('pat', '%s\n', i, label='narrow.excluded')
428 fm.end()
428 fm.end()
429 return 0
429 return 0
430
430
431 if update_working_copy:
431 if update_working_copy:
432 with repo.wlock(), repo.lock(), repo.transaction('narrow-wc'):
432 with repo.wlock(), repo.lock(), repo.transaction('narrow-wc'):
433 narrowspec.updateworkingcopy(repo)
433 narrowspec.updateworkingcopy(repo)
434 narrowspec.copytoworkingcopy(repo)
434 narrowspec.copytoworkingcopy(repo)
435 return 0
435 return 0
436
436
437 if not widening and not narrowing:
437 if not widening and not narrowing:
438 ui.status(_("nothing to widen or narrow\n"))
438 ui.status(_("nothing to widen or narrow\n"))
439 return 0
439 return 0
440
440
441 with repo.wlock(), repo.lock():
441 with repo.wlock(), repo.lock():
442 cmdutil.bailifchanged(repo)
442 cmdutil.bailifchanged(repo)
443
443
444 # Find the revisions we have in common with the remote. These will
444 # Find the revisions we have in common with the remote. These will
445 # be used for finding local-only changes for narrowing. They will
445 # be used for finding local-only changes for narrowing. They will
446 # also define the set of revisions to update for widening.
446 # also define the set of revisions to update for widening.
447 remotepath = ui.expandpath(remotepath or 'default')
447 remotepath = ui.expandpath(remotepath or 'default')
448 url, branches = hg.parseurl(remotepath)
448 url, branches = hg.parseurl(remotepath)
449 ui.status(_('comparing with %s\n') % util.hidepassword(url))
449 ui.status(_('comparing with %s\n') % util.hidepassword(url))
450 remote = hg.peer(repo, opts, url)
450 remote = hg.peer(repo, opts, url)
451
451
452 # check narrow support before doing anything if widening needs to be
452 # check narrow support before doing anything if widening needs to be
453 # performed. In future we should also abort if client is ellipses and
453 # performed. In future we should also abort if client is ellipses and
454 # server does not support ellipses
454 # server does not support ellipses
455 if widening and wireprototypes.NARROWCAP not in remote.capabilities():
455 if widening and wireprototypes.NARROWCAP not in remote.capabilities():
456 raise error.Abort(_("server does not support narrow clones"))
456 raise error.Abort(_("server does not support narrow clones"))
457
457
458 commoninc = discovery.findcommonincoming(repo, remote)
458 commoninc = discovery.findcommonincoming(repo, remote)
459
459
460 if narrowing:
460 if narrowing:
461 newincludes = oldincludes - removedincludes
461 newincludes = oldincludes - removedincludes
462 newexcludes = oldexcludes | addedexcludes
462 newexcludes = oldexcludes | addedexcludes
463 _narrow(ui, repo, remote, commoninc, oldincludes, oldexcludes,
463 _narrow(ui, repo, remote, commoninc, oldincludes, oldexcludes,
464 newincludes, newexcludes,
464 newincludes, newexcludes,
465 opts['force_delete_local_changes'])
465 opts['force_delete_local_changes'])
466 # _narrow() updated the narrowspec and _widen() below needs to
466 # _narrow() updated the narrowspec and _widen() below needs to
467 # use the updated values as its base (otherwise removed includes
467 # use the updated values as its base (otherwise removed includes
468 # and addedexcludes will be lost in the resulting narrowspec)
468 # and addedexcludes will be lost in the resulting narrowspec)
469 oldincludes = newincludes
469 oldincludes = newincludes
470 oldexcludes = newexcludes
470 oldexcludes = newexcludes
471
471
472 if widening:
472 if widening:
473 newincludes = oldincludes | addedincludes
473 newincludes = oldincludes | addedincludes
474 newexcludes = oldexcludes - removedexcludes
474 newexcludes = oldexcludes - removedexcludes
475 _widen(ui, repo, remote, commoninc, oldincludes, oldexcludes,
475 _widen(ui, repo, remote, commoninc, oldincludes, oldexcludes,
476 newincludes, newexcludes)
476 newincludes, newexcludes)
477
477
478 return 0
478 return 0
@@ -1,224 +1,224 b''
1 #testcases flat tree
1 #testcases flat tree
2 $ . "$TESTDIR/narrow-library.sh"
2 $ . "$TESTDIR/narrow-library.sh"
3
3
4 #if tree
4 #if tree
5 $ cat << EOF >> $HGRCPATH
5 $ cat << EOF >> $HGRCPATH
6 > [experimental]
6 > [experimental]
7 > treemanifest = 1
7 > treemanifest = 1
8 > EOF
8 > EOF
9 #endif
9 #endif
10
10
11 $ hg init master
11 $ hg init master
12 $ cd master
12 $ cd master
13 $ cat >> .hg/hgrc <<EOF
13 $ cat >> .hg/hgrc <<EOF
14 > [narrow]
14 > [narrow]
15 > serveellipses=True
15 > serveellipses=True
16 > EOF
16 > EOF
17
17
18 $ mkdir inside
18 $ mkdir inside
19 $ echo 'inside' > inside/f
19 $ echo 'inside' > inside/f
20 $ hg add inside/f
20 $ hg add inside/f
21 $ hg commit -m 'add inside'
21 $ hg commit -m 'add inside'
22
22
23 $ mkdir widest
23 $ mkdir widest
24 $ echo 'widest' > widest/f
24 $ echo 'widest' > widest/f
25 $ hg add widest/f
25 $ hg add widest/f
26 $ hg commit -m 'add widest'
26 $ hg commit -m 'add widest'
27
27
28 $ mkdir outside
28 $ mkdir outside
29 $ echo 'outside' > outside/f
29 $ echo 'outside' > outside/f
30 $ hg add outside/f
30 $ hg add outside/f
31 $ hg commit -m 'add outside'
31 $ hg commit -m 'add outside'
32
32
33 $ cd ..
33 $ cd ..
34
34
35 narrow clone the inside file
35 narrow clone the inside file
36
36
37 $ hg clone --narrow ssh://user@dummy/master narrow --include inside
37 $ hg clone --narrow ssh://user@dummy/master narrow --include inside
38 requesting all changes
38 requesting all changes
39 adding changesets
39 adding changesets
40 adding manifests
40 adding manifests
41 adding file changes
41 adding file changes
42 added 2 changesets with 1 changes to 1 files
42 added 2 changesets with 1 changes to 1 files
43 new changesets *:* (glob)
43 new changesets *:* (glob)
44 updating to branch default
44 updating to branch default
45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 $ cd narrow
46 $ cd narrow
47 $ hg tracked
47 $ hg tracked
48 I path:inside
48 I path:inside
49 $ ls
49 $ ls
50 inside
50 inside
51 $ cat inside/f
51 $ cat inside/f
52 inside
52 inside
53 $ cd ..
53 $ cd ..
54
54
55 add more upstream files which we will include in a wider narrow spec
55 add more upstream files which we will include in a wider narrow spec
56
56
57 $ cd master
57 $ cd master
58
58
59 $ mkdir wider
59 $ mkdir wider
60 $ echo 'wider' > wider/f
60 $ echo 'wider' > wider/f
61 $ hg add wider/f
61 $ hg add wider/f
62 $ echo 'widest v2' > widest/f
62 $ echo 'widest v2' > widest/f
63 $ hg commit -m 'add wider, update widest'
63 $ hg commit -m 'add wider, update widest'
64
64
65 $ echo 'widest v3' > widest/f
65 $ echo 'widest v3' > widest/f
66 $ hg commit -m 'update widest v3'
66 $ hg commit -m 'update widest v3'
67
67
68 $ echo 'inside v2' > inside/f
68 $ echo 'inside v2' > inside/f
69 $ hg commit -m 'update inside'
69 $ hg commit -m 'update inside'
70
70
71 $ mkdir outside2
71 $ mkdir outside2
72 $ echo 'outside2' > outside2/f
72 $ echo 'outside2' > outside2/f
73 $ hg add outside2/f
73 $ hg add outside2/f
74 $ hg commit -m 'add outside2'
74 $ hg commit -m 'add outside2'
75
75
76 $ echo 'widest v4' > widest/f
76 $ echo 'widest v4' > widest/f
77 $ hg commit -m 'update widest v4'
77 $ hg commit -m 'update widest v4'
78
78
79 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
79 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
80 7: update widest v4
80 7: update widest v4
81 6: add outside2
81 6: add outside2
82 5: update inside
82 5: update inside
83 4: update widest v3
83 4: update widest v3
84 3: add wider, update widest
84 3: add wider, update widest
85 2: add outside
85 2: add outside
86 1: add widest
86 1: add widest
87 0: add inside
87 0: add inside
88
88
89 $ cd ..
89 $ cd ..
90
90
91 Testing the --import-rules flag of `hg tracked` command
91 Testing the --import-rules flag of `hg tracked` command
92
92
93 $ cd narrow
93 $ cd narrow
94 $ hg tracked --import-rules
94 $ hg tracked --import-rules
95 hg tracked: option --import-rules requires argument
95 hg tracked: option --import-rules requires argument
96 hg tracked [OPTIONS]... [REMOTE]
96 hg tracked [OPTIONS]... [REMOTE]
97
97
98 show or change the current narrowspec
98 show or change the current narrowspec
99
99
100 options ([+] can be repeated):
100 options ([+] can be repeated):
101
101
102 --addinclude VALUE [+] new paths to include
102 --addinclude VALUE [+] new paths to include
103 --removeinclude VALUE [+] old paths to no longer include
103 --removeinclude VALUE [+] old paths to no longer include
104 --addexclude VALUE [+] new paths to exclude
104 --addexclude VALUE [+] new paths to exclude
105 --import-rules VALUE import narrowspecs from a file
105 --import-rules VALUE import narrowspecs from a file
106 --removeexclude VALUE [+] old paths to no longer exclude
106 --removeexclude VALUE [+] old paths to no longer exclude
107 --clear whether to replace the existing narrowspec
107 --clear whether to replace the existing narrowspec
108 --force-delete-local-changes forces deletion of local changes when
108 --force-delete-local-changes forces deletion of local changes when
109 narrowing
109 narrowing
110 --update-working-copy update working copy when the store has
110 --update-working-copy update working copy when the store has
111 changed
111 changed
112 -e --ssh CMD specify ssh command to use
112 -e --ssh CMD specify ssh command to use
113 --remotecmd CMD specify hg command to run on the remote side
113 --remotecmd CMD specify hg command to run on the remote side
114 --insecure do not verify server certificate (ignoring
114 --insecure do not verify server certificate (ignoring
115 web.cacerts config)
115 web.cacerts config)
116
116
117 (use 'hg tracked -h' to show more help)
117 (use 'hg tracked -h' to show more help)
118 [255]
118 [255]
119 $ hg tracked --import-rules doesnotexist
119 $ hg tracked --import-rules doesnotexist
120 abort: cannot read narrowspecs from '$TESTTMP/narrow/doesnotexist': $ENOENT$
120 abort: cannot read narrowspecs from '$TESTTMP/narrow/doesnotexist': $ENOENT$
121 [255]
121 [255]
122
122
123 $ cat > specs <<EOF
123 $ cat > specs <<EOF
124 > %include foo
124 > %include foo
125 > [include]
125 > [include]
126 > path:widest/
126 > path:widest/
127 > [exclude]
127 > [exclude]
128 > path:inside/
128 > path:inside/
129 > EOF
129 > EOF
130
130
131 $ hg tracked --import-rules specs
131 $ hg tracked --import-rules specs
132 abort: including other spec files using '%include' is not supported in narrowspec
132 abort: including other spec files using '%include' is not supported in narrowspec
133 [255]
133 [255]
134
134
135 $ cat > specs <<EOF
135 $ cat > specs <<EOF
136 > [include]
136 > [include]
137 > outisde
137 > outisde
138 > [exclude]
138 > [exclude]
139 > inside
139 > inside
140 > EOF
140 > EOF
141
141
142 $ hg tracked --import-rules specs
142 $ hg tracked --import-rules specs
143 comparing with ssh://user@dummy/master
143 comparing with ssh://user@dummy/master
144 searching for changes
144 searching for changes
145 looking for local changes to affected paths
145 looking for local changes to affected paths
146 deleting data/inside/f.i
146 deleting data/inside/f.i
147 deleting meta/inside/00manifest.i (tree !)
147 deleting meta/inside/00manifest.i (tree !)
148 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
148 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
149 adding changesets
149 adding changesets
150 adding manifests
150 adding manifests
151 adding file changes
151 adding file changes
152 added 2 changesets with 0 changes to 0 files
152 added 2 changesets with 0 changes to 0 files
153 $ hg tracked
153 $ hg tracked
154 I path:outisde
154 I path:outisde
155 X path:inside
155 X path:inside
156
156
157 Testing the --import-rules flag with --addinclude and --addexclude
157 Testing the --import-rules flag with --addinclude and --addexclude
158
158
159 $ cat > specs <<EOF
159 $ cat > specs <<EOF
160 > [include]
160 > [include]
161 > widest
161 > widest
162 > EOF
162 > EOF
163
163
164 $ hg tracked --import-rules specs --addinclude 'wider/'
164 $ hg tracked --import-rules specs --addinclude 'wider/'
165 comparing with ssh://user@dummy/master
165 comparing with ssh://user@dummy/master
166 searching for changes
166 searching for changes
167 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
167 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
168 adding changesets
168 adding changesets
169 adding manifests
169 adding manifests
170 adding file changes
170 adding file changes
171 added 3 changesets with 1 changes to 1 files
171 added 3 changesets with 1 changes to 1 files
172 $ hg tracked
172 $ hg tracked
173 I path:outisde
173 I path:outisde
174 I path:wider
174 I path:wider
175 I path:widest
175 I path:widest
176 X path:inside
176 X path:inside
177
177
178 $ cat > specs <<EOF
178 $ cat > specs <<EOF
179 > [exclude]
179 > [exclude]
180 > outside2
180 > outside2
181 > EOF
181 > EOF
182
182
183 $ hg tracked --import-rules specs --addexclude 'widest'
183 $ hg tracked --import-rules specs --addexclude 'widest'
184 comparing with ssh://user@dummy/master
184 comparing with ssh://user@dummy/master
185 searching for changes
185 searching for changes
186 looking for local changes to affected paths
186 looking for local changes to affected paths
187 deleting data/widest/f.i
187 deleting data/widest/f.i
188 deleting meta/widest/00manifest.i (tree !)
188 deleting meta/widest/00manifest.i (tree !)
189 $ hg tracked
189 $ hg tracked
190 I path:outisde
190 I path:outisde
191 I path:wider
191 I path:wider
192 X path:inside
192 X path:inside
193 X path:outside2
193 X path:outside2
194 X path:widest
194 X path:widest
195
195
196 $ hg tracked --import-rules specs --clear
196 $ hg tracked --import-rules specs --clear
197 abort: the --clear option is not yet supported
197 abort: the --clear option is not yet supported
198 [255]
198 [255]
199
199
200 Testing with passing a out of wdir file
200 Testing with passing a out of wdir file
201
201
202 $ cat > ../nspecs <<EOF
202 $ cat > ../nspecs <<EOF
203 > [include]
203 > [include]
204 > widest
204 > widest
205 > EOF
205 > EOF
206
206
207 $ hg tracked --import-rules ../nspecs
207 $ hg tracked --import-rules ../nspecs
208 comparing with ssh://user@dummy/master
208 comparing with ssh://user@dummy/master
209 searching for changes
209 searching for changes
210 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
210 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
211 adding changesets
211 adding changesets
212 adding manifests
212 adding manifests
213 adding file changes
213 adding file changes
214 added 3 changesets with 0 changes to 0 files
214 added 3 changesets with 0 changes to 0 files
215
215
216 $ cd ..
216 $ cd ..
217
217
218 Testing tracked command on a non-narrow repo
218 Testing tracked command on a non-narrow repo
219
219
220 $ hg init non-narrow
220 $ hg init non-narrow
221 $ cd non-narrow
221 $ cd non-narrow
222 $ hg tracked --addinclude foobar
222 $ hg tracked --addinclude foobar
223 abort: the tracked command is only supported on respositories cloned with --narrow
223 abort: the tracked command is only supported on repositories cloned with --narrow
224 [255]
224 [255]
General Comments 0
You need to be logged in to leave comments. Login now