2010-12-06 21 views
5

作爲標題,如果我從一個文件複製到目標文件,則我承諾進行更改。之後我想找到複製文件的父文件,我該怎麼辦?例如...如何在複製後找到單個文件的父文件?

汞柱複製文件1文件2
汞CI -m 「複製文件1到file2」

如何找到文件2的家長嗎?如果我使用hg parents命令,則只能找到changeset的父級而不是file2。

感謝....

回答

2

使用--template爲格式的日誌中:

hg log --template "{file_copies}\n" file2.txt 

過濾空字符串(第一行 - 在Unix中,第二行 - 在Windows中):

hg log --template "{file_copies}\n" file2.txt | grep . 
hg log --template "{file_copies}\n" file2.txt | findstr /R "." 
0

嗯,一種方法是你可以做的文件的DIFF:

 
hg log file2 -r 0: 

如果你知道在哪裏據介紹你應該明確說明,變更後的結腸:

 
hg log file2 -r 0:1 

輸出:

 
[C:\Temp\repo] :hg diff test2.txt -r 0:1 
diff --git a/test1.txt b/test2.txt 
copy from test1.txt 
copy to test2.txt 

但是可能有更好的方法。

+0

hg log命令可以跟蹤複製的文件。 – pyfunc 2010-12-06 09:50:43

7

汞日誌提供設施

hgt $ hg log --copies -v b.py 
changeset: 1:a9c003a9bddb 
tag:   tip 
user:  "xxxxx" 
date:  Mon Dec 06 01:40:01 2010 -0800 
files:  b.py 
copies:  b.py (a.py) 
description: 
copied file 

使用verbose mode--copies找到,如果該文件已被使用hg copy命令

相關問題