Mercurial 复制后如何找到单个文件的父文件?

Mercurial 复制后如何找到单个文件的父文件?,mercurial,Mercurial,作为标题,如果我从一个文件复制到目标文件,那么我提交更改。之后我想找到复制文件的父文件,我该怎么办?例如 hg复制文件1文件2 hg ci-m“将文件1复制到文件2” 如何查找文件2的父级?如果我使用hgparents命令,则只查找变更集的父项,而不查找file2 谢谢……好的,一种方法是您可以对文件进行区分: hg log file2 -r 0: hg日志文件2-服务器0: 如果知道引入变更集的位置,则应在冒号后指定: hg log file2 -r 0:1 hg日志文件2-服务器0:1 输出

作为标题,如果我从一个文件复制到目标文件,那么我提交更改。之后我想找到复制文件的父文件,我该怎么办?例如

hg复制文件1文件2
hg ci-m“将文件1复制到文件2”

如何查找文件2的父级?如果我使用hgparents命令,则只查找变更集的父项,而不查找file2


谢谢……

好的,一种方法是您可以对文件进行区分:

hg log file2 -r 0: hg日志文件2-服务器0: 如果知道引入变更集的位置,则应在冒号后指定:

hg log file2 -r 0:1 hg日志文件2-服务器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 [C:\Temp\repo]:hg diff test2.txt-r 0:1 diff——git a/test1.txt b/test2.txt 从test1.txt复制 复制到test2.txt
但是可能有更好的方法。

hg日志提供了工具

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模式
--copies
查找文件是否已使用
hg copy
命令

使用--format log模板:

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 "."