Mercurial:Hg状态 - 您知道如何在Windows操作系统上报告文件名(无路径)吗?

时间:2015-08-14 19:04:52

标签: mercurial

当我运行Hg状态时,我会得到如下所示的列表:

M proj\Content\Site.css
M proj\Views\DoThing\DoThing.cshtml
M proj\Views\MainThing\MainThing.cshtml
M proj\Views\GetThing\GetThing.cshtml
M proj\Views\ViewThing\Index.cshtml
M proj\Views\Home\Index.cshtml
M proj\Views\Shared\_Layout.cshtml
M proj\js\extra.js

有谁知道如何运行hg状态并轻松获取要列出的filnames - 没有路径信息?类似的东西:

  M Site.css
  M DoThing.cshtml
  M MainThing.cshtml
  M GetThing.cshtml
  M Index.cshtml
  M Index.cshtml
  M _Layout.cshtml
  M extra.js

或者,如果你有一些快速的方法可以通过某些命令行之类的东西来管理它,比如findstr或者很容易快速剥离路径的东西,请告诉我。

我需要显示的最终格式。任何人?任何人吗?

2 个答案:

答案 0 :(得分:1)

如果您安装了Mercurial 3.5(即截至本文撰写时的最新版本),您可以使用实验状态模板。使用hg help status -v查看是否有--template选项。如果是这样,请使用:

hg status -T '{status} {path|basename}\n{if(copy, "  {copy}\n")}'

这是正常status输出,但{path}已替换为{path|basename}

答案 1 :(得分:0)

如果您可以使用 sed

提取文件路径并替换为文件名

getschema