移动/重命名后Mercurial diff无法正常工作 [英] Mercurial diff not working after move/rename

查看:79
本文介绍了移动/重命名后Mercurial diff无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将文件移到另一个目录后,我无法再显示两个修订版之间的差异.例如:

After moving a file into another directory I cannot display the differences between two revisions any more. E.g.:

hg init

touch a
hg add a
hg ci -m "Added a"

echo "Bli" >> a
hg ci -m "Bli"
echo "Bla" >> a
hg ci -m "Bla"
echo "Blub" >> a
hg ci -m "Blub"

hg diff -r 0 -r 1 a

结果:

diff -r 8603b08f5a64 -r 16675581549e a
--- a/a Mon Apr 23 09:03:25 2012 +0000
+++ b/a Mon Apr 23 09:03:25 2012 +0000
@@ -0,0 +1,1 @@
+Bli

这是我所期望的.但是,当我现在将文件"a"移到目录"b"中时:

which is what I expected. However when I now move the file "a" into a directory "b":

mkdir b
hg mv a b/a
hg ci -m "Moved a into b"
cd b
hg diff -r 0 -r 1 a

这什么都没有(根本没有输出).我还尝试使用git Giff算法:

this results into nothing (no output at all). I also tried to use the git Giff algo:

hg diff --git -r 0 -r 1 a

同样,完全没有输出.日志似乎还可以:

Again, there is no output at all. The log is seems to be OK:

hg log --follow a

结果:

changeset:   4:cb8185829bfd
tag:         tip
user:        XXXXXXXXXXXXXXXXXXXXXXXXXXXX
date:        Mon Apr 23 09:08:12 2012 +0000
summary:     Moved a into b

changeset:   3:4d1ba89885c3
user:        XXXXXXXXXXXXXXXXXXXXXXXXXXXX
date:        Mon Apr 23 09:03:26 2012 +0000
summary:     Blub

changeset:   2:e9126dbb50b2
user:        XXXXXXXXXXXXXXXXXXXXXXXXXXXX
date:        Mon Apr 23 09:03:26 2012 +0000
summary:     Bla

changeset:   1:16675581549e
user:        XXXXXXXXXXXXXXXXXXXXXXXXXXXX
date:        Mon Apr 23 09:03:25 2012 +0000
summary:     Bli

changeset:   0:8603b08f5a64
user:        XXXXXXXXXXXXXXXXXXXXXXXXXXXX
date:        Mon Apr 23 09:03:25 2012 +0000
summary:     Added a

有人知道为什么移动文件后差异不起作用吗?非常感谢您的帮助.

Has someone any idea why the diff is not working after moving a file? Your help is greatly appreciated.

推荐答案

对于今天的Mercurial,这很难或不可能.我认为您可以得到的最接近的是

This is difficult or impossible with today's Mercurial. I think the closest you can get is

hg log --follow --patch -r 1 a

Mercurial将在显示差异(--patch)之前先向后跟踪副本(--follow).

where Mercurial will track the copies backwards (--follow) before showing the diff (--patch).

通常,Mercurial不会跟踪文件身份,而只会跟踪文件名.当您通过修订号查找信息时,Mercurial将首先查找修订,然后查找该修订中的所有文件名.所以hg cat -r 0 a将为您提供与

In general, Mercurial does not track file identities, it only tracks file names. When you lookup information by revision number, Mercurial will first lookup the revision, and then lookup any filenames in that revision. So hg cat -r 0 a will give you the same result as

hg update -r 0
cat a

即,结果独立于当前的工作目录父目录.

i.e., the result is independent of the current working directory parent.

这篇关于移动/重命名后Mercurial diff无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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