Show More
@@ -2441,7 +2441,8 b' def debugignore(ui, repo, *files, **opts' | |||
|
2441 | 2441 | |
|
2442 | 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 | 2447 | ignore = repo.dirstate._ignore |
|
2447 | 2448 | if not files: |
@@ -2454,13 +2455,16 b' def debugignore(ui, repo, *files, **opts' | |||
|
2454 | 2455 | else: |
|
2455 | 2456 | for f in files: |
|
2456 | 2457 | ignored = None |
|
2458 | ignoredata = None | |
|
2457 | 2459 | if f != '.': |
|
2458 | 2460 | if ignore(f): |
|
2459 | 2461 | ignored = f |
|
2462 | ignoredata = repo.dirstate._ignorefileandline(f) | |
|
2460 | 2463 | else: |
|
2461 | 2464 | for p in util.finddirs(f): |
|
2462 | 2465 | if ignore(p): |
|
2463 | 2466 | ignored = p |
|
2467 | ignoredata = repo.dirstate._ignorefileandline(p) | |
|
2464 | 2468 | break |
|
2465 | 2469 | if ignored: |
|
2466 | 2470 | if ignored == f: |
@@ -2468,6 +2472,9 b' def debugignore(ui, repo, *files, **opts' | |||
|
2468 | 2472 | else: |
|
2469 | 2473 | ui.write("%s is ignored because of containing folder %s\n" |
|
2470 | 2474 | % (f, ignored)) |
|
2475 | ignorefile, lineno, line = ignoredata | |
|
2476 | ui.write("(ignore rule in %s, line %d: '%s')\n" | |
|
2477 | % (ignorefile, lineno, line)) | |
|
2471 | 2478 | else: |
|
2472 | 2479 | ui.write("%s is not ignored\n" % f) |
|
2473 | 2480 |
@@ -168,6 +168,7 b' Test relative ignore path (issue4473):' | |||
|
168 | 168 | |
|
169 | 169 | $ hg debugignore b.o |
|
170 | 170 | b.o is ignored |
|
171 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: '*') | |
|
171 | 172 | |
|
172 | 173 | $ cd .. |
|
173 | 174 | |
@@ -198,6 +199,7 b' Check recursive glob pattern matches no ' | |||
|
198 | 199 | a.c is not ignored |
|
199 | 200 | $ hg debugignore dir/c.o |
|
200 | 201 | dir/c.o is ignored |
|
202 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') | |
|
201 | 203 | |
|
202 | 204 | Check using 'include:' in ignore file |
|
203 | 205 | |
@@ -283,3 +285,4 b' Check include subignore at the same leve' | |||
|
283 | 285 | [1] |
|
284 | 286 | $ hg debugignore dir1/file2 |
|
285 | 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