style: Make the style hook work in directories other than the root.
This commit is contained in:
parent
0cbbedcc33
commit
1c23bc100f
1 changed files with 8 additions and 5 deletions
|
@ -400,10 +400,12 @@ def do_check_style(hgui, repo, *files, **args):
|
||||||
if skip(fname):
|
if skip(fname):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if whitespace.apply(fname, prompt):
|
fpath = joinpath(repo.root, fname)
|
||||||
|
|
||||||
|
if whitespace.apply(fpath, prompt):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if sorted_includes.apply(fname, prompt):
|
if sorted_includes.apply(fpath, prompt):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -416,12 +418,13 @@ def do_check_style(hgui, repo, *files, **args):
|
||||||
if skip(fname):
|
if skip(fname):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
fpath = joinpath(repo.root, fname)
|
||||||
regions = modregions(wctx, fname)
|
regions = modregions(wctx, fname)
|
||||||
|
|
||||||
if whitespace.apply(fname, prompt, regions):
|
if whitespace.apply(fpath, prompt, regions):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if sorted_includes.apply(fname, prompt, regions):
|
if sorted_includes.apply(fpath, prompt, regions):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
@ -434,7 +437,7 @@ def do_check_format(hgui, repo, **args):
|
||||||
verbose = 0
|
verbose = 0
|
||||||
stats = ValidationStats()
|
stats = ValidationStats()
|
||||||
for f in modified + added:
|
for f in modified + added:
|
||||||
validate(f, stats, verbose, None)
|
validate(joinpath(repo.root, f), stats, verbose, None)
|
||||||
|
|
||||||
if stats:
|
if stats:
|
||||||
stats.dump()
|
stats.dump()
|
||||||
|
|
Loading…
Reference in a new issue