Print this page
5025 import and use mandoc
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Albert Lee <trisk@nexenta.com>
Approved by: TBD

*** 14,23 **** --- 14,24 ---- # # # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2008, 2011 Richard Lowe + # Copyright 2014 Garrett D'Amore <garrett@damore.org> # '''OpenSolaris extensions to Mercurial This extension contains a number of commands to help you work with
*** 102,112 **** from mercurial import cmdutil, ignore, node, patch from onbld.Scm.WorkSpace import WorkSpace, WorkList from onbld.Scm.Backup import CdmBackup from onbld.Checks import Cddl, Comments, Copyright, CStyle, HdrChk ! from onbld.Checks import JStyle, Keywords, Mapfile def yes_no(ui, msg, default): if default: prompt = ' [Y/n]:' --- 103,113 ---- from mercurial import cmdutil, ignore, node, patch from onbld.Scm.WorkSpace import WorkSpace, WorkList from onbld.Scm.Backup import CdmBackup from onbld.Checks import Cddl, Comments, Copyright, CStyle, HdrChk ! from onbld.Checks import JStyle, Keywords, ManLint, Mapfile def yes_no(ui, msg, default): if default: prompt = ' [Y/n]:'
*** 388,397 **** --- 389,432 ---- ret |= Cddl.cddlchk(fh, lenient=lenient, output=ui) fh.close() return ret + def cdm_manlintchk(ui, repo, *args, **opts): + '''check for mandoc lint + + Check for man page formatting errors. + + Files can be excluded from this check using the manlint.NOT + file. See NOT Files in the extension documentation ('hg help + cdm'). + ''' + + filelist = buildfilelist(wslist[repo], opts.get('parent'), args) + exclude = not_check(repo, 'manlint') + ret = 0 + + # Man pages are identified as having a suffix starting with a digit. + ManfileRE = re.compile(r'.*\.[0-9][a-z]*$', re.IGNORECASE) + + ui.write('Man format check:\n') + + for f, e in filelist: + if e and e.is_removed(): + continue + elif (not ManfileRE.match(f)): + continue + elif (e or opts.get('honour_nots')) and exclude(f): + ui.status('Skipping %s...\n' % f) + continue + + fh = open(f, 'r') + ret |= ManLint.manlint(fh, output=ui, picky=True) + fh.close() + return ret + + def cdm_mapfilechk(ui, repo, *args, **opts): '''check for a valid mapfile header block in active files Check that all link-editor mapfiles contain the standard mapfile header comment directing the reader to the document containing
*** 792,801 **** --- 827,837 ---- - copyright (copyright statements) - cstyle (C source style) - hdrchk (C header style) - jstyle (java source style) + - manlint (man page formatting) - mapfilechk (link-editor mapfiles) - permchk (file permissions) - keywords (SCCS keywords) With the global -q/--quiet option, only provide output for those
*** 804,813 **** --- 840,850 ---- cmds = [cdm_copyright, cdm_cstyle, cdm_hdrchk, cdm_jstyle, + cmd_manlintchk, cdm_mapfilechk, cdm_permchk, cdm_keywords] return run_checks(wslist[repo], cmds, *args, **opts)
*** 826,835 **** --- 863,873 ---- - copyright (copyright statements) - cstyle (C source style) - hdrchk (C header style) - jstyle (java source style) - keywords (SCCS keywords) + - manlint (man page formatting) - mapfilechk (link-editor mapfiles) - permchk (file permissions) - tagchk (addition/modification of tags) Additionally, the workspace is checked for outgoing merges (which
*** 846,855 **** --- 884,894 ---- # cmds = [cdm_copyright, cdm_cstyle, cdm_hdrchk, cdm_jstyle, + cdm_manlintchk, cdm_mapfilechk, cdm_permchk, cdm_keywords, cdm_comchk, cdm_tagchk,
*** 1429,1438 **** --- 1468,1479 ---- '^list|active': (cdm_list, [('p', 'parent', '', 'parent workspace'), ('a', 'added', None, 'show added files'), ('m', 'modified', None, 'show modified files'), ('r', 'removed', None, 'show removed files')], 'hg list [-amrRu] [-p PARENT]'), + 'manlint': (cdm_manlintchk, [('p', 'parent', '', 'parent workspace')], + 'hg manlint [-p PARENT]'), 'mapfilechk': (cdm_mapfilechk, [('p', 'parent', '', 'parent workspace')], 'hg mapfilechk [-p PARENT]'), '^nits': (cdm_nits, [('p', 'parent', '', 'parent workspace')], 'hg nits [-p PARENT]'), '^pbchk': (cdm_pbchk, [('p', 'parent', '', 'parent workspace'),