简体   繁体   English

有没有办法在 Tortoisehg 控制台窗口中对输出进行排序?

[英]Is there a way to sort the output in the Tortoisehg console window?

I can run hg commands in the TortoiseHg console window.我可以在 TortoiseHg 控制台窗口中运行 hg 命令。 Sometimes I want to pipe to another command to filter output or sort.有时我想通过管道传递给另一个命令来过滤输出或排序。 Not really sure how to do this in TortoiseHg (although I know I can run hg commands in the 'Cmd' window and pipe to another command like a normal batch file).不太确定如何在 TortoiseHg 中执行此操作(尽管我知道我可以在“Cmd”窗口中运行 hg 命令并像普通批处理文件一样通过管道传输到另一个命令)。

I've tried both Unix and Windows CMD versions of piping the output.我已经尝试过 Unix 和 Windows CMD 版本的管道输出。 As a simple example (to illustrate the issue, but not necessarily the limits of what I could try...):作为一个简单的例子(为了说明问题,但不一定是我可以尝试的限制......):

Unix:  hg branches | grep -i inactive 
CMD:   hg branches | findstr /I inactive

Neither of these will work in the TortoiseHg "Console" window.这些都不能在 TortoiseHg “控制台”窗口中工作。 I would find it more convenient to run commands in the console window than in the CMD shell as my typed commands would be shown chronologically with other commands executed via the GUI (that normally show in the Console window).我会发现在控制台窗口中运行命令比在 CMD shell 中更方便,因为我键入的命令将与通过 GUI 执行的其他命令(通常显示在控制台窗口中)按时间顺序显示。

  1. Even if your host OS is Windows, you can have (now) 2 shells in command-prompt (directly or as Terminal Window in THG): classic CMD and PowerShell.即使您的主机操作系统是 Windows,您也可以(现在)在命令提示符中拥有 2 个 shell(直接或作为 THG 中的终端窗口):经典 CMD 和 PowerShell。 Defining which type you use will be better for faster understanding of a problem定义您使用的类型将更好地更快地理解问题
  2. Same shell as command-prompt or Terminal will produce absolutely the same result与命令提示符或终端相同的 shell 将产生完全相同的结果

Your cmd-sample "just work", can't see any troubles here (win32chcp is local extension for console outputs, irrelevant to tasks)您的 cmd-sample “正常工作”,在这里看不到任何问题(win32chcp 是控制台输出的本地扩展,与任务无关)

Terminal THG终端 THG

THG\hg-git>hg branches | findstr /I inactive
[win32chcp] switching your console encoding into cp1251
1.0.x                       2155:ae8b3247c149 (inactive)
0.10.x                      2118:4a18ab4b2fed (inactive)

THG\hg-git>

CMD-window CMD-窗口

Microsoft Windows [Version 10.0.19043.1766]
(c) Microsoft Corporation. All rights reserved.

THG\hg-git>hg branches | findstr /I inactive
[win32chcp] switching your console encoding into cp1251
1.0.x                       2155:ae8b3247c149 (inactive)
0.10.x                      2118:4a18ab4b2fed (inactive)

THG\hg-git>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM