diff contrib/check-config.py @ 33570:e470f12d7d05

check-config: mention the file and line of the error I used this to more quickly track down a failing test-check-config.t issue in another repo. I thought it might be useful more generally, so I'm sending it out in case others think it's a worthwhile change.
author Ryan McElroy <rmcelroy@fb.com>
date Tue, 18 Jul 2017 06:27:36 -0700
parents 5d8942dbe49e
children 143d7b27b09c
line wrap: on
line diff
--- a/contrib/check-config.py	Tue Jul 18 07:47:28 2017 -0700
+++ b/contrib/check-config.py	Tue Jul 18 06:27:36 2017 -0700
@@ -48,7 +48,9 @@
         prevname = ''
         confsect = ''
         carryover = ''
+        linenum = 0
         for l in open(f):
+            linenum += 1
 
             # check topic-like bits
             m = re.match('\s*``(\S+)``', l)
@@ -110,9 +112,10 @@
                     default = '<variable>'
                 if (name in foundopts and (ctype, default) != foundopts[name]
                     and name not in allowinconsistent):
-                    print(l)
+                    print(l.rstrip())
                     print("conflict on %s: %r != %r" % (name, (ctype, default),
                                                         foundopts[name]))
+                    print("at %s:%d:" % (f, linenum))
                 foundopts[name] = (ctype, default)
                 carryover = ''
             else: