正在显示汞状态的重命名? [英] Showing renames in hg status?

查看:97
本文介绍了正在显示汞状态的重命名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Mercurial可以跟踪文件的重命名,但是当我执行hg status时如何将其重命名为 show 而不是添加/删除我?例如,代替:

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.

推荐答案

有几种方法可以做到这一点.

There are several ways to do this.

在提交之前,可以使用hg diff --git来显示重命名的内容:

Before you commit, you can use hg diff --git to show what was renamed:

$ hg diff --git
diff --git a/theTest.txt b/aTest.txt
rename from theTest.txt
rename to aTest.txt

请注意,这仅在使用hg mvhg renamemvhg addremove --similarity 100时有效.

Note that this only works if you used hg mv, hg rename, or mv and hg addremove --similarity 100.

提交后,仍然可以使用hg diff,但是必须使用-r指定更改:

After you commit, you can still use hg diff, but you'll have to specify the change using -r:

$ hg diff -r 0 -r 1 --git
diff --git a/test.txt b/theTest.txt
rename from test.txt
rename to theTest.txt

对于hg statushg log,都使用-C命令行标志查看复制文件的源.

For both hg status and hg log, use the -C command-line flag to see the source that a file was copied from.

$ hg status -C
A aTest.txt
  theTest.txt
R theTest.txt

aTest.txt下面的行表示从(theTest.txt)复制源.

The line just below aTest.txt indicates the source it was copied from (theTest.txt).

$ hg log -v -C
changeset:   1:4d7b42489d9f
tag:         tip
user:        jhurne
date:        Tue Apr 20 20:57:07 2010 -0400
files:       test.txt theTest.txt
copies:      theTest.txt (test.txt)
description:
Renamed test.txt

您可以看到受影响的文件(test.txt和theTest.txt),以及从thetest.txt复制的"theTest.txt".

You can see the files that were affected (test.txt and theTest.txt), and that "theTest.txt" was copied from test.txt.

这篇关于正在显示汞状态的重命名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆