##// END OF EJS Templates
debugignore: find out why a file is being ignored (issue4856)...
Laurent Charignon -
r27672:f2da9bb8 default
parent child Browse files
Show More
@@ -2441,7 +2441,8 b' def debugignore(ui, repo, *files, **opts'
2441
2441
2442 With no argument display the combined ignore pattern.
2442 With no argument display the combined ignore pattern.
2443
2443
2444 Given space separated file names, shows if the given file is ignored.
2444 Given space separated file names, shows if the given file is ignored and
2445 if so, show the ignore rule (file and line number) that matched it.
2445 """
2446 """
2446 ignore = repo.dirstate._ignore
2447 ignore = repo.dirstate._ignore
2447 if not files:
2448 if not files:
@@ -2454,13 +2455,16 b' def debugignore(ui, repo, *files, **opts'
2454 else:
2455 else:
2455 for f in files:
2456 for f in files:
2456 ignored = None
2457 ignored = None
2458 ignoredata = None
2457 if f != '.':
2459 if f != '.':
2458 if ignore(f):
2460 if ignore(f):
2459 ignored = f
2461 ignored = f
2462 ignoredata = repo.dirstate._ignorefileandline(f)
2460 else:
2463 else:
2461 for p in util.finddirs(f):
2464 for p in util.finddirs(f):
2462 if ignore(p):
2465 if ignore(p):
2463 ignored = p
2466 ignored = p
2467 ignoredata = repo.dirstate._ignorefileandline(p)
2464 break
2468 break
2465 if ignored:
2469 if ignored:
2466 if ignored == f:
2470 if ignored == f:
@@ -2468,6 +2472,9 b' def debugignore(ui, repo, *files, **opts'
2468 else:
2472 else:
2469 ui.write("%s is ignored because of containing folder %s\n"
2473 ui.write("%s is ignored because of containing folder %s\n"
2470 % (f, ignored))
2474 % (f, ignored))
2475 ignorefile, lineno, line = ignoredata
2476 ui.write("(ignore rule in %s, line %d: '%s')\n"
2477 % (ignorefile, lineno, line))
2471 else:
2478 else:
2472 ui.write("%s is not ignored\n" % f)
2479 ui.write("%s is not ignored\n" % f)
2473
2480
@@ -168,6 +168,7 b' Test relative ignore path (issue4473):'
168
168
169 $ hg debugignore b.o
169 $ hg debugignore b.o
170 b.o is ignored
170 b.o is ignored
171 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: '*')
171
172
172 $ cd ..
173 $ cd ..
173
174
@@ -198,6 +199,7 b' Check recursive glob pattern matches no '
198 a.c is not ignored
199 a.c is not ignored
199 $ hg debugignore dir/c.o
200 $ hg debugignore dir/c.o
200 dir/c.o is ignored
201 dir/c.o is ignored
202 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o')
201
203
202 Check using 'include:' in ignore file
204 Check using 'include:' in ignore file
203
205
@@ -283,3 +285,4 b' Check include subignore at the same leve'
283 [1]
285 [1]
284 $ hg debugignore dir1/file2
286 $ hg debugignore dir1/file2
285 dir1/file2 is ignored
287 dir1/file2 is ignored
288 (ignore rule in dir2/.hgignore, line 1: 'file*2')
General Comments 0
You need to be logged in to leave comments. Login now