Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

mercurial

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

like image 637
feedfood Avatar asked Dec 06 '10 09:12

feedfood


2 Answers

hg log provides the facility

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

Use the verbose mode and also --copies to find if the file has been used using hg copy command

like image 144
pyfunc Avatar answered Oct 07 '22 12:10

pyfunc


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 "."
like image 39
Alex Avatar answered Oct 07 '22 13:10

Alex