Patchwork [07,of,11] check-code: catch trailing space in comments

login
register
mail settings
Submitter Mads Kiilerich
Date April 15, 2013, 1:14 a.m.
Message ID <415afdd06dbd889b2c3a.1365988462@xps>
Download mbox | patch
Permalink /patch/1310/
State Accepted
Commit 2f6418d8a4c956297884d2bec31f21287678522b
Headers show

Comments

Mads Kiilerich - April 15, 2013, 1:14 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1365982643 -7200
# Node ID 415afdd06dbd889b2c3a8b10ad2200b6b59f7c16
# Parent  e534508c8fb6d85f150de86fdbe3f13e93c0e5be
check-code: catch trailing space in comments

Patch

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -19,7 +19,8 @@  def repquote(m):
 def reppython(m):
     comment = m.group('comment')
     if comment:
-        return "#" * len(comment)
+        l = len(comment.rstrip())
+        return "#" * l + comment[l:]
     return repquote(m)
 
 def repcomment(m):
diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py
+++ b/mercurial/pure/osutil.py
@@ -68,7 +68,7 @@  else:
 
     _INVALID_HANDLE_VALUE = _HANDLE(-1).value
 
-    # CreateFile 
+    # CreateFile
     _FILE_SHARE_READ = 0x00000001
     _FILE_SHARE_WRITE = 0x00000002
     _FILE_SHARE_DELETE = 0x00000004
diff --git a/mercurial/win32.py b/mercurial/win32.py
--- a/mercurial/win32.py
+++ b/mercurial/win32.py
@@ -52,7 +52,7 @@  class _BY_HANDLE_FILE_INFORMATION(ctypes
                 ('nFileIndexHigh', _DWORD),
                 ('nFileIndexLow', _DWORD)]
 
-# CreateFile 
+# CreateFile
 _FILE_SHARE_READ = 0x00000001
 _FILE_SHARE_WRITE = 0x00000002
 _FILE_SHARE_DELETE = 0x00000004