mercurial

How can I find parent file of one single file after copying?


As title, If I do copy from one file to destination file, then I commit the change. Afterwards I want to find parent file of copied file, How can I do? for example...

hg copy file1 file2
hg ci -m "copy file1 to file2"

how to find parent of file2? If I use hg parents command, only find parent of changeset not file2.

thanks....


Solution

  • Use --template for format log:

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

    Filter empty strings (first line - in Unix, second - in Windows):

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