• Bruce Dawson's avatar
    Get full paths in presubmit traceback stacks · 0ba2fd42
    Bruce Dawson authored
    When investigating presubmits it is sometimes handy to get stacks in
    order to understand where a presubmit is being called from. In one
    recent investigation to see why CheckOwners was being called multiple
    times the traceback just said:
    
       File "c:\src\depot_tools\presubmit_support.py", line 1646, in _run_check_function
        result = eval(function_name + '(*__args)', context)
       File "<string>", line 1, in <module>
       File "PRESUBMIT.py", line 251, in CheckChangeOnUpload
    
    That's not very helpful because Chromium has 288 files named
    PRESUBMIT.py. This change just uses the actual presubmit path as the
    filename parameter to compile instead of a hard-coded string, which
    means that "PRESUBMIT.py" is replaced with the full path in the
    tracebacks.
    
    Bug: 1309977
    Change-Id: Icacfae4399444cb24e9cfb07475b90099e2e18d3
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3776955
    Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
    Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
    0ba2fd42
presubmit_support.py 73.3 KB