##// END OF EJS Templates
debugignore: eliminate inconsistencies with `hg status` (issue5222)...
Matt Harbison -
r33507:e9672de5 default
parent child Browse files
Show More
@@ -866,7 +866,8 b' def debugignore(ui, repo, *files, **opts'
866 # Show all the patterns
866 # Show all the patterns
867 ui.write("%s\n" % repr(ignore))
867 ui.write("%s\n" % repr(ignore))
868 else:
868 else:
869 for f in files:
869 m = scmutil.match(repo[None], pats=files)
870 for f in m.files():
870 nf = util.normpath(f)
871 nf = util.normpath(f)
871 ignored = None
872 ignored = None
872 ignoredata = None
873 ignoredata = None
@@ -882,16 +883,16 b' def debugignore(ui, repo, *files, **opts'
882 break
883 break
883 if ignored:
884 if ignored:
884 if ignored == nf:
885 if ignored == nf:
885 ui.write(_("%s is ignored\n") % f)
886 ui.write(_("%s is ignored\n") % m.uipath(f))
886 else:
887 else:
887 ui.write(_("%s is ignored because of "
888 ui.write(_("%s is ignored because of "
888 "containing folder %s\n")
889 "containing folder %s\n")
889 % (f, ignored))
890 % (m.uipath(f), ignored))
890 ignorefile, lineno, line = ignoredata
891 ignorefile, lineno, line = ignoredata
891 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
892 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
892 % (ignorefile, lineno, line))
893 % (ignorefile, lineno, line))
893 else:
894 else:
894 ui.write(_("%s is not ignored\n") % f)
895 ui.write(_("%s is not ignored\n") % m.uipath(f))
895
896
896 @command('debugindex', cmdutil.debugrevlogopts +
897 @command('debugindex', cmdutil.debugrevlogopts +
897 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
898 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
@@ -52,6 +52,35 b' Should display baz only:'
52 abort: $TESTTMP/ignorerepo/.hgignore: invalid pattern (relre): *.o (glob)
52 abort: $TESTTMP/ignorerepo/.hgignore: invalid pattern (relre): *.o (glob)
53 [255]
53 [255]
54
54
55 Ensure given files are relative to cwd
56
57 $ echo "dir/.*\.o" > .hgignore
58 $ hg status -i
59 I dir/c.o
60
61 $ hg debugignore dir/c.o dir/missing.o
62 dir/c.o is ignored (glob)
63 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
64 dir/missing.o is ignored (glob)
65 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
66 $ cd dir
67 $ hg debugignore c.o missing.o
68 c.o is ignored
69 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
70 missing.o is ignored
71 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
72
73 For icasefs, inexact matches also work, except for missing files
74
75 #if icasefs
76 $ hg debugignore c.O missing.O
77 c.o is ignored
78 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
79 missing.O is not ignored
80 #endif
81
82 $ cd ..
83
55 $ echo ".*\.o" > .hgignore
84 $ echo ".*\.o" > .hgignore
56 $ hg status
85 $ hg status
57 A dir/b.o
86 A dir/b.o
@@ -207,7 +236,7 b' Check recursive glob pattern matches no '
207 $ hg debugignore a.c
236 $ hg debugignore a.c
208 a.c is not ignored
237 a.c is not ignored
209 $ hg debugignore dir/c.o
238 $ hg debugignore dir/c.o
210 dir/c.o is ignored
239 dir/c.o is ignored (glob)
211 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') (glob)
240 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') (glob)
212
241
213 Check using 'include:' in ignore file
242 Check using 'include:' in ignore file
@@ -293,7 +322,7 b' Check include subignore at the same leve'
293 $ hg status | grep file2
322 $ hg status | grep file2
294 [1]
323 [1]
295 $ hg debugignore dir1/file2
324 $ hg debugignore dir1/file2
296 dir1/file2 is ignored
325 dir1/file2 is ignored (glob)
297 (ignore rule in dir2/.hgignore, line 1: 'file*2')
326 (ignore rule in dir2/.hgignore, line 1: 'file*2')
298
327
299 #if windows
328 #if windows
General Comments 0
You need to be logged in to leave comments. Login now