在 hg 状态中显示重命名?
我知道 Mercurial 可以跟踪文件的重命名,但是当我执行 hg status
时,如何让它显示我的重命名而不是添加/删除?例如,而不是:
A bin/extract-csv-column.pl
A bin/find-mirna-binding.pl
A bin/xls2csv-separate-sheets.pl
A lib/Text/CSV/Euclid.pm
R src/extract-csv-column.pl
R src/find-mirna-binding.pl
R src/modules/Text/CSV/Euclid.pm
R src/xls2csv-separate-sheets.pl
我想要一些指示,表明四个文件已被移动。
我想我在某处读到输出是这样的,以保持与某些东西的向后兼容性,但我并不担心这一点。
I know that Mercurial can track renames of files, but how do I get it to show me renames instead of adds/removes when I do hg status
? For instance, instead of:
A bin/extract-csv-column.pl
A bin/find-mirna-binding.pl
A bin/xls2csv-separate-sheets.pl
A lib/Text/CSV/Euclid.pm
R src/extract-csv-column.pl
R src/find-mirna-binding.pl
R src/modules/Text/CSV/Euclid.pm
R src/xls2csv-separate-sheets.pl
I want some indication that four files have been moved.
I think I read somewhere that the output is like this to preserve backward-compatibility with something-or-other, but I'm not worried about that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有几种方法可以做到这一点。
在提交之前,您可以使用
hg diff --git
显示重命名的内容:请注意,这仅在您使用
hg mv
、hg rename 或
mv
和hg addremove --similarity 100
。提交后,您仍然可以使用
hg diff
,但必须使用-r
指定更改:对于
hg status
和hg log
,使用 -C 命令行标志查看文件复制的源。aTest.txt 正下方的行表示复制的源 (theTest.txt)。
您可以看到受影响的文件(test.txt 和 theTest.txt),并且“theTest.txt”是从 test.txt 复制的。
There are several ways to do this.
Before you commit, you can use
hg diff --git
to show what was renamed:Note that this only works if you used
hg mv
,hg rename
, ormv
andhg addremove --similarity 100
.After you commit, you can still use
hg diff
, but you'll have to specify the change using-r
:For both
hg status
andhg log
, use the -C command-line flag to see the source that a file was copied from.The line just below aTest.txt indicates the source it was copied from (theTest.txt).
You can see the files that were affected (test.txt and theTest.txt), and that "theTest.txt" was copied from test.txt.
您可以使用 hg Summary 查看有多少文件已被重命名。如果您想查看已重命名的实际文件,我发现的最快方法是执行
以下操作: 这将输出如下内容:
由于 hg status 认为重命名是复制和删除,因此重命名的文件将列出从文件复制。添加但未重命名的文件将不会列出从文件复制的文件。
You can find out how many files have been renamed with hg summary. If you want to see the actual files that were renamed, the fastest way I've found is to do:
This will output something like this:
Since hg status considers a rename to be a copy and a remove, your renamed files will list a copied from file. Files that were added but not renamed will not list a copied from file.