• Bruce Dawson's avatar
    Fix \r\r\n line endings in presubmit output · 00790d31
    Bruce Dawson authored
    When running "git cl presubmit --all" some of the presubmit messages
    were ending up double-spaced if the output is sent to a file and then
    loaded into notepad or Visual Studio. Visual Studio would complain
    about inconsistent line endings, and it turns out that this was all
    caused by some lines having \r\r\n line endings - notepad and Visual
    Studio interpret that as two line endings.
    
    The problem is that the stream that WinUnicodeOutput writes to does \n
    to \r\n translation. If the text being printed already has \r\n line
    endings then we get doubled-up \r characters. The fix is to replace all
    \r\n sequences with \n before calling write.
    
    This reduces the line count of the output by almost 2300 lines (more
    than 25% of the total) and makes it much more readable.
    
    Bug: 1309977
    Change-Id: Ie5475087badc3d3146e4f2ba41d30c9817dd375a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3589498Reviewed-by: 's avatarAravind Vasudevan <aravindvasudev@google.com>
    Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
    00790d31
fix_encoding.py 12.5 KB