Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 33507:e9672de52a23
debugignore: eliminate inconsistencies with `hg status` (issue5222)
Using a matcher for this command allows processing the named file(s) as
relative to cwd. It also leverages the icasefs normalization logic the same
way the status command does. (However, a false indicator is given for a
nonexistent file in some cases, e.g. passing 'foo.REJ' when that file doesn't
exist, and the rule is '*.rej'. Maybe the regex itself needs to be case
insensitive on these platforms, at least for the debug command.) Finally, the
file printed is relative to cwd and uses platform specific slashes, so a few
(glob)s were needed in seemingly unrelated tests.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 15 Jul 2017 15:23:29 -0400 |
parents | 9a9f95214f46 |
children | 9c4e2aa0a239 |
comparison
equal
deleted
inserted
replaced
33506:8a1a7935c047 | 33507:e9672de52a23 |
---|---|
864 ignore = repo.dirstate._ignore | 864 ignore = repo.dirstate._ignore |
865 if not files: | 865 if not files: |
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 |
873 if nf != '.': | 874 if nf != '.': |
874 if ignore(nf): | 875 if ignore(nf): |
880 ignored = p | 881 ignored = p |
881 ignoredata = repo.dirstate._ignorefileandline(p) | 882 ignoredata = repo.dirstate._ignorefileandline(p) |
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'))], |
898 _('[-f FORMAT] -c|-m|FILE'), | 899 _('[-f FORMAT] -c|-m|FILE'), |
899 optionalrepo=True) | 900 optionalrepo=True) |