https://bz.mercurial-scm.org/show_bug.cgi?id=6640
Bug ID: 6640 Summary: Color mode autodetection incorrect for modern Cygwin/MSYS2 + Command Prompt Product: Mercurial Version: stable branch Hardware: PC OS: Windows Status: UNCONFIRMED Severity: feature Priority: wish Component: color Assignee: bugzi...@mercurial-scm.org Reporter: mhent...@mozilla.com CC: mercurial-devel@mercurial-scm.org Python Version: --- (I'm guessing) that, when running on Windows, the color mode should be: * "win32" if the terminal is Command Prompt (and perhaps Windows Terminal) * "ansi" if the terminal is TTY-based, like Mintty, Conemu, etc. The current Windows color mode detection does this by checking $TERM [1]. This used to work because older Cygwin/MSYS used `TERM=cygwin`. However, modern Cygwin/MSYS2 uses `TERM=xterm-256color` in the Command Prompt (and just `TERM=xterm` in Mintty). This causes issues where colored output is mis-formatted. You can reproduce this by: 1. Install Python 3 2. `py -m pip install mercurial --user` 3. Create a repo and put a changed file in it, do an `hg addremove` 4. Install MSYS2 [2] 5. Start a Command Prompt 6. `C:\msys64\msys2_shell.cmd -no-start -defterm` 7. `cd <path to repo you created` 8. `C:\Users\<User>\AppData\Roaming\Python\Python<version>\Scripts\hg.exe commit -m "message"` The "no username supplied" error should have raw ansi sequences on either side of it. I'm not sure what the solution is here. You can look for the `$TERM_PROGRAM` environment variable, but that's not standardized. My Windows-foo is not sufficiently advanced to have a straightforward recommendation :) There is a workaround for others affected by this: set the "color.mode" option to "win32". [1] https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/color.py#l258 [2] https://www.msys2.org/ -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel