##// END OF EJS Templates
debugignore: find out if a file is being ignored...
Laurent Charignon -
r27671:067d87fe default
parent child Browse files
Show More
@@ -2435,15 +2435,41 b' def debuggetbundle(ui, repopath, bundlep'
2435 raise error.Abort(_('unknown bundle type specified with --type'))
2435 raise error.Abort(_('unknown bundle type specified with --type'))
2436 changegroup.writebundle(ui, bundle, bundlepath, bundletype)
2436 changegroup.writebundle(ui, bundle, bundlepath, bundletype)
2437
2437
2438 @command('debugignore', [], '')
2438 @command('debugignore', [], '[FILE]')
2439 def debugignore(ui, repo, *values, **opts):
2439 def debugignore(ui, repo, *files, **opts):
2440 """display the combined ignore pattern"""
2440 """display the combined ignore pattern and information about ignored files
2441
2442 With no argument display the combined ignore pattern.
2443
2444 Given space separated file names, shows if the given file is ignored.
2445 """
2441 ignore = repo.dirstate._ignore
2446 ignore = repo.dirstate._ignore
2447 if not files:
2448 # Show all the patterns
2442 includepat = getattr(ignore, 'includepat', None)
2449 includepat = getattr(ignore, 'includepat', None)
2443 if includepat is not None:
2450 if includepat is not None:
2444 ui.write("%s\n" % includepat)
2451 ui.write("%s\n" % includepat)
2445 else:
2452 else:
2446 raise error.Abort(_("no ignore patterns found"))
2453 raise error.Abort(_("no ignore patterns found"))
2454 else:
2455 for f in files:
2456 ignored = None
2457 if f != '.':
2458 if ignore(f):
2459 ignored = f
2460 else:
2461 for p in util.finddirs(f):
2462 if ignore(p):
2463 ignored = p
2464 break
2465 if ignored:
2466 if ignored == f:
2467 ui.write("%s is ignored\n" % f)
2468 else:
2469 ui.write("%s is ignored because of containing folder %s\n"
2470 % (f, ignored))
2471 else:
2472 ui.write("%s is not ignored\n" % f)
2447
2473
2448 @command('debugindex', debugrevlogopts +
2474 @command('debugindex', debugrevlogopts +
2449 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
2475 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
@@ -829,7 +829,8 b' Test list of internal help commands'
829 debugfsinfo show information detected about current filesystem
829 debugfsinfo show information detected about current filesystem
830 debuggetbundle
830 debuggetbundle
831 retrieves a bundle from a repo
831 retrieves a bundle from a repo
832 debugignore display the combined ignore pattern
832 debugignore display the combined ignore pattern and information about
833 ignored files
833 debugindex dump the contents of an index file
834 debugindex dump the contents of an index file
834 debugindexdot
835 debugindexdot
835 dump an index DAG as a graphviz dot file
836 dump an index DAG as a graphviz dot file
@@ -166,6 +166,9 b' Test relative ignore path (issue4473):'
166 $ hg debugignore
166 $ hg debugignore
167 (?:(?:|.*/)[^/]*(?:/|$))
167 (?:(?:|.*/)[^/]*(?:/|$))
168
168
169 $ hg debugignore b.o
170 b.o is ignored
171
169 $ cd ..
172 $ cd ..
170
173
171 Check patterns that match only the directory
174 Check patterns that match only the directory
@@ -191,6 +194,10 b' Check recursive glob pattern matches no '
191 ? a.c
194 ? a.c
192 ? a.o
195 ? a.o
193 ? syntax
196 ? syntax
197 $ hg debugignore a.c
198 a.c is not ignored
199 $ hg debugignore dir/c.o
200 dir/c.o is ignored
194
201
195 Check using 'include:' in ignore file
202 Check using 'include:' in ignore file
196
203
@@ -274,3 +281,5 b' Check include subignore at the same leve'
274
281
275 $ hg status | grep file2
282 $ hg status | grep file2
276 [1]
283 [1]
284 $ hg debugignore dir1/file2
285 dir1/file2 is ignored
General Comments 0
You need to be logged in to leave comments. Login now