Patchwork [7,of,8,v2] docchecker: scan for missing space before :hg:

login
register
mail settings
Submitter timeless@mozdev.org
Date Jan. 12, 2016, 7:09 a.m.
Message ID <457ce2835c3e3ac6a6be.1452582588@waste.org>
Download mbox | patch
Permalink /patch/12686/
State Superseded
Commit 3d1baa702d1a2b38fe13b215c787faf8719adaa4
Headers show

Comments

timeless@mozdev.org - Jan. 12, 2016, 7:09 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1452110718 0
#      Wed Jan 06 20:05:18 2016 +0000
# Node ID 457ce2835c3e3ac6a6be76bac77e125d8c2cb658
# Parent  9476a42c610ac08288ff20e39b8ded0dc0e09862
docchecker: scan for missing space before :hg:
Augie Fackler - Jan. 12, 2016, 3:03 p.m.
On Tue, Jan 12, 2016 at 01:09:48AM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1452110718 0
> #      Wed Jan 06 20:05:18 2016 +0000
> # Node ID 457ce2835c3e3ac6a6be76bac77e125d8c2cb658
> # Parent  9476a42c610ac08288ff20e39b8ded0dc0e09862
> docchecker: scan for missing space before :hg:

I've queued patches 1-7. I'm not sure how I feel about 8 - it
definitely has its heart in the right place, but I'm unsure if it's
worth the complexity. I'll leave that to others to decide.

>
> diff --git a/doc/docchecker b/doc/docchecker
> --- a/doc/docchecker
> +++ b/doc/docchecker
> @@ -11,11 +11,15 @@
>
>  leadingline = re.compile(r'(^\s*)(\S.*)$')
>  hg_backtick = re.compile(r""":hg:`[^`]*'[^`]*`""")
> +hg_cramped = re.compile(r'\w:hg:`')
>
>  def check(line):
>    if hg_backtick.search(line):
>      print(line)
>      print("""warning: please avoid nesting ' in :hg:`...`""")
> +  if hg_cramped.search(line):
> +    print(line)
> +    print('warning: please have a space before :hg:')
>
>  def work(file):
>    (llead, lline) = ('', '')
> diff --git a/tests/test-gendoc.t b/tests/test-gendoc.t
> --- a/tests/test-gendoc.t
> +++ b/tests/test-gendoc.t
> @@ -32,6 +32,8 @@
>
>    % extracting documentation from de
>    checking for parse errors
> +  Die Dateien werden dem Projektarchiv beim n\xc3\xa4chsten \xc3\x9cbernehmen (commit) hinzugef\xc3\xbcgt. Um dies vorher r\xc3\xbcckg\xc3\xa4ngig zu machen, siehe:hg:`forget`. (esc)
> +  warning: please have a space before :hg:
>
>    % extracting documentation from el
>    checking for parse errors
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/doc/docchecker b/doc/docchecker
--- a/doc/docchecker
+++ b/doc/docchecker
@@ -11,11 +11,15 @@ 
 
 leadingline = re.compile(r'(^\s*)(\S.*)$')
 hg_backtick = re.compile(r""":hg:`[^`]*'[^`]*`""")
+hg_cramped = re.compile(r'\w:hg:`')
 
 def check(line):
   if hg_backtick.search(line):
     print(line)
     print("""warning: please avoid nesting ' in :hg:`...`""")
+  if hg_cramped.search(line):
+    print(line)
+    print('warning: please have a space before :hg:')
 
 def work(file):
   (llead, lline) = ('', '')
diff --git a/tests/test-gendoc.t b/tests/test-gendoc.t
--- a/tests/test-gendoc.t
+++ b/tests/test-gendoc.t
@@ -32,6 +32,8 @@ 
   
   % extracting documentation from de
   checking for parse errors
+  Die Dateien werden dem Projektarchiv beim n\xc3\xa4chsten \xc3\x9cbernehmen (commit) hinzugef\xc3\xbcgt. Um dies vorher r\xc3\xbcckg\xc3\xa4ngig zu machen, siehe:hg:`forget`. (esc)
+  warning: please have a space before :hg:
   
   % extracting documentation from el
   checking for parse errors