style: Make the style hook work in directories other than the root.
authorNathan Binkert <nate@binkert.org>
Wed, 25 May 2011 04:19:31 +0000 (21:19 -0700)
committerNathan Binkert <nate@binkert.org>
Wed, 25 May 2011 04:19:31 +0000 (21:19 -0700)
util/style.py

index 30d39aae8a298fc42b894ca49c8d9a380f94a54f..2b9f654d4554a3c7a1267a08c857c6061bd3520b 100644 (file)
@@ -400,10 +400,12 @@ def do_check_style(hgui, repo, *files, **args):
         if skip(fname):
             continue
 
-        if whitespace.apply(fname, prompt):
+        fpath = joinpath(repo.root, fname)
+
+        if whitespace.apply(fpath, prompt):
             return True
 
-        if sorted_includes.apply(fname, prompt):
+        if sorted_includes.apply(fpath, prompt):
             return True
 
     try:
@@ -416,12 +418,13 @@ def do_check_style(hgui, repo, *files, **args):
         if skip(fname):
             continue
 
+        fpath = joinpath(repo.root, fname)
         regions = modregions(wctx, fname)
 
-        if whitespace.apply(fname, prompt, regions):
+        if whitespace.apply(fpath, prompt, regions):
             return True
 
-        if sorted_includes.apply(fname, prompt, regions):
+        if sorted_includes.apply(fpath, prompt, regions):
             return True
 
     return False
@@ -434,7 +437,7 @@ def do_check_format(hgui, repo, **args):
     verbose = 0
     stats = ValidationStats()
     for f in modified + added:
-        validate(f, stats, verbose, None)
+        validate(joinpath(repo.root, f), stats, verbose, None)
 
     if stats:
         stats.dump()