##// END OF EJS Templates
debugcommands: move 'debugignore' in the new module
Gregory Szorc -
r30527:243ecbd4 default
parent child Browse files
Show More
@@ -1858,51 +1858,6 b' def copy(ui, repo, *pats, **opts):'
1858 with repo.wlock(False):
1858 with repo.wlock(False):
1859 return cmdutil.copy(ui, repo, pats, opts)
1859 return cmdutil.copy(ui, repo, pats, opts)
1860
1860
1861 @command('debugignore', [], '[FILE]')
1862 def debugignore(ui, repo, *files, **opts):
1863 """display the combined ignore pattern and information about ignored files
1864
1865 With no argument display the combined ignore pattern.
1866
1867 Given space separated file names, shows if the given file is ignored and
1868 if so, show the ignore rule (file and line number) that matched it.
1869 """
1870 ignore = repo.dirstate._ignore
1871 if not files:
1872 # Show all the patterns
1873 includepat = getattr(ignore, 'includepat', None)
1874 if includepat is not None:
1875 ui.write("%s\n" % includepat)
1876 else:
1877 raise error.Abort(_("no ignore patterns found"))
1878 else:
1879 for f in files:
1880 nf = util.normpath(f)
1881 ignored = None
1882 ignoredata = None
1883 if nf != '.':
1884 if ignore(nf):
1885 ignored = nf
1886 ignoredata = repo.dirstate._ignorefileandline(nf)
1887 else:
1888 for p in util.finddirs(nf):
1889 if ignore(p):
1890 ignored = p
1891 ignoredata = repo.dirstate._ignorefileandline(p)
1892 break
1893 if ignored:
1894 if ignored == nf:
1895 ui.write(_("%s is ignored\n") % f)
1896 else:
1897 ui.write(_("%s is ignored because of "
1898 "containing folder %s\n")
1899 % (f, ignored))
1900 ignorefile, lineno, line = ignoredata
1901 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
1902 % (ignorefile, lineno, line))
1903 else:
1904 ui.write(_("%s is not ignored\n") % f)
1905
1906 @command('debugindex', debugrevlogopts +
1861 @command('debugindex', debugrevlogopts +
1907 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1862 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1908 _('[-f FORMAT] -c|-m|FILE'),
1863 _('[-f FORMAT] -c|-m|FILE'),
@@ -632,3 +632,48 b' def debuggetbundle(ui, repopath, bundlep'
632 if bundletype not in bundle2.bundletypes:
632 if bundletype not in bundle2.bundletypes:
633 raise error.Abort(_('unknown bundle type specified with --type'))
633 raise error.Abort(_('unknown bundle type specified with --type'))
634 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
634 bundle2.writebundle(ui, bundle, bundlepath, bundletype)
635
636 @command('debugignore', [], '[FILE]')
637 def debugignore(ui, repo, *files, **opts):
638 """display the combined ignore pattern and information about ignored files
639
640 With no argument display the combined ignore pattern.
641
642 Given space separated file names, shows if the given file is ignored and
643 if so, show the ignore rule (file and line number) that matched it.
644 """
645 ignore = repo.dirstate._ignore
646 if not files:
647 # Show all the patterns
648 includepat = getattr(ignore, 'includepat', None)
649 if includepat is not None:
650 ui.write("%s\n" % includepat)
651 else:
652 raise error.Abort(_("no ignore patterns found"))
653 else:
654 for f in files:
655 nf = util.normpath(f)
656 ignored = None
657 ignoredata = None
658 if nf != '.':
659 if ignore(nf):
660 ignored = nf
661 ignoredata = repo.dirstate._ignorefileandline(nf)
662 else:
663 for p in util.finddirs(nf):
664 if ignore(p):
665 ignored = p
666 ignoredata = repo.dirstate._ignorefileandline(p)
667 break
668 if ignored:
669 if ignored == nf:
670 ui.write(_("%s is ignored\n") % f)
671 else:
672 ui.write(_("%s is ignored because of "
673 "containing folder %s\n")
674 % (f, ignored))
675 ignorefile, lineno, line = ignoredata
676 ui.write(_("(ignore rule in %s, line %d: '%s')\n")
677 % (ignorefile, lineno, line))
678 else:
679 ui.write(_("%s is not ignored\n") % f)
General Comments 0
You need to be logged in to leave comments. Login now